From b0afb8fe0ff1d87165af9df61501197a06240dda Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 28 Dec 2025 12:13:40 +0100 Subject: Sync with Gnulib stable-202507 code (a8ac9f9ce5) --- gl/Makefile.am | 1040 ++++++++++- gl/_Noreturn.h | 41 +- gl/af_alg.c | 2 +- gl/af_alg.h | 2 +- gl/alloca.in.h | 2 +- gl/arg-nonnull.h | 2 +- gl/arpa_inet.c | 21 + gl/arpa_inet.in.h | 58 +- gl/asnprintf.c | 2 +- gl/asprintf.c | 2 +- gl/assert.in.h | 2 +- gl/attribute.h | 132 +- gl/base64.c | 8 +- gl/base64.h | 4 +- gl/basename-lgpl.c | 2 +- gl/basename-lgpl.h | 2 +- gl/basename.c | 2 +- gl/btowc.c | 2 +- gl/byteswap.c | 21 + gl/byteswap.in.h | 106 +- gl/c++defs.h | 50 +- gl/c-ctype.c | 21 + gl/c-ctype.h | 366 ++++ gl/c32is-impl.h | 105 ++ gl/c32isalnum.c | 26 + gl/c32isalpha.c | 26 + gl/c32isblank.c | 26 + gl/c32iscntrl.c | 26 + gl/c32isdigit.c | 26 + gl/c32isgraph.c | 26 + gl/c32islower.c | 26 + gl/c32isprint.c | 26 + gl/c32ispunct.c | 26 + gl/c32isspace.c | 26 + gl/c32isupper.c | 26 + gl/c32isxdigit.c | 26 + gl/c32to-impl.h | 103 ++ gl/c32tolower.c | 26 + gl/c32width.c | 102 ++ gl/calloc.c | 17 +- gl/cdefs.h | 16 +- gl/cloexec.c | 2 +- gl/cloexec.h | 2 +- gl/close.c | 2 +- gl/dirname-lgpl.c | 2 +- gl/dirname.c | 2 +- gl/dirname.h | 2 +- gl/dup2.c | 2 +- gl/dynarray.h | 2 +- gl/errno.in.h | 11 +- gl/error.c | 177 +- gl/error.in.h | 71 +- gl/exitfail.c | 2 +- gl/exitfail.h | 2 +- gl/fcntl.c | 47 +- gl/fcntl.in.h | 41 +- gl/fd-hook.c | 2 +- gl/fd-hook.h | 2 +- gl/fflush.c | 15 +- gl/filename.h | 2 +- gl/float+.h | 2 +- gl/float.c | 99 +- gl/float.in.h | 221 ++- gl/floor.c | 2 +- gl/floorf.c | 2 +- gl/fopen.c | 6 +- gl/fpurge.c | 8 +- gl/freading.c | 8 +- gl/freading.h | 2 +- gl/free.c | 2 +- gl/fseek.c | 2 +- gl/fseeko.c | 24 +- gl/fseterr.c | 84 + gl/fseterr.h | 55 + gl/fstat.c | 2 +- gl/fsusage.c | 2 +- gl/fsusage.h | 2 +- gl/ftell.c | 2 +- gl/ftello.c | 11 +- gl/gai_strerror.c | 6 +- gl/getaddrinfo.c | 74 +- gl/getdelim.c | 2 +- gl/getdtablesize.c | 2 +- gl/gethostname.c | 2 +- gl/getline.c | 2 +- gl/getloadavg.c | 48 +- gl/getopt-cdefs.in.h | 12 +- gl/getopt-core.h | 2 +- gl/getopt-ext.h | 2 +- gl/getopt-pfx-core.h | 12 +- gl/getopt-pfx-ext.h | 4 +- gl/getopt.c | 8 +- gl/getopt.in.h | 7 +- gl/getopt1.c | 2 +- gl/getopt_int.h | 2 +- gl/getprogname.c | 2 +- gl/getprogname.h | 2 +- gl/gettext.h | 114 +- gl/gl_openssl.h | 2 +- gl/glthread/lock.c | 46 +- gl/glthread/lock.h | 153 +- gl/glthread/once.c | 80 + gl/glthread/once.h | 272 +++ gl/glthread/threadlib.c | 2 +- gl/hard-locale.c | 2 +- gl/hard-locale.h | 2 +- gl/ialloc.c | 2 +- gl/ialloc.h | 39 +- gl/idpriv-droptemp.c | 14 +- gl/idpriv.h | 2 +- gl/idx.h | 2 +- gl/inet_ntop.c | 4 +- gl/inet_pton.c | 268 +++ gl/intprops-internal.h | 27 +- gl/intprops.h | 10 +- gl/inttypes.in.h | 18 +- gl/iswblank.c | 2 +- gl/iswctype-impl.h | 2 +- gl/iswctype.c | 2 +- gl/iswdigit.c | 2 +- gl/iswpunct.c | 2 +- gl/iswxdigit.c | 2 +- gl/itold.c | 2 +- gl/langinfo.in.h | 49 +- gl/lc-charset-dispatch.c | 2 +- gl/lc-charset-dispatch.h | 2 +- gl/libc-config.h | 7 +- gl/limits.in.h | 8 +- gl/localcharset.c | 10 +- gl/localcharset.h | 2 +- gl/locale.in.h | 195 ++- gl/localeconv.c | 2 +- gl/lseek.c | 2 +- gl/lstat.c | 104 ++ gl/m4/00gnulib.m4 | 3 +- gl/m4/__inline.m4 | 3 +- gl/m4/absolute-header.m4 | 3 +- gl/m4/af_alg.m4 | 3 +- gl/m4/alloca.m4 | 3 +- gl/m4/arpa_inet_h.m4 | 9 +- gl/m4/assert_h.m4 | 76 +- gl/m4/base64.m4 | 3 +- gl/m4/btowc.m4 | 13 +- gl/m4/build-to-host.m4 | 274 +++ gl/m4/builtin-expect.m4 | 10 +- gl/m4/byteswap.m4 | 34 +- gl/m4/c-bool.m4 | 20 +- gl/m4/c32rtomb.m4 | 187 ++ gl/m4/calloc.m4 | 73 +- gl/m4/close.m4 | 3 +- gl/m4/codeset.m4 | 3 +- gl/m4/double-slash-root.m4 | 3 +- gl/m4/dup2.m4 | 3 +- gl/m4/eealloc.m4 | 32 - gl/m4/environ.m4 | 3 +- gl/m4/errno_h.m4 | 13 +- gl/m4/error.m4 | 4 +- gl/m4/error_h.m4 | 20 +- gl/m4/exponentd.m4 | 7 +- gl/m4/extensions-aix.m4 | 26 + gl/m4/extensions.m4 | 3 +- gl/m4/extern-inline.m4 | 3 +- gl/m4/fclose.m4 | 3 +- gl/m4/fcntl-o.m4 | 97 +- gl/m4/fcntl.m4 | 3 +- gl/m4/fcntl_h.m4 | 3 +- gl/m4/fflush.m4 | 14 +- gl/m4/float_h.m4 | 30 +- gl/m4/floorf.m4 | 3 +- gl/m4/fopen.m4 | 3 +- gl/m4/fpurge.m4 | 94 +- gl/m4/freading.m4 | 3 +- gl/m4/free.m4 | 3 +- gl/m4/fseek.m4 | 3 +- gl/m4/fseeko.m4 | 9 +- gl/m4/fseterr.m4 | 15 + gl/m4/fstat.m4 | 3 +- gl/m4/fstypename.m4 | 3 +- gl/m4/fsusage.m4 | 4 +- gl/m4/ftell.m4 | 3 +- gl/m4/ftello.m4 | 9 +- gl/m4/getaddrinfo.m4 | 46 +- gl/m4/getdelim.m4 | 3 +- gl/m4/getdtablesize.m4 | 3 +- gl/m4/gethostname.m4 | 3 +- gl/m4/getline.m4 | 3 +- gl/m4/getloadavg.m4 | 5 +- gl/m4/getopt.m4 | 16 +- gl/m4/getprogname.m4 | 3 +- gl/m4/gl-openssl.m4 | 3 +- gl/m4/gnulib-cache.m4 | 2 +- gl/m4/gnulib-common.m4 | 457 ++++- gl/m4/gnulib-comp.m4 | 517 +++++- gl/m4/gnulib-i18n.m4 | 61 + gl/m4/gnulib-tool.m4 | 8 +- gl/m4/hostent.m4 | 3 +- gl/m4/idpriv.m4 | 3 +- gl/m4/include_next.m4 | 3 +- gl/m4/inet_ntop.m4 | 3 +- gl/m4/inet_pton.m4 | 72 + gl/m4/intmax_t.m4 | 3 +- gl/m4/inttypes.m4 | 3 +- gl/m4/inttypes_h.m4 | 3 +- gl/m4/iswblank.m4 | 3 +- gl/m4/iswctype.m4 | 3 +- gl/m4/iswdigit.m4 | 21 +- gl/m4/iswpunct.m4 | 3 +- gl/m4/iswxdigit.m4 | 21 +- gl/m4/langinfo_h.m4 | 20 +- gl/m4/largefile.m4 | 11 +- gl/m4/libunistring-base.m4 | 204 +++ gl/m4/limits-h.m4 | 3 +- gl/m4/localcharset.m4 | 3 +- gl/m4/locale-en.m4 | 138 ++ gl/m4/locale-fr.m4 | 25 +- gl/m4/locale-ja.m4 | 10 +- gl/m4/locale-zh.m4 | 24 +- gl/m4/locale_h.m4 | 52 +- gl/m4/localeconv.m4 | 3 +- gl/m4/lock.m4 | 3 +- gl/m4/lseek.m4 | 3 +- gl/m4/lstat.m4 | 82 + gl/m4/malloc.m4 | 139 +- gl/m4/malloca.m4 | 7 +- gl/m4/math_h.m4 | 14 +- gl/m4/mbchar.m4 | 15 + gl/m4/mbiter.m4 | 16 + gl/m4/mbrtoc32.m4 | 326 ++++ gl/m4/mbrtowc.m4 | 37 +- gl/m4/mbsinit.m4 | 3 +- gl/m4/mbstate_t.m4 | 3 +- gl/m4/mbtowc.m4 | 3 +- gl/m4/memchr.m4 | 7 +- gl/m4/minmax.m4 | 3 +- gl/m4/mktime.m4 | 6 +- gl/m4/mmap-anon.m4 | 3 +- gl/m4/mode_t.m4 | 3 +- gl/m4/mountlist.m4 | 18 +- gl/m4/msvc-inval.m4 | 3 +- gl/m4/msvc-nothrow.m4 | 3 +- gl/m4/multiarch.m4 | 3 +- gl/m4/musl.m4 | 3 +- gl/m4/netdb_h.m4 | 3 +- gl/m4/netinet_in_h.m4 | 3 +- gl/m4/nl_langinfo.m4 | 13 +- gl/m4/nocrash.m4 | 3 +- gl/m4/off64_t.m4 | 32 + gl/m4/off_t.m4 | 3 +- gl/m4/once.m4 | 14 + gl/m4/open-cloexec.m4 | 3 +- gl/m4/open-slash.m4 | 3 +- gl/m4/open.m4 | 8 +- gl/m4/pathmax.m4 | 3 +- gl/m4/pid_t.m4 | 3 +- gl/m4/printf.m4 | 288 +++- gl/m4/pthread-once.m4 | 83 + gl/m4/pthread-spin.m4 | 72 + gl/m4/pthread_h.m4 | 293 ++++ gl/m4/pthread_rwlock_rdlock.m4 | 3 +- gl/m4/realloc.m4 | 153 +- gl/m4/reallocarray.m4 | 16 +- gl/m4/regex.m4 | 26 +- gl/m4/sched_h.m4 | 102 ++ gl/m4/servent.m4 | 3 +- gl/m4/setenv.m4 | 7 +- gl/m4/setlocale_null.m4 | 7 +- gl/m4/sha256.m4 | 3 +- gl/m4/size_max.m4 | 3 +- gl/m4/snprintf.m4 | 3 +- gl/m4/socketlib.m4 | 3 +- gl/m4/sockets.m4 | 3 +- gl/m4/socklen.m4 | 3 +- gl/m4/sockpfaf.m4 | 15 +- gl/m4/ssize_t.m4 | 3 +- gl/m4/stat-time.m4 | 4 +- gl/m4/stat.m4 | 3 +- gl/m4/std-gnu11.m4 | 27 +- gl/m4/stdalign.m4 | 18 +- gl/m4/stdckdint_h.m4 | 136 ++ gl/m4/stddef_h.m4 | 63 +- gl/m4/stdint.m4 | 7 +- gl/m4/stdint_h.m4 | 3 +- gl/m4/stdio_h.m4 | 17 +- gl/m4/stdlib_h.m4 | 66 +- gl/m4/strcase.m4 | 46 - gl/m4/strcasecmp.m4 | 67 + gl/m4/strcasestr.m4 | 7 +- gl/m4/strerror.m4 | 3 +- gl/m4/string_h.m4 | 19 +- gl/m4/strings_h.m4 | 18 +- gl/m4/strncasecmp.m4 | 32 + gl/m4/strncpy.m4 | 94 + gl/m4/strsep.m4 | 3 +- gl/m4/strstr.m4 | 7 +- gl/m4/sys_cdefs_h.m4 | 26 + gl/m4/sys_socket_h.m4 | 48 +- gl/m4/sys_stat_h.m4 | 3 +- gl/m4/sys_types_h.m4 | 16 +- gl/m4/sys_uio_h.m4 | 3 +- gl/m4/threadlib.m4 | 376 ++-- gl/m4/time_h.m4 | 12 +- gl/m4/time_r.m4 | 3 +- gl/m4/timegm.m4 | 3 +- gl/m4/uchar_h.m4 | 279 +++ gl/m4/ungetc.m4 | 3 +- gl/m4/unicase_h.m4 | 45 + gl/m4/unictype_h.m4 | 179 ++ gl/m4/uninorm_h.m4 | 47 + gl/m4/unistd_h.m4 | 7 +- gl/m4/unitypes_h.m4 | 26 + gl/m4/unlocked-io.m4 | 3 +- gl/m4/vararrays.m4 | 3 +- gl/m4/vasnprintf.m4 | 74 +- gl/m4/vasprintf.m4 | 3 +- gl/m4/visibility.m4 | 3 +- gl/m4/vsnprintf.m4 | 3 +- gl/m4/warn-on-use.m4 | 3 +- gl/m4/wchar_h.m4 | 6 +- gl/m4/wchar_t.m4 | 25 - gl/m4/wcrtomb.m4 | 13 +- gl/m4/wctype.m4 | 3 +- gl/m4/wctype_h.m4 | 3 +- gl/m4/wcwidth.m4 | 116 ++ gl/m4/wint_t.m4 | 3 +- gl/m4/xalloc.m4 | 3 +- gl/m4/xsize.m4 | 3 +- gl/m4/zzgnulib.m4 | 3 +- gl/malloc.c | 13 +- gl/malloc/dynarray-skeleton.c | 2 +- gl/malloc/dynarray.h | 2 +- gl/malloc/dynarray_at_failure.c | 2 +- gl/malloc/dynarray_emplace_enlarge.c | 2 +- gl/malloc/dynarray_finalize.c | 2 +- gl/malloc/dynarray_resize.c | 2 +- gl/malloc/dynarray_resize_clear.c | 2 +- gl/malloca.c | 6 +- gl/malloca.h | 2 +- gl/math.c | 4 +- gl/math.in.h | 487 +++--- gl/mbchar.c | 23 + gl/mbchar.h | 383 +++++ gl/mbiterf.c | 21 + gl/mbiterf.h | 214 +++ gl/mbrtoc32.c | 288 ++++ gl/mbrtowc-impl-utf8.h | 2 +- gl/mbrtowc-impl.h | 2 +- gl/mbrtowc.c | 2 +- gl/mbsinit.c | 2 +- gl/mbsnlen.c | 60 + gl/mbszero.c | 2 +- gl/mbtowc-impl.h | 2 +- gl/mbtowc-lock.c | 2 +- gl/mbtowc-lock.h | 2 +- gl/mbtowc.c | 2 +- gl/memchr.c | 2 +- gl/memchr.valgrind | 2 +- gl/minmax.h | 2 +- gl/mktime-internal.h | 16 +- gl/mktime.c | 163 +- gl/mountlist.c | 244 ++- gl/mountlist.h | 7 +- gl/msvc-inval.c | 2 +- gl/msvc-inval.h | 2 +- gl/msvc-nothrow.c | 2 +- gl/msvc-nothrow.h | 2 +- gl/netdb.in.h | 33 +- gl/netinet_in.in.h | 2 +- gl/nl_langinfo-lock.c | 2 +- gl/nl_langinfo.c | 105 +- gl/open.c | 121 +- gl/pathmax.h | 2 +- gl/printf-args.c | 21 +- gl/printf-args.h | 13 +- gl/printf-parse.c | 8 +- gl/printf-parse.h | 2 +- gl/pthread-once.c | 148 ++ gl/pthread.h | 2571 ++++++++++++++++++++++++++++ gl/pthread.in.h | 2032 ++++++++++++++++++++++ gl/realloc.c | 73 +- gl/reallocarray.c | 4 +- gl/regcomp.c | 67 +- gl/regex.c | 2 +- gl/regex.h | 51 +- gl/regex_internal.c | 9 +- gl/regex_internal.h | 12 +- gl/regexec.c | 18 +- gl/sched.h | 631 +++++++ gl/sched.in.h | 111 ++ gl/setenv.c | 97 +- gl/setlocale-lock.c | 2 +- gl/setlocale_null-unlocked.c | 2 +- gl/setlocale_null.c | 2 +- gl/setlocale_null.h | 2 +- gl/sha256-stream.c | 12 +- gl/sha256.c | 2 +- gl/sha256.h | 2 +- gl/size_max.h | 2 +- gl/snprintf.c | 41 +- gl/sockets.c | 2 +- gl/sockets.h | 4 +- gl/stat-time.c | 2 +- gl/stat-time.h | 45 +- gl/stat-w32.c | 2 +- gl/stat-w32.h | 2 +- gl/stat.c | 6 +- gl/stdckdint.in.h | 41 +- gl/stddef.in.h | 103 +- gl/stdint.in.h | 13 +- gl/stdio-consolesafe.c | 199 +++ gl/stdio-impl.h | 116 +- gl/stdio-read.c | 2 +- gl/stdio-write.c | 8 +- gl/stdio.in.h | 587 +++++-- gl/stdlib.c | 21 + gl/stdlib.in.h | 497 ++++-- gl/str-two-way.h | 2 +- gl/strcasecmp.c | 6 +- gl/strcasestr.c | 2 +- gl/streq.h | 4 +- gl/strerror-override.c | 7 +- gl/strerror-override.h | 5 +- gl/strerror.c | 8 +- gl/string.in.h | 483 +++++- gl/strings.in.h | 150 +- gl/stripslash.c | 2 +- gl/strncasecmp.c | 6 +- gl/strncpy.c | 38 + gl/strsep.c | 2 +- gl/strstr.c | 2 +- gl/sys-limits.h | 2 +- gl/sys_socket.c | 4 +- gl/sys_socket.in.h | 127 +- gl/sys_stat.in.h | 104 +- gl/sys_types.in.h | 27 +- gl/sys_uio.in.h | 2 +- gl/time.in.h | 116 +- gl/time_r.c | 2 +- gl/timegm.c | 5 +- gl/uchar.h | 1456 ++++++++++++++++ gl/uchar.in.h | 912 ++++++++++ gl/unicase.h | 472 +++++ gl/unicase.in.h | 471 +++++ gl/unicase/.deps/.dirstamp | 0 gl/unicase/.deps/libgnu_a-tolower.Po | 49 + gl/unicase/.dirstamp | 0 gl/unicase/simple-mapping.h | 39 + gl/unicase/tolower.c | 27 + gl/unicase/tolower.h | 743 ++++++++ gl/unictype.h | 1148 +++++++++++++ gl/unictype.in.h | 1146 +++++++++++++ gl/unictype/.deps/.dirstamp | 0 gl/unictype/.deps/libgnu_a-ctype_alnum.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_alpha.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_blank.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_cntrl.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_digit.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_graph.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_lower.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_print.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_punct.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_space.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_upper.Po | 48 + gl/unictype/.deps/libgnu_a-ctype_xdigit.Po | 48 + gl/unictype/.dirstamp | 0 gl/unictype/bitmap.h | 48 + gl/unictype/ctype_alnum.c | 32 + gl/unictype/ctype_alnum.h | 897 ++++++++++ gl/unictype/ctype_alpha.c | 32 + gl/unictype/ctype_alpha.h | 897 ++++++++++ gl/unictype/ctype_blank.c | 32 + gl/unictype/ctype_blank.h | 184 ++ gl/unictype/ctype_cntrl.c | 32 + gl/unictype/ctype_cntrl.h | 176 ++ gl/unictype/ctype_digit.c | 32 + gl/unictype/ctype_digit.h | 172 ++ gl/unictype/ctype_graph.c | 32 + gl/unictype/ctype_graph.h | 1202 +++++++++++++ gl/unictype/ctype_lower.c | 32 + gl/unictype/ctype_lower.h | 371 ++++ gl/unictype/ctype_print.c | 32 + gl/unictype/ctype_print.h | 1202 +++++++++++++ gl/unictype/ctype_punct.c | 32 + gl/unictype/ctype_punct.h | 870 ++++++++++ gl/unictype/ctype_space.c | 32 + gl/unictype/ctype_space.h | 184 ++ gl/unictype/ctype_upper.c | 32 + gl/unictype/ctype_upper.h | 367 ++++ gl/unictype/ctype_xdigit.c | 32 + gl/unictype/ctype_xdigit.h | 172 ++ gl/uninorm.h | 256 +++ gl/uninorm.in.h | 255 +++ gl/unistd.c | 4 +- gl/unistd.in.h | 443 +++-- gl/unitypes.h | 72 + gl/unitypes.in.h | 71 + gl/uniwidth.h | 73 + gl/uniwidth.in.h | 72 + gl/uniwidth/.deps/.dirstamp | 0 gl/uniwidth/.deps/libgnu_a-width.Po | 60 + gl/uniwidth/.dirstamp | 0 gl/uniwidth/cjk.h | 37 + gl/uniwidth/width.c | 95 + gl/uniwidth/width0.h | 495 ++++++ gl/uniwidth/width2.h | 541 ++++++ gl/unlocked-io.h | 2 +- gl/unsetenv.c | 34 +- gl/vasnprintf.c | 1453 +++++++++++++--- gl/vasnprintf.h | 2 +- gl/vasprintf.c | 14 +- gl/verify.h | 38 +- gl/vsnprintf.c | 41 +- gl/vsnzprintf.c | 65 + gl/w32sock.h | 2 +- gl/warn-on-use.h | 10 +- gl/wchar.in.h | 313 ++-- gl/wcrtomb.c | 2 +- gl/wctype-h.c | 4 +- gl/wctype-impl.h | 2 +- gl/wctype.c | 2 +- gl/wctype.in.h | 28 +- gl/wcwidth.c | 73 + gl/windows-initguard.h | 2 +- gl/windows-mutex.c | 26 +- gl/windows-mutex.h | 3 +- gl/windows-once.c | 51 +- gl/windows-once.h | 7 +- gl/windows-recmutex.c | 2 +- gl/windows-recmutex.h | 2 +- gl/windows-rwlock.c | 2 +- gl/windows-rwlock.h | 2 +- gl/xalloc-die.c | 4 +- gl/xalloc-oversized.h | 5 +- gl/xalloc.h | 2 +- gl/xmalloc.c | 6 +- gl/xsize.c | 2 +- gl/xsize.h | 20 +- 536 files changed, 37915 insertions(+), 3800 deletions(-) create mode 100644 gl/arpa_inet.c create mode 100644 gl/byteswap.c create mode 100644 gl/c-ctype.c create mode 100644 gl/c-ctype.h create mode 100644 gl/c32is-impl.h create mode 100644 gl/c32isalnum.c create mode 100644 gl/c32isalpha.c create mode 100644 gl/c32isblank.c create mode 100644 gl/c32iscntrl.c create mode 100644 gl/c32isdigit.c create mode 100644 gl/c32isgraph.c create mode 100644 gl/c32islower.c create mode 100644 gl/c32isprint.c create mode 100644 gl/c32ispunct.c create mode 100644 gl/c32isspace.c create mode 100644 gl/c32isupper.c create mode 100644 gl/c32isxdigit.c create mode 100644 gl/c32to-impl.h create mode 100644 gl/c32tolower.c create mode 100644 gl/c32width.c create mode 100644 gl/fseterr.c create mode 100644 gl/fseterr.h create mode 100644 gl/glthread/once.c create mode 100644 gl/glthread/once.h create mode 100644 gl/inet_pton.c create mode 100644 gl/lstat.c create mode 100644 gl/m4/build-to-host.m4 create mode 100644 gl/m4/c32rtomb.m4 delete mode 100644 gl/m4/eealloc.m4 create mode 100644 gl/m4/extensions-aix.m4 create mode 100644 gl/m4/fseterr.m4 create mode 100644 gl/m4/gnulib-i18n.m4 create mode 100644 gl/m4/inet_pton.m4 create mode 100644 gl/m4/libunistring-base.m4 create mode 100644 gl/m4/locale-en.m4 create mode 100644 gl/m4/lstat.m4 create mode 100644 gl/m4/mbchar.m4 create mode 100644 gl/m4/mbiter.m4 create mode 100644 gl/m4/mbrtoc32.m4 create mode 100644 gl/m4/off64_t.m4 create mode 100644 gl/m4/once.m4 create mode 100644 gl/m4/pthread-once.m4 create mode 100644 gl/m4/pthread-spin.m4 create mode 100644 gl/m4/pthread_h.m4 create mode 100644 gl/m4/sched_h.m4 create mode 100644 gl/m4/stdckdint_h.m4 delete mode 100644 gl/m4/strcase.m4 create mode 100644 gl/m4/strcasecmp.m4 create mode 100644 gl/m4/strncasecmp.m4 create mode 100644 gl/m4/strncpy.m4 create mode 100644 gl/m4/sys_cdefs_h.m4 create mode 100644 gl/m4/uchar_h.m4 create mode 100644 gl/m4/unicase_h.m4 create mode 100644 gl/m4/unictype_h.m4 create mode 100644 gl/m4/uninorm_h.m4 create mode 100644 gl/m4/unitypes_h.m4 delete mode 100644 gl/m4/wchar_t.m4 create mode 100644 gl/m4/wcwidth.m4 create mode 100644 gl/mbchar.c create mode 100644 gl/mbchar.h create mode 100644 gl/mbiterf.c create mode 100644 gl/mbiterf.h create mode 100644 gl/mbrtoc32.c create mode 100644 gl/mbsnlen.c create mode 100644 gl/pthread-once.c create mode 100644 gl/pthread.h create mode 100644 gl/pthread.in.h create mode 100644 gl/sched.h create mode 100644 gl/sched.in.h create mode 100644 gl/stdio-consolesafe.c create mode 100644 gl/stdlib.c create mode 100644 gl/strncpy.c create mode 100644 gl/uchar.h create mode 100644 gl/uchar.in.h create mode 100644 gl/unicase.h create mode 100644 gl/unicase.in.h create mode 100644 gl/unicase/.deps/.dirstamp create mode 100644 gl/unicase/.deps/libgnu_a-tolower.Po create mode 100644 gl/unicase/.dirstamp create mode 100644 gl/unicase/simple-mapping.h create mode 100644 gl/unicase/tolower.c create mode 100644 gl/unicase/tolower.h create mode 100644 gl/unictype.h create mode 100644 gl/unictype.in.h create mode 100644 gl/unictype/.deps/.dirstamp create mode 100644 gl/unictype/.deps/libgnu_a-ctype_alnum.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_alpha.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_blank.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_cntrl.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_digit.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_graph.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_lower.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_print.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_punct.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_space.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_upper.Po create mode 100644 gl/unictype/.deps/libgnu_a-ctype_xdigit.Po create mode 100644 gl/unictype/.dirstamp create mode 100644 gl/unictype/bitmap.h create mode 100644 gl/unictype/ctype_alnum.c create mode 100644 gl/unictype/ctype_alnum.h create mode 100644 gl/unictype/ctype_alpha.c create mode 100644 gl/unictype/ctype_alpha.h create mode 100644 gl/unictype/ctype_blank.c create mode 100644 gl/unictype/ctype_blank.h create mode 100644 gl/unictype/ctype_cntrl.c create mode 100644 gl/unictype/ctype_cntrl.h create mode 100644 gl/unictype/ctype_digit.c create mode 100644 gl/unictype/ctype_digit.h create mode 100644 gl/unictype/ctype_graph.c create mode 100644 gl/unictype/ctype_graph.h create mode 100644 gl/unictype/ctype_lower.c create mode 100644 gl/unictype/ctype_lower.h create mode 100644 gl/unictype/ctype_print.c create mode 100644 gl/unictype/ctype_print.h create mode 100644 gl/unictype/ctype_punct.c create mode 100644 gl/unictype/ctype_punct.h create mode 100644 gl/unictype/ctype_space.c create mode 100644 gl/unictype/ctype_space.h create mode 100644 gl/unictype/ctype_upper.c create mode 100644 gl/unictype/ctype_upper.h create mode 100644 gl/unictype/ctype_xdigit.c create mode 100644 gl/unictype/ctype_xdigit.h create mode 100644 gl/uninorm.h create mode 100644 gl/uninorm.in.h create mode 100644 gl/unitypes.h create mode 100644 gl/unitypes.in.h create mode 100644 gl/uniwidth.h create mode 100644 gl/uniwidth.in.h create mode 100644 gl/uniwidth/.deps/.dirstamp create mode 100644 gl/uniwidth/.deps/libgnu_a-width.Po create mode 100644 gl/uniwidth/.dirstamp create mode 100644 gl/uniwidth/cjk.h create mode 100644 gl/uniwidth/width.c create mode 100644 gl/uniwidth/width0.h create mode 100644 gl/uniwidth/width2.h create mode 100644 gl/vsnzprintf.c create mode 100644 gl/wcwidth.c 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 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2024 Free Software Foundation, Inc. +# Copyright (C) 2002-2025 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -80,9 +80,9 @@ AM_CFLAGS = noinst_LIBRARIES += libgnu.a libgnu_a_SOURCES = -libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS) -libgnu_a_LIBADD = $(gl_LIBOBJS) -libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) +libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS) $(GL_CFLAG_ALLOW_WARNINGS) +libgnu_a_LIBADD = $(gl_libgnu_LIBOBJS) +libgnu_a_DEPENDENCIES = $(gl_libgnu_LIBOBJS) EXTRA_libgnu_a_SOURCES = ## begin gnulib module absolute-header @@ -116,9 +116,10 @@ EXTRA_DIST += alloca.in.h ## end gnulib module alloca-opt -## begin gnulib module arpa_inet +## begin gnulib module arpa_inet-h BUILT_SOURCES += arpa/inet.h +libgnu_a_SOURCES += arpa_inet.c # We need the following in order to create when the system # doesn't have one. @@ -135,8 +136,12 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON -e 's/@''GNULIB_INET_NTOP''@/$(GL_GNULIB_INET_NTOP)/g' \ -e 's/@''GNULIB_INET_PTON''@/$(GL_GNULIB_INET_PTON)/g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ + -e 's|@''HAVE_DECL_HTONL''@|$(HAVE_DECL_HTONL)|g' \ + -e 's|@''HAVE_DECL_HTONS''@|$(HAVE_DECL_HTONS)|g' \ -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ + -e 's|@''HAVE_DECL_NTOHL''@|$(HAVE_DECL_NTOHL)|g' \ + -e 's|@''HAVE_DECL_NTOHS''@|$(HAVE_DECL_NTOHS)|g' \ -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \ -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @@ -149,7 +154,7 @@ MOSTLYCLEANDIRS += arpa EXTRA_DIST += arpa_inet.in.h -## end gnulib module arpa_inet +## end gnulib module arpa_inet-h ## begin gnulib module assert-h @@ -221,6 +226,7 @@ if GL_GENERATE_BYTESWAP_H byteswap.h: byteswap.in.h $(top_builddir)/config.status $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/byteswap.in.h $(AM_V_at)mv $@-t $@ +libgnu_a_SOURCES += byteswap.c else byteswap.h: $(top_builddir)/config.status rm -f $@ @@ -231,6 +237,122 @@ EXTRA_DIST += byteswap.in.h ## end gnulib module byteswap +## begin gnulib module c-ctype + +libgnu_a_SOURCES += c-ctype.h c-ctype.c + +## end gnulib module c-ctype + +## begin gnulib module c32isalnum + +libgnu_a_SOURCES += c32isalnum.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isalnum + +## begin gnulib module c32isalpha + +libgnu_a_SOURCES += c32isalpha.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isalpha + +## begin gnulib module c32isblank + +libgnu_a_SOURCES += c32isblank.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isblank + +## begin gnulib module c32iscntrl + +libgnu_a_SOURCES += c32iscntrl.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32iscntrl + +## begin gnulib module c32isdigit + +libgnu_a_SOURCES += c32isdigit.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isdigit + +## begin gnulib module c32isgraph + +libgnu_a_SOURCES += c32isgraph.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isgraph + +## begin gnulib module c32islower + +libgnu_a_SOURCES += c32islower.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32islower + +## begin gnulib module c32isprint + +libgnu_a_SOURCES += c32isprint.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isprint + +## begin gnulib module c32ispunct + +libgnu_a_SOURCES += c32ispunct.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32ispunct + +## begin gnulib module c32isspace + +libgnu_a_SOURCES += c32isspace.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isspace + +## begin gnulib module c32isupper + +libgnu_a_SOURCES += c32isupper.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isupper + +## begin gnulib module c32isxdigit + +libgnu_a_SOURCES += c32isxdigit.c + +EXTRA_DIST += c32is-impl.h + +## end gnulib module c32isxdigit + +## begin gnulib module c32tolower + +libgnu_a_SOURCES += c32tolower.c + +EXTRA_DIST += c32to-impl.h + +## end gnulib module c32tolower + +## begin gnulib module c32width + +libgnu_a_SOURCES += c32width.c + +## end gnulib module c32width + ## begin gnulib module calloc-gnu @@ -313,7 +435,7 @@ endif ## end gnulib module dup2 -## begin gnulib module errno +## begin gnulib module errno-h BUILT_SOURCES += $(ERRNO_H) @@ -343,7 +465,7 @@ MOSTLYCLEANFILES += errno.h errno.h-t EXTRA_DIST += errno.in.h -## end gnulib module errno +## end gnulib module errno-h ## begin gnulib module error @@ -455,7 +577,7 @@ EXTRA_DIST += filename.h ## end gnulib module filename -## begin gnulib module float +## begin gnulib module float-h BUILT_SOURCES += $(FLOAT_H) @@ -487,7 +609,7 @@ endif EXTRA_DIST += float.in.h -## end gnulib module float +## end gnulib module float-h ## begin gnulib module floorf @@ -563,6 +685,16 @@ EXTRA_DIST += stdio-impl.h ## end gnulib module fseeko +## begin gnulib module fseterr + +if GL_COND_OBJ_FSETERR +libgnu_a_SOURCES += fseterr.c +endif + +EXTRA_DIST += fseterr.h stdio-impl.h + +## end gnulib module fseterr + ## begin gnulib module fstat if GL_COND_OBJ_FSTAT @@ -807,6 +939,14 @@ endif ## end gnulib module inet_ntop +## begin gnulib module inet_pton + +if GL_COND_OBJ_INET_PTON +libgnu_a_SOURCES += inet_pton.c +endif + +## end gnulib module inet_pton + ## begin gnulib module intprops @@ -814,7 +954,7 @@ EXTRA_DIST += intprops-internal.h intprops.h ## end gnulib module intprops -## begin gnulib module inttypes-incomplete +## begin gnulib module inttypes-h-incomplete BUILT_SOURCES += inttypes.h @@ -855,7 +995,7 @@ MOSTLYCLEANFILES += inttypes.h inttypes.h-t EXTRA_DIST += inttypes.in.h -## end gnulib module inttypes-incomplete +## end gnulib module inttypes-h-incomplete ## begin gnulib module iswblank @@ -899,7 +1039,7 @@ endif ## end gnulib module iswxdigit -## begin gnulib module langinfo +## begin gnulib module langinfo-h BUILT_SOURCES += langinfo.h @@ -917,6 +1057,7 @@ langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \ -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \ -e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \ + -e 's|@''HAVE_LANGINFO_ABALTMON''@|$(HAVE_LANGINFO_ABALTMON)|g' \ -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \ -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \ -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \ @@ -929,7 +1070,7 @@ MOSTLYCLEANFILES += langinfo.h langinfo.h-t EXTRA_DIST += langinfo.in.h -## end gnulib module langinfo +## end gnulib module langinfo-h ## begin gnulib module libc-config @@ -972,7 +1113,7 @@ EXTRA_DIST += localcharset.h ## end gnulib module localcharset -## begin gnulib module locale +## begin gnulib module locale-h BUILT_SOURCES += locale.h @@ -985,20 +1126,28 @@ locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ + -e 's|@''HAVE_LOCALE_T''@|$(HAVE_LOCALE_T)|g' \ + -e 's|@''HAVE_WINDOWS_LOCALE_T''@|$(HAVE_WINDOWS_LOCALE_T)|g' \ -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \ -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \ -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \ + -e 's/@''GNULIB_NEWLOCALE''@/$(GL_GNULIB_NEWLOCALE)/g' \ -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \ + -e 's/@''GNULIB_FREELOCALE''@/$(GL_GNULIB_FREELOCALE)/g' \ + -e 's/@''GNULIB_GETLOCALENAME_L''@/$(GL_GNULIB_GETLOCALENAME_L)/g' \ + -e 's/@''GNULIB_GETLOCALENAME_L_UNSAFE''@/$(GL_GNULIB_GETLOCALENAME_L_UNSAFE)/g' \ -e 's/@''GNULIB_LOCALENAME_UNSAFE''@/$(GL_GNULIB_LOCALENAME_UNSAFE)/g' \ -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \ -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \ + -e 's|@''HAVE_GETLOCALENAME_L''@|$(HAVE_GETLOCALENAME_L)|g' \ -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \ -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \ -e 's|@''REPLACE_NEWLOCALE''@|$(REPLACE_NEWLOCALE)|g' \ -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ -e 's|@''REPLACE_FREELOCALE''@|$(REPLACE_FREELOCALE)|g' \ + -e 's|@''REPLACE_GETLOCALENAME_L''@|$(REPLACE_GETLOCALENAME_L)|g' \ -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \ -e 's|@''LOCALENAME_ENHANCE_LOCALE_FUNCS''@|$(LOCALENAME_ENHANCE_LOCALE_FUNCS)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @@ -1010,7 +1159,7 @@ MOSTLYCLEANFILES += locale.h locale.h-t EXTRA_DIST += locale.in.h -## end gnulib module locale +## end gnulib module locale-h ## begin gnulib module localeconv @@ -1034,6 +1183,14 @@ endif ## end gnulib module lseek +## begin gnulib module lstat + +if GL_COND_OBJ_LSTAT +libgnu_a_SOURCES += lstat.c +endif + +## end gnulib module lstat + ## begin gnulib module malloc-gnu @@ -1060,7 +1217,7 @@ EXTRA_DIST += malloca.h ## end gnulib module malloca -## begin gnulib module math +## begin gnulib module math-h BUILT_SOURCES += math.h libgnu_a_SOURCES += math.c @@ -1150,6 +1307,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's/@''GNULIB_LOGB''@/$(GL_GNULIB_LOGB)/g' \ -e 's/@''GNULIB_LOGBF''@/$(GL_GNULIB_LOGBF)/g' \ -e 's/@''GNULIB_LOGBL''@/$(GL_GNULIB_LOGBL)/g' \ + -e 's/@''GNULIB_LOGP1''@/$(GL_GNULIB_LOGP1)/g' \ + -e 's/@''GNULIB_LOGP1F''@/$(GL_GNULIB_LOGP1F)/g' \ + -e 's/@''GNULIB_LOGP1L''@/$(GL_GNULIB_LOGP1L)/g' \ -e 's/@''GNULIB_MODF''@/$(GL_GNULIB_MODF)/g' \ -e 's/@''GNULIB_MODFF''@/$(GL_GNULIB_MODFF)/g' \ -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) $( -e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \ -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \ -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \ + -e 's|@''HAVE_LOGP1''@|$(HAVE_LOGP1)|g' \ + -e 's|@''HAVE_LOGP1F''@|$(HAVE_LOGP1F)|g' \ + -e 's|@''HAVE_LOGP1L''@|$(HAVE_LOGP1L)|g' \ -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \ -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \ -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) $( -e 's|@''REPLACE_SIGNBIT_USING_BUILTINS''@|$(REPLACE_SIGNBIT_USING_BUILTINS)|g' \ -e 's|@''REPLACE_SINF''@|$(REPLACE_SINF)|g' \ -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \ + -e 's|@''REPLACE_SINL''@|$(REPLACE_SINL)|g' \ -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \ -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ -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 EXTRA_DIST += math.in.h -## end gnulib module math +## end gnulib module math-h + +## begin gnulib module mbchar + +libgnu_a_SOURCES += mbchar.c + +EXTRA_DIST += mbchar.h + +## end gnulib module mbchar + +## begin gnulib module mbiterf + +libgnu_a_SOURCES += mbiterf.h mbiterf.c + +## end gnulib module mbiterf + +## begin gnulib module mbrtoc32 + +if GL_COND_OBJ_MBRTOC32 +libgnu_a_SOURCES += mbrtoc32.c +endif + +EXTRA_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 + +EXTRA_libgnu_a_SOURCES += lc-charset-dispatch.c mbtowc-lock.c + +## end gnulib module mbrtoc32 ## begin gnulib module mbrtowc @@ -1434,6 +1624,12 @@ endif ## end gnulib module mbsinit +## begin gnulib module mbsnlen + +libgnu_a_SOURCES += mbsnlen.c + +## end gnulib module mbsnlen + ## begin gnulib module mbszero libgnu_a_SOURCES += mbszero.c @@ -1486,9 +1682,7 @@ EXTRA_libgnu_a_SOURCES += mktime.c ## begin gnulib module mountlist -if GL_COND_OBJ_MOUNTLIST libgnu_a_SOURCES += mountlist.c -endif EXTRA_DIST += mountlist.h @@ -1514,7 +1708,7 @@ EXTRA_DIST += msvc-nothrow.h ## end gnulib module msvc-nothrow -## begin gnulib module netdb +## begin gnulib module netdb-h BUILT_SOURCES += netdb.h @@ -1545,9 +1739,9 @@ MOSTLYCLEANFILES += netdb.h netdb.h-t EXTRA_DIST += netdb.in.h -## end gnulib module netdb +## end gnulib module netdb-h -## begin gnulib module netinet_in +## begin gnulib module netinet_in-h BUILT_SOURCES += $(NETINET_IN_H) @@ -1574,7 +1768,7 @@ MOSTLYCLEANDIRS += netinet EXTRA_DIST += netinet_in.in.h -## end gnulib module netinet_in +## end gnulib module netinet_in-h ## begin gnulib module nl_langinfo @@ -1589,6 +1783,12 @@ EXTRA_DIST += windows-initguard.h ## end gnulib module nl_langinfo +## begin gnulib module once + +libgnu_a_SOURCES += glthread/once.h glthread/once.c + +## end gnulib module once + ## begin gnulib module open if GL_COND_OBJ_OPEN @@ -1604,21 +1804,168 @@ EXTRA_DIST += pathmax.h ## end gnulib module pathmax -## begin gnulib module realloc-gnu +## begin gnulib module pthread-h +BUILT_SOURCES += pthread.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +pthread.h: pthread.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_PTHREAD_H''@|$(NEXT_PTHREAD_H)|g' \ + -e 's/@''GNULIB_PTHREAD_THREAD''@/$(GL_GNULIB_PTHREAD_THREAD)/g' \ + -e 's/@''GNULIB_PTHREAD_ONCE''@/$(GL_GNULIB_PTHREAD_ONCE)/g' \ + -e 's/@''GNULIB_PTHREAD_MUTEX''@/$(GL_GNULIB_PTHREAD_MUTEX)/g' \ + -e 's/@''GNULIB_PTHREAD_RWLOCK''@/$(GL_GNULIB_PTHREAD_RWLOCK)/g' \ + -e 's/@''GNULIB_PTHREAD_COND''@/$(GL_GNULIB_PTHREAD_COND)/g' \ + -e 's/@''GNULIB_PTHREAD_TSS''@/$(GL_GNULIB_PTHREAD_TSS)/g' \ + -e 's/@''GNULIB_PTHREAD_SPIN''@/$(GL_GNULIB_PTHREAD_SPIN)/g' \ + -e 's/@''GNULIB_PTHREAD_MUTEX_TIMEDLOCK''@/$(GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK)/g' \ + -e 's|@''HAVE_PTHREAD_T''@|$(HAVE_PTHREAD_T)|g' \ + -e 's|@''HAVE_PTHREAD_SPINLOCK_T''@|$(HAVE_PTHREAD_SPINLOCK_T)|g' \ + -e 's|@''HAVE_PTHREAD_CREATE_DETACHED''@|$(HAVE_PTHREAD_CREATE_DETACHED)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEX_RECURSIVE''@|$(HAVE_PTHREAD_MUTEX_RECURSIVE)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEX_ROBUST''@|$(HAVE_PTHREAD_MUTEX_ROBUST)|g' \ + -e 's|@''HAVE_PTHREAD_PROCESS_SHARED''@|$(HAVE_PTHREAD_PROCESS_SHARED)|g' \ + -e 's|@''HAVE_PTHREAD_CREATE''@|$(HAVE_PTHREAD_CREATE)|g' \ + -e 's|@''HAVE_PTHREAD_ATTR_INIT''@|$(HAVE_PTHREAD_ATTR_INIT)|g' \ + -e 's|@''HAVE_PTHREAD_ATTR_GETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_GETDETACHSTATE)|g' \ + -e 's|@''HAVE_PTHREAD_ATTR_SETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_SETDETACHSTATE)|g' \ + -e 's|@''HAVE_PTHREAD_ATTR_DESTROY''@|$(HAVE_PTHREAD_ATTR_DESTROY)|g' \ + -e 's|@''HAVE_PTHREAD_SELF''@|$(HAVE_PTHREAD_SELF)|g' \ + -e 's|@''HAVE_PTHREAD_EQUAL''@|$(HAVE_PTHREAD_EQUAL)|g' \ + -e 's|@''HAVE_PTHREAD_DETACH''@|$(HAVE_PTHREAD_DETACH)|g' \ + -e 's|@''HAVE_PTHREAD_JOIN''@|$(HAVE_PTHREAD_JOIN)|g' \ + -e 's|@''HAVE_PTHREAD_EXIT''@|$(HAVE_PTHREAD_EXIT)|g' \ + < $(srcdir)/pthread.in.h > $@-t1 + $(AM_V_at)sed \ + -e 's|@''HAVE_PTHREAD_ONCE''@|$(HAVE_PTHREAD_ONCE)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEX_INIT''@|$(HAVE_PTHREAD_MUTEX_INIT)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEXATTR_INIT''@|$(HAVE_PTHREAD_MUTEXATTR_INIT)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_GETTYPE)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_SETTYPE)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_GETROBUST)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_SETROBUST)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEXATTR_DESTROY''@|$(HAVE_PTHREAD_MUTEXATTR_DESTROY)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEX_LOCK''@|$(HAVE_PTHREAD_MUTEX_LOCK)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEX_TRYLOCK''@|$(HAVE_PTHREAD_MUTEX_TRYLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEX_TIMEDLOCK''@|$(HAVE_PTHREAD_MUTEX_TIMEDLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEX_UNLOCK''@|$(HAVE_PTHREAD_MUTEX_UNLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_MUTEX_DESTROY''@|$(HAVE_PTHREAD_MUTEX_DESTROY)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_INIT''@|$(HAVE_PTHREAD_RWLOCK_INIT)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCKATTR_INIT''@|$(HAVE_PTHREAD_RWLOCKATTR_INIT)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCKATTR_DESTROY''@|$(HAVE_PTHREAD_RWLOCKATTR_DESTROY)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_RDLOCK''@|$(HAVE_PTHREAD_RWLOCK_RDLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_WRLOCK''@|$(HAVE_PTHREAD_RWLOCK_WRLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_UNLOCK''@|$(HAVE_PTHREAD_RWLOCK_UNLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_RWLOCK_DESTROY''@|$(HAVE_PTHREAD_RWLOCK_DESTROY)|g' \ + -e 's|@''HAVE_PTHREAD_COND_INIT''@|$(HAVE_PTHREAD_COND_INIT)|g' \ + -e 's|@''HAVE_PTHREAD_CONDATTR_INIT''@|$(HAVE_PTHREAD_CONDATTR_INIT)|g' \ + -e 's|@''HAVE_PTHREAD_CONDATTR_DESTROY''@|$(HAVE_PTHREAD_CONDATTR_DESTROY)|g' \ + -e 's|@''HAVE_PTHREAD_COND_WAIT''@|$(HAVE_PTHREAD_COND_WAIT)|g' \ + -e 's|@''HAVE_PTHREAD_COND_TIMEDWAIT''@|$(HAVE_PTHREAD_COND_TIMEDWAIT)|g' \ + -e 's|@''HAVE_PTHREAD_COND_SIGNAL''@|$(HAVE_PTHREAD_COND_SIGNAL)|g' \ + -e 's|@''HAVE_PTHREAD_COND_BROADCAST''@|$(HAVE_PTHREAD_COND_BROADCAST)|g' \ + -e 's|@''HAVE_PTHREAD_COND_DESTROY''@|$(HAVE_PTHREAD_COND_DESTROY)|g' \ + -e 's|@''HAVE_PTHREAD_KEY_CREATE''@|$(HAVE_PTHREAD_KEY_CREATE)|g' \ + -e 's|@''HAVE_PTHREAD_SETSPECIFIC''@|$(HAVE_PTHREAD_SETSPECIFIC)|g' \ + -e 's|@''HAVE_PTHREAD_GETSPECIFIC''@|$(HAVE_PTHREAD_GETSPECIFIC)|g' \ + -e 's|@''HAVE_PTHREAD_KEY_DELETE''@|$(HAVE_PTHREAD_KEY_DELETE)|g' \ + -e 's|@''HAVE_PTHREAD_SPIN_INIT''@|$(HAVE_PTHREAD_SPIN_INIT)|g' \ + -e 's|@''HAVE_PTHREAD_SPIN_LOCK''@|$(HAVE_PTHREAD_SPIN_LOCK)|g' \ + -e 's|@''HAVE_PTHREAD_SPIN_TRYLOCK''@|$(HAVE_PTHREAD_SPIN_TRYLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_SPIN_UNLOCK''@|$(HAVE_PTHREAD_SPIN_UNLOCK)|g' \ + -e 's|@''HAVE_PTHREAD_SPIN_DESTROY''@|$(HAVE_PTHREAD_SPIN_DESTROY)|g' \ + < $@-t1 > $@-t2 + $(AM_V_at)sed \ + -e 's|@''REPLACE_PTHREAD_CREATE''@|$(REPLACE_PTHREAD_CREATE)|g' \ + -e 's|@''REPLACE_PTHREAD_ATTR_INIT''@|$(REPLACE_PTHREAD_ATTR_INIT)|g' \ + -e 's|@''REPLACE_PTHREAD_ATTR_GETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_GETDETACHSTATE)|g' \ + -e 's|@''REPLACE_PTHREAD_ATTR_SETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_SETDETACHSTATE)|g' \ + -e 's|@''REPLACE_PTHREAD_ATTR_DESTROY''@|$(REPLACE_PTHREAD_ATTR_DESTROY)|g' \ + -e 's|@''REPLACE_PTHREAD_SELF''@|$(REPLACE_PTHREAD_SELF)|g' \ + -e 's|@''REPLACE_PTHREAD_EQUAL''@|$(REPLACE_PTHREAD_EQUAL)|g' \ + -e 's|@''REPLACE_PTHREAD_DETACH''@|$(REPLACE_PTHREAD_DETACH)|g' \ + -e 's|@''REPLACE_PTHREAD_JOIN''@|$(REPLACE_PTHREAD_JOIN)|g' \ + -e 's|@''REPLACE_PTHREAD_EXIT''@|$(REPLACE_PTHREAD_EXIT)|g' \ + -e 's|@''REPLACE_PTHREAD_ONCE''@|$(REPLACE_PTHREAD_ONCE)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEX_INIT''@|$(REPLACE_PTHREAD_MUTEX_INIT)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEXATTR_INIT''@|$(REPLACE_PTHREAD_MUTEXATTR_INIT)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_GETTYPE)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_SETTYPE)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_GETROBUST)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_SETROBUST)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEXATTR_DESTROY''@|$(REPLACE_PTHREAD_MUTEXATTR_DESTROY)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEX_LOCK''@|$(REPLACE_PTHREAD_MUTEX_LOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEX_TRYLOCK''@|$(REPLACE_PTHREAD_MUTEX_TRYLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEX_TIMEDLOCK''@|$(REPLACE_PTHREAD_MUTEX_TIMEDLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEX_UNLOCK''@|$(REPLACE_PTHREAD_MUTEX_UNLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_MUTEX_DESTROY''@|$(REPLACE_PTHREAD_MUTEX_DESTROY)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_INIT''@|$(REPLACE_PTHREAD_RWLOCK_INIT)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_INIT''@|$(REPLACE_PTHREAD_RWLOCKATTR_INIT)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_DESTROY''@|$(REPLACE_PTHREAD_RWLOCKATTR_DESTROY)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_RDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_RDLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_WRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_WRLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_UNLOCK''@|$(REPLACE_PTHREAD_RWLOCK_UNLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_RWLOCK_DESTROY''@|$(REPLACE_PTHREAD_RWLOCK_DESTROY)|g' \ + < $@-t2 > $@-t3 + $(AM_V_at)sed \ + -e 's|@''REPLACE_PTHREAD_COND_INIT''@|$(REPLACE_PTHREAD_COND_INIT)|g' \ + -e 's|@''REPLACE_PTHREAD_CONDATTR_INIT''@|$(REPLACE_PTHREAD_CONDATTR_INIT)|g' \ + -e 's|@''REPLACE_PTHREAD_CONDATTR_DESTROY''@|$(REPLACE_PTHREAD_CONDATTR_DESTROY)|g' \ + -e 's|@''REPLACE_PTHREAD_COND_WAIT''@|$(REPLACE_PTHREAD_COND_WAIT)|g' \ + -e 's|@''REPLACE_PTHREAD_COND_TIMEDWAIT''@|$(REPLACE_PTHREAD_COND_TIMEDWAIT)|g' \ + -e 's|@''REPLACE_PTHREAD_COND_SIGNAL''@|$(REPLACE_PTHREAD_COND_SIGNAL)|g' \ + -e 's|@''REPLACE_PTHREAD_COND_BROADCAST''@|$(REPLACE_PTHREAD_COND_BROADCAST)|g' \ + -e 's|@''REPLACE_PTHREAD_COND_DESTROY''@|$(REPLACE_PTHREAD_COND_DESTROY)|g' \ + -e 's|@''REPLACE_PTHREAD_KEY_CREATE''@|$(REPLACE_PTHREAD_KEY_CREATE)|g' \ + -e 's|@''REPLACE_PTHREAD_SETSPECIFIC''@|$(REPLACE_PTHREAD_SETSPECIFIC)|g' \ + -e 's|@''REPLACE_PTHREAD_GETSPECIFIC''@|$(REPLACE_PTHREAD_GETSPECIFIC)|g' \ + -e 's|@''REPLACE_PTHREAD_KEY_DELETE''@|$(REPLACE_PTHREAD_KEY_DELETE)|g' \ + -e 's|@''REPLACE_PTHREAD_SPIN_INIT''@|$(REPLACE_PTHREAD_SPIN_INIT)|g' \ + -e 's|@''REPLACE_PTHREAD_SPIN_LOCK''@|$(REPLACE_PTHREAD_SPIN_LOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_SPIN_TRYLOCK''@|$(REPLACE_PTHREAD_SPIN_TRYLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_SPIN_UNLOCK''@|$(REPLACE_PTHREAD_SPIN_UNLOCK)|g' \ + -e 's|@''REPLACE_PTHREAD_SPIN_DESTROY''@|$(REPLACE_PTHREAD_SPIN_DESTROY)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _Noreturn/r $(_NORETURN_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $@-t3 > $@-t4 + $(AM_V_at)rm -f $@-t1 $@-t2 $@-t3 + $(AM_V_at)mv $@-t4 $@ +MOSTLYCLEANFILES += pthread.h pthread.h-t1 pthread.h-t2 pthread.h-t3 pthread.h-t4 -EXTRA_DIST += realloc.c +EXTRA_DIST += pthread.in.h -EXTRA_libgnu_a_SOURCES += realloc.c +## end gnulib module pthread-h -## end gnulib module realloc-gnu +## begin gnulib module pthread-once -## begin gnulib module realloc-posix +if GL_COND_OBJ_PTHREAD_ONCE +libgnu_a_SOURCES += pthread-once.c +endif +## end gnulib module pthread-once -EXTRA_DIST += realloc.c +## begin gnulib module realloc-posix -EXTRA_libgnu_a_SOURCES += realloc.c +if GL_COND_OBJ_REALLOC_POSIX +libgnu_a_SOURCES += realloc.c +endif ## end gnulib module realloc-posix @@ -1642,6 +1989,35 @@ EXTRA_libgnu_a_SOURCES += regcomp.c regex_internal.c regexec.c ## end gnulib module regex +## begin gnulib module sched-h + +BUILT_SOURCES += sched.h + +# We need the following in order to create a replacement for when +# the system doesn't have one. +sched.h: sched.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) + $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \ + -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SCHED_H''@|$(NEXT_SCHED_H)|g' \ + -e 's|@''HAVE_STRUCT_SCHED_PARAM''@|$(HAVE_STRUCT_SCHED_PARAM)|g' \ + -e 's/@''GNULIB_SCHED_YIELD''@/$(GL_GNULIB_SCHED_YIELD)/g' \ + -e 's|@''HAVE_SCHED_YIELD''@|$(HAVE_SCHED_YIELD)|g' \ + -e 's|@''REPLACE_SCHED_YIELD''@|$(REPLACE_SCHED_YIELD)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + $(srcdir)/sched.in.h > $@-t + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += sched.h sched.h-t + +EXTRA_DIST += sched.in.h + +## end gnulib module sched-h + ## begin gnulib module setenv if GL_COND_OBJ_SETENV @@ -1760,7 +2136,7 @@ EXTRA_DIST += stat-time.h ## end gnulib module stat-time -## begin gnulib module stdckdint +## begin gnulib module stdckdint-h BUILT_SOURCES += $(STDCKDINT_H) @@ -1769,6 +2145,15 @@ BUILT_SOURCES += $(STDCKDINT_H) if GL_GENERATE_STDCKDINT_H stdckdint.h: stdckdint.in.h $(top_builddir)/config.status $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDCKDINT_H''@|$(NEXT_STDCKDINT_H)|g' \ + -e 's|@''HAVE_C_STDCKDINT_H''@|$(HAVE_C_STDCKDINT_H)|g' \ + -e 's|@''HAVE_WORKING_C_STDCKDINT_H''@|$(HAVE_WORKING_C_STDCKDINT_H)|g' \ + -e 's|@''HAVE_CXX_STDCKDINT_H''@|$(HAVE_CXX_STDCKDINT_H)|g' \ + -e 's|@''HAVE_WORKING_CXX_STDCKDINT_H''@|$(HAVE_WORKING_CXX_STDCKDINT_H)|g' \ $(srcdir)/stdckdint.in.h > $@-t $(AM_V_at)mv $@-t $@ else @@ -1779,9 +2164,9 @@ MOSTLYCLEANFILES += stdckdint.h stdckdint.h-t EXTRA_DIST += intprops-internal.h stdckdint.in.h -## end gnulib module stdckdint +## end gnulib module stdckdint-h -## begin gnulib module stddef +## begin gnulib module stddef-h BUILT_SOURCES += $(STDDEF_H) @@ -1795,9 +2180,11 @@ stddef.h: stddef.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ - -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ - -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ + -e 's|@''NULLPTR_T_NEEDS_STDDEF''@|$(NULLPTR_T_NEEDS_STDDEF)|g' \ + -e 's|@''STDDEF_NOT_IDEMPOTENT''@|$(STDDEF_NOT_IDEMPOTENT)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ + -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ + -e 's|@''HAVE_C_UNREACHABLE''@|$(HAVE_C_UNREACHABLE)|g' \ $(srcdir)/stddef.in.h > $@-t $(AM_V_at)mv $@-t $@ else @@ -1808,9 +2195,9 @@ MOSTLYCLEANFILES += stddef.h stddef.h-t EXTRA_DIST += stddef.in.h -## end gnulib module stddef +## end gnulib module stddef-h -## begin gnulib module stdint +## begin gnulib module stdint-h BUILT_SOURCES += $(STDINT_H) @@ -1856,9 +2243,9 @@ MOSTLYCLEANFILES += stdint.h stdint.h-t EXTRA_DIST += stdint.in.h -## end gnulib module stdint +## end gnulib module stdint-h -## begin gnulib module stdio +## begin gnulib module stdio-h BUILT_SOURCES += stdio.h @@ -1872,6 +2259,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ + -e 's/@''GNULIB_DZPRINTF''@/$(GL_GNULIB_DZPRINTF)/g' \ -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ -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) -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ + -e 's/@''GNULIB_FZPRINTF''@/$(GL_GNULIB_FZPRINTF)/g' \ -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_OBSTACK_ZPRINTF''@/$(GL_GNULIB_OBSTACK_ZPRINTF)/g' \ -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ -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) -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ + -e 's/@''GNULIB_SNZPRINTF''@/$(GL_GNULIB_SNZPRINTF)/g' \ -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_SZPRINTF''@/$(GL_GNULIB_SZPRINTF)/g' \ -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ + -e 's/@''GNULIB_VASZPRINTF''@/$(GL_GNULIB_VASZPRINTF)/g' \ -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ + -e 's/@''GNULIB_VDZPRINTF''@/$(GL_GNULIB_VDZPRINTF)/g' \ -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VFZPRINTF''@/$(GL_GNULIB_VFZPRINTF)/g' \ -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ + -e 's/@''GNULIB_VSNZPRINTF''@/$(GL_GNULIB_VSNZPRINTF)/g' \ -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VSZPRINTF''@/$(GL_GNULIB_VSZPRINTF)/g' \ + -e 's/@''GNULIB_VZPRINTF''@/$(GL_GNULIB_VZPRINTF)/g' \ + -e 's/@''GNULIB_ZPRINTF''@/$(GL_GNULIB_ZPRINTF)/g' \ -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ -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) $(AM_V_at)mv $@-t3 $@ MOSTLYCLEANFILES += stdio.h stdio.h-t1 stdio.h-t2 stdio.h-t3 +if GL_COND_OBJ_STDIO_CONSOLESAFE +libgnu_a_SOURCES += stdio-consolesafe.c +endif if GL_COND_OBJ_STDIO_READ libgnu_a_SOURCES += stdio-read.c endif @@ -2005,14 +2407,13 @@ endif EXTRA_DIST += stdio.in.h -## end gnulib module stdio +## end gnulib module stdio-h -## begin gnulib module stdlib +## begin gnulib module stdlib-h BUILT_SOURCES += stdlib.h +libgnu_a_SOURCES += stdlib.c -# We need the following in order to create when the system -# doesn't have one that works with the given compiler. stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(gl_V_at)$(SED_HEADER_STDOUT) \ @@ -2022,6 +2423,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \ + -e 's/@''GNULIB_ABORT_DEBUG''@/$(GL_GNULIB_ABORT_DEBUG)/g' \ -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \ -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \ -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) \ -e 's/@''GNULIB_RAND''@/$(GL_GNULIB_RAND)/g' \ -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ - -e 's/@''GNULIB_REALLOC_GNU''@/$(GL_GNULIB_REALLOC_GNU)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \ -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \ -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \ -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ + -e 's/@''GNULIB_STACK_TRACE''@/$(GL_GNULIB_STACK_TRACE)/g' \ -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \ -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ @@ -2124,6 +2526,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ < $@-t1 > $@-t2 $(AM_V_at)sed \ -e 's|@''REPLACE__EXIT''@|$(REPLACE__EXIT)|g' \ + -e 's|@''REPLACE_ABORT''@|$(REPLACE_ABORT)|g' \ -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \ -e 's|@''REPLACE_CALLOC_FOR_CALLOC_GNU''@|$(REPLACE_CALLOC_FOR_CALLOC_GNU)|g' \ -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) \ -e 's|@''REPLACE_RAND''@|$(REPLACE_RAND)|g' \ -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ - -e 's|@''REPLACE_REALLOC_FOR_REALLOC_GNU''@|$(REPLACE_REALLOC_FOR_REALLOC_GNU)|g' \ -e 's|@''REPLACE_REALLOC_FOR_REALLOC_POSIX''@|$(REPLACE_REALLOC_FOR_REALLOC_POSIX)|g' \ -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ @@ -2165,6 +2567,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ + -e 's|@''CAN_PRINT_STACK_TRACE''@|$(CAN_PRINT_STACK_TRACE)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _Noreturn/r $(_NORETURN_H)' \ -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 EXTRA_DIST += stdlib.in.h -## end gnulib module stdlib +## end gnulib module stdlib-h -## begin gnulib module strcase +## begin gnulib module strcasecmp if GL_COND_OBJ_STRCASECMP libgnu_a_SOURCES += strcasecmp.c endif -if GL_COND_OBJ_STRNCASECMP -libgnu_a_SOURCES += strncasecmp.c -endif -## end gnulib module strcase +## end gnulib module strcasecmp ## begin gnulib module strcasestr @@ -2232,7 +2632,7 @@ EXTRA_DIST += strerror-override.h ## end gnulib module strerror-override -## begin gnulib module string +## begin gnulib module string-h BUILT_SOURCES += string.h @@ -2262,6 +2662,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MBS_ENDSWITH''@/$(GL_GNULIB_MBS_ENDSWITH)/g' \ + -e 's/@''GNULIB_MBS_STARTSWITH''@/$(GL_GNULIB_MBS_STARTSWITH)/g' \ -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ -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 -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNCPY''@/$(GL_GNULIB_STRNCPY)/g' \ -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ -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 -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ + -e 's/@''GNULIB_STR_ENDSWITH''@/$(GL_GNULIB_STR_ENDSWITH)/g' \ + -e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \ -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_STRERROR_L''@/$(GL_GNULIB_STRERROR_L)/g' \ -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ -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 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ + -e 's|@''HAVE_STRERROR_L''@|$(HAVE_STRERROR_L)|g' \ -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ -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 -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ + -e 's|@''REPLACE_STRNCPY''@|$(REPLACE_STRNCPY)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ -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 -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRERROR_L''@|$(REPLACE_STRERROR_L)|g' \ -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ -e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \ @@ -2349,9 +2758,9 @@ MOSTLYCLEANFILES += string.h string.h-t1 string.h-t2 EXTRA_DIST += string.in.h -## end gnulib module string +## end gnulib module string-h -## begin gnulib module strings +## begin gnulib module strings-h BUILT_SOURCES += strings.h @@ -2366,9 +2775,20 @@ strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ -e 's/@''GNULIB_FFS''@/$(GL_GNULIB_FFS)/g' \ + -e 's/@''GNULIB_STRCASECMP''@/$(GL_GNULIB_STRCASECMP)/g' \ + -e 's/@''GNULIB_STRCASECMP_L''@/$(GL_GNULIB_STRCASECMP_L)/g' \ + -e 's/@''GNULIB_STRNCASECMP''@/$(GL_GNULIB_STRNCASECMP)/g' \ + -e 's/@''GNULIB_STRNCASECMP_L''@/$(GL_GNULIB_STRNCASECMP_L)/g' \ -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \ -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ + -e 's|@''HAVE_STRCASECMP_L''@|$(HAVE_STRCASECMP_L)|g' \ + -e 's|@''HAVE_STRNCASECMP''@|$(HAVE_STRNCASECMP)|g' \ + -e 's|@''HAVE_STRNCASECMP_L''@|$(HAVE_STRNCASECMP_L)|g' \ -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ + -e 's|@''REPLACE_STRCASECMP''@|$(REPLACE_STRCASECMP)|g' \ + -e 's|@''REPLACE_STRCASECMP_L''@|$(REPLACE_STRCASECMP_L)|g' \ + -e 's|@''REPLACE_STRNCASECMP''@|$(REPLACE_STRNCASECMP)|g' \ + -e 's|@''REPLACE_STRNCASECMP_L''@|$(REPLACE_STRNCASECMP_L)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ @@ -2378,7 +2798,23 @@ MOSTLYCLEANFILES += strings.h strings.h-t EXTRA_DIST += strings.in.h -## end gnulib module strings +## end gnulib module strings-h + +## begin gnulib module strncasecmp + +if GL_COND_OBJ_STRNCASECMP +libgnu_a_SOURCES += strncasecmp.c +endif + +## end gnulib module strncasecmp + +## begin gnulib module strncpy + +if GL_COND_OBJ_STRNCPY +libgnu_a_SOURCES += strncpy.c +endif + +## end gnulib module strncpy ## begin gnulib module strsep @@ -2397,7 +2833,7 @@ EXTRA_libgnu_a_SOURCES += strstr.c ## end gnulib module strstr-simple -## begin gnulib module sys_socket +## begin gnulib module sys_socket-h BUILT_SOURCES += sys/socket.h libgnu_a_SOURCES += sys_socket.c @@ -2445,9 +2881,9 @@ MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_socket.in.h -## end gnulib module sys_socket +## end gnulib module sys_socket-h -## begin gnulib module sys_stat +## begin gnulib module sys_stat-h BUILT_SOURCES += sys/stat.h @@ -2518,9 +2954,9 @@ MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_stat.in.h -## end gnulib module sys_stat +## end gnulib module sys_stat-h -## begin gnulib module sys_types +## begin gnulib module sys_types-h BUILT_SOURCES += sys/types.h @@ -2535,16 +2971,20 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's|@''HAVE_OFF64_T''@|$(HAVE_OFF64_T)|g' \ -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ + -e 's|@''HAVE_BLKSIZE_T''@|$(HAVE_BLKSIZE_T)|g' \ + -e 's|@''HAVE_BLKCNT_T''@|$(HAVE_BLKCNT_T)|g' \ $(srcdir)/sys_types.in.h > $@-t $(AM_V_at)mv $@-t $@ MOSTLYCLEANFILES += sys/types.h sys/types.h-t +MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_types.in.h -## end gnulib module sys_types +## end gnulib module sys_types-h -## begin gnulib module sys_uio +## begin gnulib module sys_uio-h BUILT_SOURCES += sys/uio.h @@ -2566,7 +3006,7 @@ MOSTLYCLEANDIRS += sys EXTRA_DIST += sys_uio.in.h -## end gnulib module sys_uio +## end gnulib module sys_uio-h ## begin gnulib module threadlib @@ -2599,6 +3039,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's/@''GNULIB_TIMESPEC_GETRES''@/$(GL_GNULIB_TIMESPEC_GETRES)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ + -e 's/@''GNULIB_TZNAME''@/$(GL_GNULIB_TZNAME)/g' \ -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ -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) $( -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \ -e 's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \ -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ + -e 's|@''HAVE_TZALLOC''@|$(HAVE_TZALLOC)|g' \ -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ + -e 's|@''REPLACE_LOCALTIME_RZ''@|$(REPLACE_LOCALTIME_RZ)|g' \ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ + -e 's|@''REPLACE_MKTIME_Z''@|$(REPLACE_MKTIME_Z)|g' \ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \ @@ -2654,7 +3098,412 @@ EXTRA_DIST += mktime-internal.h ## end gnulib module timegm -## begin gnulib module unistd +## begin gnulib module uchar-h + +BUILT_SOURCES += uchar.h + +uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_UCHAR_H''@/$(HAVE_UCHAR_H)/g' \ + -e 's/@''CXX_HAVE_UCHAR_H''@/$(CXX_HAVE_UCHAR_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_UCHAR_H''@|$(NEXT_UCHAR_H)|g' \ + -e 's|@''CXX_HAS_CHAR8_TYPE''@|$(CXX_HAS_CHAR8_TYPE)|g' \ + -e 's|@''CXX_HAS_UCHAR_TYPES''@|$(CXX_HAS_UCHAR_TYPES)|g' \ + -e 's|@''SMALL_WCHAR_T''@|$(SMALL_WCHAR_T)|g' \ + -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR8_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR8_T)|g' \ + -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR16_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR16_T)|g' \ + -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR32_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR32_T)|g' \ + -e 's/@''GNULIB_BTOC32''@/$(GL_GNULIB_BTOC32)/g' \ + -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \ + -e 's/@''GNULIB_C32ISALNUM''@/$(GL_GNULIB_C32ISALNUM)/g' \ + -e 's/@''GNULIB_C32ISALPHA''@/$(GL_GNULIB_C32ISALPHA)/g' \ + -e 's/@''GNULIB_C32ISBLANK''@/$(GL_GNULIB_C32ISBLANK)/g' \ + -e 's/@''GNULIB_C32ISCNTRL''@/$(GL_GNULIB_C32ISCNTRL)/g' \ + -e 's/@''GNULIB_C32ISDIGIT''@/$(GL_GNULIB_C32ISDIGIT)/g' \ + -e 's/@''GNULIB_C32ISGRAPH''@/$(GL_GNULIB_C32ISGRAPH)/g' \ + -e 's/@''GNULIB_C32ISLOWER''@/$(GL_GNULIB_C32ISLOWER)/g' \ + -e 's/@''GNULIB_C32ISPRINT''@/$(GL_GNULIB_C32ISPRINT)/g' \ + -e 's/@''GNULIB_C32ISPUNCT''@/$(GL_GNULIB_C32ISPUNCT)/g' \ + -e 's/@''GNULIB_C32ISSPACE''@/$(GL_GNULIB_C32ISSPACE)/g' \ + -e 's/@''GNULIB_C32ISUPPER''@/$(GL_GNULIB_C32ISUPPER)/g' \ + -e 's/@''GNULIB_C32ISXDIGIT''@/$(GL_GNULIB_C32ISXDIGIT)/g' \ + -e 's/@''GNULIB_C32TOLOWER''@/$(GL_GNULIB_C32TOLOWER)/g' \ + -e 's/@''GNULIB_C32TOUPPER''@/$(GL_GNULIB_C32TOUPPER)/g' \ + -e 's/@''GNULIB_C32WIDTH''@/$(GL_GNULIB_C32WIDTH)/g' \ + -e 's/@''GNULIB_C32RTOMB''@/$(GL_GNULIB_C32RTOMB)/g' \ + -e 's/@''GNULIB_C32SNRTOMBS''@/$(GL_GNULIB_C32SNRTOMBS)/g' \ + -e 's/@''GNULIB_C32SRTOMBS''@/$(GL_GNULIB_C32SRTOMBS)/g' \ + -e 's/@''GNULIB_C32STOMBS''@/$(GL_GNULIB_C32STOMBS)/g' \ + -e 's/@''GNULIB_C32SWIDTH''@/$(GL_GNULIB_C32SWIDTH)/g' \ + -e 's/@''GNULIB_C32TOB''@/$(GL_GNULIB_C32TOB)/g' \ + -e 's/@''GNULIB_C32_APPLY_MAPPING''@/$(GL_GNULIB_C32_APPLY_MAPPING)/g' \ + -e 's/@''GNULIB_C32_APPLY_TYPE_TEST''@/$(GL_GNULIB_C32_APPLY_TYPE_TEST)/g' \ + -e 's/@''GNULIB_C32_GET_MAPPING''@/$(GL_GNULIB_C32_GET_MAPPING)/g' \ + -e 's/@''GNULIB_C32_GET_TYPE_TEST''@/$(GL_GNULIB_C32_GET_TYPE_TEST)/g' \ + -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \ + -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \ + -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \ + -e 's/@''GNULIB_MBRTOC16''@/$(GL_GNULIB_MBRTOC16)/g' \ + -e 's/@''GNULIB_MBRTOC32''@/$(GL_GNULIB_MBRTOC32)/g' \ + -e 's/@''GNULIB_MBSNRTOC32S''@/$(GL_GNULIB_MBSNRTOC32S)/g' \ + -e 's/@''GNULIB_MBSNRTOWCS''@/$(GL_GNULIB_MBSNRTOWCS)/g' \ + -e 's/@''GNULIB_MBSRTOC32S''@/$(GL_GNULIB_MBSRTOC32S)/g' \ + -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \ + -e 's/@''GNULIB_MBSTOC32S''@/$(GL_GNULIB_MBSTOC32S)/g' \ + -e 's/@''GNULIB_TOWCTRANS''@/$(GL_GNULIB_TOWCTRANS)/g' \ + -e 's/@''GNULIB_WCSNRTOMBS''@/$(GL_GNULIB_WCSNRTOMBS)/g' \ + -e 's/@''GNULIB_WCSRTOMBS''@/$(GL_GNULIB_WCSRTOMBS)/g' \ + -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \ + -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \ + -e 's/@''GNULIB_WCTRANS''@/$(GL_GNULIB_WCTRANS)/g' \ + -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \ + -e 's/@''GNULIB_WCWIDTH''@/$(GL_GNULIB_WCWIDTH)/g' \ + -e 's|@''HAVE_C32RTOMB''@|$(HAVE_C32RTOMB)|g' \ + -e 's|@''HAVE_MBRTOC16''@|$(HAVE_MBRTOC16)|g' \ + -e 's|@''HAVE_MBRTOC32''@|$(HAVE_MBRTOC32)|g' \ + -e 's|@''REPLACE_C32RTOMB''@|$(REPLACE_C32RTOMB)|g' \ + -e 's|@''REPLACE_MBRTOC16''@|$(REPLACE_MBRTOC16)|g' \ + -e 's|@''REPLACE_MBRTOC32''@|$(REPLACE_MBRTOC32)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + $(srcdir)/uchar.in.h > $@-t + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += uchar.h uchar.h-t + +EXTRA_DIST += uchar.in.h + +## end gnulib module uchar-h + +## begin gnulib module unicase/base + +BUILT_SOURCES += $(LIBUNISTRING_UNICASE_H) + +unicase.h: unicase.in.h + $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \ + -e 's/@''GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE''@/$(GL_GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE''@/$(GL_GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE)/g' \ + $(srcdir)/unicase.in.h > $@-t + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += unicase.h unicase.h-t + +EXTRA_DIST += unicase.in.h + +## end gnulib module unicase/base + +## begin gnulib module unicase/tolower + +if LIBUNISTRING_COMPILE_UNICASE_TOLOWER +libgnu_a_SOURCES += unicase/tolower.c +endif + +EXTRA_DIST += unicase/simple-mapping.h unicase/tolower.h + +## end gnulib module unicase/tolower + +## begin gnulib module unictype/base + +BUILT_SOURCES += $(LIBUNISTRING_UNICTYPE_H) + +unictype.h: unictype.in.h + $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE)/g' \ + < $(srcdir)/unictype.in.h > $@-t1 + $(AM_V_at)sed \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE)/g' \ + < $@-t1 > $@-t2 + $(AM_V_at)sed \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE)/g' \ + < $@-t2 > $@-t3 + $(AM_V_at)sed \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE)/g' \ + < $@-t3 > $@-t4 + $(AM_V_at)rm -f $@-t1 $@-t2 $@-t3 + $(AM_V_at)mv $@-t4 $@ +MOSTLYCLEANFILES += unictype.h unictype.h-t1 unictype.h-t2 unictype.h-t3 unictype.h-t4 + +EXTRA_DIST += unictype.in.h + +## end gnulib module unictype/base + +## begin gnulib module unictype/ctype-alnum + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_ALNUM +libgnu_a_SOURCES += unictype/ctype_alnum.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_alnum.h + +## end gnulib module unictype/ctype-alnum + +## begin gnulib module unictype/ctype-alpha + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_ALPHA +libgnu_a_SOURCES += unictype/ctype_alpha.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_alpha.h + +## end gnulib module unictype/ctype-alpha + +## begin gnulib module unictype/ctype-blank + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_BLANK +libgnu_a_SOURCES += unictype/ctype_blank.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_blank.h + +## end gnulib module unictype/ctype-blank + +## begin gnulib module unictype/ctype-cntrl + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_CNTRL +libgnu_a_SOURCES += unictype/ctype_cntrl.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_cntrl.h + +## end gnulib module unictype/ctype-cntrl + +## begin gnulib module unictype/ctype-digit + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_DIGIT +libgnu_a_SOURCES += unictype/ctype_digit.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_digit.h + +## end gnulib module unictype/ctype-digit + +## begin gnulib module unictype/ctype-graph + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_GRAPH +libgnu_a_SOURCES += unictype/ctype_graph.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_graph.h + +## end gnulib module unictype/ctype-graph + +## begin gnulib module unictype/ctype-lower + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_LOWER +libgnu_a_SOURCES += unictype/ctype_lower.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_lower.h + +## end gnulib module unictype/ctype-lower + +## begin gnulib module unictype/ctype-print + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_PRINT +libgnu_a_SOURCES += unictype/ctype_print.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_print.h + +## end gnulib module unictype/ctype-print + +## begin gnulib module unictype/ctype-punct + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_PUNCT +libgnu_a_SOURCES += unictype/ctype_punct.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_punct.h + +## end gnulib module unictype/ctype-punct + +## begin gnulib module unictype/ctype-space + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_SPACE +libgnu_a_SOURCES += unictype/ctype_space.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_space.h + +## end gnulib module unictype/ctype-space + +## begin gnulib module unictype/ctype-upper + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_UPPER +libgnu_a_SOURCES += unictype/ctype_upper.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_upper.h + +## end gnulib module unictype/ctype-upper + +## begin gnulib module unictype/ctype-xdigit + +if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_XDIGIT +libgnu_a_SOURCES += unictype/ctype_xdigit.c +endif + +EXTRA_DIST += unictype/bitmap.h unictype/ctype_xdigit.h + +## end gnulib module unictype/ctype-xdigit + +## begin gnulib module uninorm/base + +BUILT_SOURCES += $(LIBUNISTRING_UNINORM_H) + +uninorm.h: uninorm.in.h + $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \ + -e 's/@''GNULIB_UNINORM_NFD_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFD_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNINORM_NFC_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFC_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNINORM_NFKD_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFKD_DLL_VARIABLE)/g' \ + -e 's/@''GNULIB_UNINORM_NFKC_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFKC_DLL_VARIABLE)/g' \ + $(srcdir)/uninorm.in.h > $@-t + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += uninorm.h uninorm.h-t + +EXTRA_DIST += uninorm.in.h + +## end gnulib module uninorm/base + +## begin gnulib module unistd-h BUILT_SOURCES += unistd.h libgnu_a_SOURCES += unistd.c @@ -2830,11 +3679,13 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \ + -e 's|@''REPLACE_GETLOGIN''@|$(REPLACE_GETLOGIN)|g' \ -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ -e 's|@''REPLACE_GETPASS_FOR_GETPASS_GNU''@|$(REPLACE_GETPASS_FOR_GETPASS_GNU)|g' \ + -e 's|@''REPLACE_GETUSERSHELL''@|$(REPLACE_GETUSERSHELL)|g' \ -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -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 EXTRA_DIST += unistd.in.h -## end gnulib module unistd +## end gnulib module unistd-h + +## begin gnulib module unitypes-h + +BUILT_SOURCES += $(LIBUNISTRING_UNITYPES_H) + +unitypes.h: unitypes.in.h + $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/unitypes.in.h + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += unitypes.h unitypes.h-t + +EXTRA_DIST += unitypes.in.h + +## end gnulib module unitypes-h + +## begin gnulib module uniwidth/base + +BUILT_SOURCES += $(LIBUNISTRING_UNIWIDTH_H) + +uniwidth.h: uniwidth.in.h + $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/uniwidth.in.h + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += uniwidth.h uniwidth.h-t + +EXTRA_DIST += localcharset.h uniwidth.in.h + +## end gnulib module uniwidth/base + +## begin gnulib module uniwidth/width + +if LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH +libgnu_a_SOURCES += uniwidth/width.c +endif + +EXTRA_DIST += unictype/bitmap.h uniwidth/cjk.h uniwidth/width0.h uniwidth/width2.h + +## end gnulib module uniwidth/width ## begin gnulib module unlocked-io-internal @@ -2921,7 +3808,13 @@ EXTRA_libgnu_a_SOURCES += vsnprintf.c ## end gnulib module vsnprintf -## begin gnulib module wchar +## begin gnulib module vsnzprintf + +libgnu_a_SOURCES += vsnzprintf.c + +## end gnulib module vsnzprintf + +## begin gnulib module wchar-h BUILT_SOURCES += wchar.h @@ -3046,6 +3939,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ -e 's|@''REPLACE_WCSCMP''@|$(REPLACE_WCSCMP)|g' \ + -e 's|@''REPLACE_WCSNCAT''@|$(REPLACE_WCSNCAT)|g' \ -e 's|@''REPLACE_WCSNCMP''@|$(REPLACE_WCSNCMP)|g' \ -e 's|@''REPLACE_WCSSTR''@|$(REPLACE_WCSSTR)|g' \ -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ @@ -3061,7 +3955,7 @@ MOSTLYCLEANFILES += wchar.h wchar.h-t1 wchar.h-t2 wchar.h-t3 EXTRA_DIST += wchar.in.h -## end gnulib module wchar +## end gnulib module wchar-h ## begin gnulib module wcrtomb @@ -3130,6 +4024,14 @@ EXTRA_DIST += wctype.in.h ## end gnulib module wctype-h +## begin gnulib module wcwidth + +if GL_COND_OBJ_WCWIDTH +libgnu_a_SOURCES += wcwidth.c +endif + +## end gnulib module wcwidth + ## begin gnulib module windows-mutex if GL_COND_OBJ_WINDOWS_MUTEX @@ -3209,5 +4111,5 @@ mostlyclean-local: mostlyclean-generic : distclean-local: distclean-gnulib-libobjs distclean-gnulib-libobjs: - -rm -f @gl_LIBOBJDEPS@ + -rm -f @gl_libgnu_LIBOBJDEPS@ maintainer-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 @@ /* A C macro for declaring that a function does not return. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -14,33 +14,26 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +/* The _Noreturn keyword of C11. + Do not use [[noreturn]], because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would be valid only with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. So even though C23 deprecates _Noreturn, + it is currently more portable to prefer it to [[noreturn]]. + + Also, do not try to work around LLVM bug 59792 (clang 15 or earlier). + This rare bug can be worked around by compiling with 'clang -D_Noreturn=', + though the workaround may generate many false-alarm warnings. */ #ifndef _Noreturn -# if (defined __cplusplus \ - && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ - || (defined _MSC_VER && 1900 <= _MSC_VER)) \ - && 0) - /* [[noreturn]] is not practically usable, because with it the syntax - extern _Noreturn void func (...); - would not be valid; such a declaration would only be valid with 'extern' - and '_Noreturn' swapped, or without the 'extern' keyword. However, some - AIX system header files and several gnulib header files use precisely - this syntax with 'extern'. */ -# define _Noreturn [[noreturn]] -# elif (defined __clang__ && __clang_major__ < 16 \ - && defined _GL_WORK_AROUND_LLVM_BUG_59792) - /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around - that rare LLVM bug, though you may get many false-alarm warnings. */ -# define _Noreturn -# elif ((!defined __cplusplus || defined __clang__) \ - && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ - || (!defined __STRICT_ANSI__ \ - && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ - || (defined __apple_build_version__ \ - ? 6000000 <= __apple_build_version__ \ - : 3 < __clang_major__ + (5 <= __clang_minor__)))))) +# if ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0))) /* _Noreturn works as-is. */ # elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ || 0x5110 <= __SUNPRO_C) + /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the + latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */ # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # 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 @@ /* af_alg.c - Compute message digests from file streams and buffers. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* af_alg.h - Compute message digests from file streams and buffers. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2024 Free Software Foundation, + Copyright (C) 1995, 1999, 2001-2004, 2006-2025 Free Software Foundation, Inc. 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 @@ /* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it 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 @@ +/* Inline functions for . + + Copyright (C) 2024-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define _GL_ARPA_INET_INLINE _GL_EXTERN_INLINE +#include 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 @@ /* A GNU-like . - Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -60,6 +60,53 @@ # include #endif +#if !(@HAVE_DECL_HTONL@ || @HAVE_DECL_HTONS@ || @HAVE_DECL_NTOHL@ || @HAVE_DECL_NTOHS@) +# include +#endif + +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_ARPA_INET_INLINE +# define _GL_ARPA_INET_INLINE _GL_INLINE +#endif + + +/* Host to network byte order. */ + +#if !@HAVE_DECL_HTONS@ +_GL_ARPA_INET_INLINE uint16_t +htons (uint16_t value) +{ + return htobe16 (value); +} +#endif + +#if !@HAVE_DECL_HTONL@ +_GL_ARPA_INET_INLINE uint32_t +htonl (uint32_t value) +{ + return htobe32 (value); +} +#endif + +/* Network to host byte order. */ + +#if !@HAVE_DECL_NTOHS@ +_GL_ARPA_INET_INLINE uint16_t +ntohs (uint16_t value) +{ + return htobe16 (value); +} +#endif + +#if !@HAVE_DECL_NTOHL@ +_GL_ARPA_INET_INLINE uint32_t +ntohl (uint32_t value) +{ + return htobe32 (value); +} +#endif + + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -90,7 +137,7 @@ # endif _GL_FUNCDECL_RPL (inet_ntop, const char *, (int af, const void *restrict src, - char *restrict dst, socklen_t cnt) + char *restrict dst, socklen_t cnt), _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (inet_ntop, const char *, (int af, const void *restrict src, @@ -99,7 +146,7 @@ _GL_CXXALIAS_RPL (inet_ntop, const char *, # if !@HAVE_DECL_INET_NTOP@ _GL_FUNCDECL_SYS (inet_ntop, const char *, (int af, const void *restrict src, - char *restrict dst, socklen_t cnt) + char *restrict dst, socklen_t cnt), _GL_ARG_NONNULL ((2, 3))); # endif /* 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 - " # define inet_pton rpl_inet_pton # endif _GL_FUNCDECL_RPL (inet_pton, int, - (int af, const char *restrict src, void *restrict dst) + (int af, const char *restrict src, void *restrict dst), _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (inet_pton, int, (int af, const char *restrict src, void *restrict dst)); # else # if !@HAVE_DECL_INET_PTON@ _GL_FUNCDECL_SYS (inet_pton, int, - (int af, const char *restrict src, void *restrict dst) + (int af, const char *restrict src, void *restrict dst), _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (inet_pton, int, @@ -150,6 +197,7 @@ _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - " # endif #endif +_GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ #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 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. 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 @@ /* Substitute for and wrapper around - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* ATTRIBUTE_* macros for using attributes in GCC and similar compilers - Copyright 2020-2024 Free Software Foundation, Inc. + Copyright 2020-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -20,12 +20,50 @@ /* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_* macros used within Gnulib. */ -/* These attributes can be placed in two ways: - - At the start of a declaration (i.e. even before storage-class - specifiers!); then they apply to all entities that are declared - by the declaration. - - Immediately after the name of an entity being declared by the - declaration; then they apply to that entity only. */ +/* The placement of these attributes depends on the kind of declaration + and, in some cases, also on the programming language (C vs. C++). + + In function declarations and function definitions: + + * ATTRIBUTE_NOTHROW must come after the parameter list. + + * The macros + ATTRIBUTE_CONST + ATTRIBUTE_PURE + DEPRECATED + MAYBE_UNUSED + NODISCARD + REPRODUCIBLE + UNSEQUENCED + must come before the return type, and more precisely: + - In a function declaration/definition without a storage-class + specifier: at the beginning of the declaration/definition. + - In a function declaration/definition with a storage-class + specifier: + - In C: before the storage-class specifier. + - In C++: between the storage-class specifier and the return type. + + * The other macros can be placed + - Either + - In a function declaration/definition without a storage-class + specifier: at the beginning of the declaration/definition. + - In a function declaration/definition with a storage-class + specifier: between the storage-class specifier and the return + type. + - Or, in a function declaration: + after the parameter list, + ∙ but after ATTRIBUTE_NOTHROW if present. + + In other declarations, such as variable declarations: + + * Either + - In C: before the storage-class specifier. + - In C++: between the storage-class specifier and the return type. + Then they apply to all entities that are declared by the declaration. + + * Or immediately after the name of an entity being declared by the + declaration. Then they apply to that entity only. + */ #ifndef _GL_ATTRIBUTE_H #define _GL_ATTRIBUTE_H @@ -48,9 +86,10 @@ _GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL, - _GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, - _GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL, - _GL_ATTRIBUTE_SENTINEL. */ + _GL_ATTRIBUTE_NONNULL_IF_NONZERO, _GL_ATTRIBUTE_NONSTRING, + _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE, + _GL_ATTRIBUTE_REPRODUCIBLE, _GL_ATTRIBUTE_RETURNS_NONNULL, + _GL_ATTRIBUTE_SENTINEL, _GL_ATTRIBUTE_UNSEQUENCED. */ #if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif @@ -88,7 +127,7 @@ is the size of the returned memory block. ATTRIBUTE_ALLOC_SIZE ((M, N)) - Multiply the Mth and Nth arguments to determine the size of the returned memory block. */ -/* Applies to: function, pointer to function, function types. */ +/* Applies to: functions, pointer to functions, function types. */ #define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args) /* ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers @@ -132,6 +171,12 @@ /* Applies to: functions. */ #define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args) +/* ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) - Argument NP (a pointer) + must not be NULL if the argument NI (an integer) is != 0. */ +/* Applies to: functions. */ +#define ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (np, ni) + + /* The function's return value is a non-NULL pointer. */ /* Applies to: functions. */ #define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL @@ -170,7 +215,7 @@ /* Attributes regarding debugging information emitted by the compiler. */ /* Omit the function from stack traces when debugging. */ -/* Applies to: function. */ +/* Applies to: functions. */ #define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL /* Make the entity visible to debuggers etc., even with '-fwhole-program'. */ @@ -192,25 +237,68 @@ /* Always inline the function, and report an error if the compiler cannot inline. */ -/* Applies to: function. */ +/* Applies to: functions. */ #define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE -/* It is OK for a compiler to omit duplicate calls with the same arguments. +/* It is OK for a compiler to move calls to the function and to omit + calls to the function if another call has the same arguments or the + result is not used. This attribute is safe for a function that neither depends on - nor affects observable state, and always returns exactly once - - e.g., does not loop forever, and does not call longjmp. - (This attribute is stricter than ATTRIBUTE_PURE.) */ + nor affects state, and always returns exactly once - + e.g., does not raise an exception, call longjmp, or loop forever. + (This attribute is stricter than ATTRIBUTE_PURE because the + function cannot observe state. It is stricter than UNSEQUENCED + because the function must return exactly once and cannot depend on + state addressed by its arguments.) */ /* Applies to: functions. */ #define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST -/* It is OK for a compiler to omit duplicate calls with the same - arguments if observable state is not changed between calls. - This attribute is safe for a function that does not affect - observable state, and always returns exactly once. - (This attribute is looser than ATTRIBUTE_CONST.) */ +/* It is OK for a compiler to move calls to the function and to omit duplicate + calls to the function with the same arguments, so long as the state + addressed by its arguments is the same. + This attribute is safe for a function that is effectless, idempotent, + stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of + these terms. + (This attribute is stricter than REPRODUCIBLE because the function + must be stateless and independent. It is looser than ATTRIBUTE_CONST + because the function need not return exactly once and can depend + on state addressed by its arguments.) + See also and + . + ATTENTION! Efforts are underway to change the meaning of this attribute. + See . */ +/* Applies to: functions, pointer to functions, function type. */ +#define UNSEQUENCED _GL_ATTRIBUTE_UNSEQUENCED + +/* It is OK for a compiler to move calls to the function and to omit + calls to the function if another call has the same arguments or the + result is not used, and if observable state is the same. + This attribute is safe for a function that does not affect observable state + and always returns exactly once. + (This attribute is looser than ATTRIBUTE_CONST because the function + can depend on observable state. It is stricter than REPRODUCIBLE + because the function must return exactly once and cannot affect + state addressed by its arguments.) */ /* Applies to: functions. */ #define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE +/* It is OK for a compiler to move calls to the function and to omit duplicate + calls to the function with the same arguments, so long as the state + addressed by its arguments is the same and is updated in time for + the rest of the program. + This attribute is safe for a function that is effectless and idempotent; see + ISO C 23 § 6.7.12.7 for a definition of these terms. + (This attribute is looser than UNSEQUENCED because the function need + not be stateless and idempotent. It is looser than ATTRIBUTE_PURE + because the function need not return exactly once and can affect + state addressed by its arguments.) + See also and + . + ATTENTION! Efforts are underway to change the meaning of this attribute. + See . */ +/* Applies to: functions, pointer to functions, function type. */ +#define REPRODUCIBLE _GL_ATTRIBUTE_REPRODUCIBLE + /* The function is rarely executed. */ /* Applies to: functions. */ #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 @@ /* base64.c -- Encode binary data using printable characters. - Copyright (C) 1999-2001, 2004-2006, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 1999-2001, 2004-2006, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -48,7 +48,7 @@ /* Get imalloc. */ #include -#include +#include #include @@ -59,7 +59,7 @@ to_uchar (char ch) return ch; } -static const char b64c[64] = +static const char b64c[64] _GL_ATTRIBUTE_NONSTRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /* 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) Treat negative INLEN as overflow, for better compatibility with pre-2021-08-27 API, which used size_t. */ idx_t in_over_3 = inlen / 3 + (inlen % 3 != 0), outlen; - if (! INT_MULTIPLY_OK (in_over_3, 4, &outlen) || inlen < 0) + if (ckd_mul (&outlen, in_over_3, 4) || inlen < 0) { *out = NULL; 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 @@ /* base64.h -- Encode binary data using printable characters. - Copyright (C) 2004-2006, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2004-2006, 2009-2025 Free Software Foundation, Inc. Written by Simon Josefsson. This file is free software: you can redistribute it and/or modify @@ -27,7 +27,7 @@ #include /* Pacify GCC in isubase64. */ -#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) +#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__ # pragma GCC diagnostic ignored "-Wtype-limits" #endif 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 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ /* Extract the last component (base name) of a file name. - Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ /* Convert unibyte character to wide character. - Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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 @@ +/* Inline functions for . + + Copyright 2024-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define _GL_BYTESWAP_INLINE _GL_EXTERN_INLINE +#include 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 @@ /* byteswap.h - Byte swapping - Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. Written by Oskar Liljeblad , 2005. This file is free software: you can redistribute it and/or modify @@ -16,29 +16,103 @@ along with this program. If not, see . */ #ifndef _GL_BYTESWAP_H -#define _GL_BYTESWAP_H +#define _GL_BYTESWAP_H 1 + +/* This file uses _GL_INLINE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +/* Define this now, rather than after including stdint.h, in case + stdint.h recursively includes us. This is for Gnulib endian.h. */ +#ifndef _GL_BYTESWAP_INLINE +# define _GL_BYTESWAP_INLINE _GL_INLINE +#endif + +#include + +_GL_INLINE_HEADER_BEGIN + +#ifdef __cplusplus +extern "C" { +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) +# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP16 true +#elif defined __has_builtin +# if __has_builtin (__builtin_bswap16) +# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP16 true +# endif +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP32 true +# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP64 true +#elif defined __has_builtin +# if __has_builtin (__builtin_bswap32) +# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP32 true +# endif +# if __has_builtin (__builtin_bswap64) +# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP64 true +# endif +#endif /* Given an unsigned 16-bit argument X, return the value corresponding to X with reversed byte order. */ -#define bswap_16(x) ((((x) & 0x00FF) << 8) | \ - (((x) & 0xFF00) >> 8)) +_GL_BYTESWAP_INLINE uint_least16_t +bswap_16 (uint_least16_t x) +{ +#ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP16 + return __builtin_bswap16 (x); +#else + uint_fast16_t mask = 0xff; + return ( (x & mask << 8 * 1) >> 8 * 1 + | (x & mask << 8 * 0) << 8 * 1); +#endif +} /* Given an unsigned 32-bit argument X, return the value corresponding to X with reversed byte order. */ -#define bswap_32(x) ((((x) & 0x000000FF) << 24) | \ - (((x) & 0x0000FF00) << 8) | \ - (((x) & 0x00FF0000) >> 8) | \ - (((x) & 0xFF000000) >> 24)) +_GL_BYTESWAP_INLINE uint_least32_t +bswap_32 (uint_least32_t x) +{ +#ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP32 + return __builtin_bswap32 (x); +#else + uint_fast32_t mask = 0xff; + return ( (x & mask << 8 * 3) >> 8 * 3 + | (x & mask << 8 * 2) >> 8 * 1 + | (x & mask << 8 * 1) << 8 * 1 + | (x & mask << 8 * 0) << 8 * 3); +#endif +} +#ifdef UINT_LEAST64_MAX /* Given an unsigned 64-bit argument X, return the value corresponding to X with reversed byte order. */ -#define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \ - (((x) & 0x000000000000FF00ULL) << 40) | \ - (((x) & 0x0000000000FF0000ULL) << 24) | \ - (((x) & 0x00000000FF000000ULL) << 8) | \ - (((x) & 0x000000FF00000000ULL) >> 8) | \ - (((x) & 0x0000FF0000000000ULL) >> 24) | \ - (((x) & 0x00FF000000000000ULL) >> 40) | \ - (((x) & 0xFF00000000000000ULL) >> 56)) +_GL_BYTESWAP_INLINE uint_least64_t +bswap_64 (uint_least64_t x) +{ +# ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP64 + return __builtin_bswap64 (x); +# else + uint_fast64_t mask = 0xff; + return ( (x & mask << 8 * 7) >> 8 * 7 + | (x & mask << 8 * 6) >> 8 * 5 + | (x & mask << 8 * 5) >> 8 * 3 + | (x & mask << 8 * 4) >> 8 * 1 + | (x & mask << 8 * 3) << 8 * 1 + | (x & mask << 8 * 2) << 8 * 3 + | (x & mask << 8 * 1) << 8 * 5 + | (x & mask << 8 * 0) << 8 * 7); +# endif +} +#endif + +#ifdef __cplusplus +} +#endif + +_GL_INLINE_HEADER_END #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 @@ /* C++ compatible function declaration macros. - Copyright (C) 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2010-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -93,11 +93,27 @@ # define _GL_EXTERN_C extern #endif -/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); +/* _GL_EXTERN_C_FUNC declaration; + performs the declaration of a function with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C_FUNC extern "C" +#else +/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax + are not allowed between 'extern' and the return type (see gnulib-common.m4). + */ +# define _GL_EXTERN_C_FUNC +#endif + +/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]); declares a replacement function, named rpl_func, with the given prototype, consisting of return type, parameters, and attributes. - Example: - _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) + Although attributes are optional, the comma before them is required + for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, + if needed, must be placed after the _GL_FUNCDECL_RPL invocation, + at the end of the declaration. + Examples: + _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW; + _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...), _GL_ARG_NONNULL ((1))); Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front @@ -106,20 +122,24 @@ [[...]] extern "C" ; is invalid syntax in C++.) */ -#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ - _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) -#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ - _GL_EXTERN_C rettype rpl_func parameters_and_attributes +#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \ + _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__) +#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters -/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); +/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. - Example: - _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) - _GL_ARG_NONNULL ((1))); + Although attributes are optional, the comma before them is required + for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, + if needed, must be placed after the _GL_FUNCDECL_RPL invocation, + at the end of the declaration. + Examples: + _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW; + _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); */ -#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ - _GL_EXTERN_C rettype func parameters_and_attributes +#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func @@ -297,7 +317,7 @@ _GL_WARN_ON_USE (func, \ "The symbol ::" #func " refers to the system function. " \ "Use " #namespace "::" #func " instead.") -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING # define _GL_CXXALIASWARN_2(func,namespace) \ extern __typeof__ (func) func # 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 @@ +/* Character handling in C locale. + + Copyright (C) 2003-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define C_CTYPE_INLINE _GL_EXTERN_INLINE +#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 @@ +/* Character handling in C locale. + + These functions work like the corresponding functions in , + except that they have the C (POSIX) locale hardwired, whereas the + functions' behaviour depends on the current locale set via + setlocale. + + Copyright (C) 2000-2003, 2006, 2008-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef C_CTYPE_H +#define C_CTYPE_H + +/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +_GL_INLINE_HEADER_BEGIN +#ifndef C_CTYPE_INLINE +# define C_CTYPE_INLINE _GL_INLINE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/* The functions defined in this file assume the "C" locale and a character + set without diacritics (ASCII-US or EBCDIC-US or something like that). + Even if the "C" locale on a particular system is an extension of the ASCII + character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it + is ISO-8859-1), the functions in this file recognize only the ASCII + characters. */ + + +#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) +/* The character set is ASCII or one of its variants or extensions, not EBCDIC. + Testing the value of '\n' and '\r' is not relevant. */ +# define C_CTYPE_ASCII 1 +#elif ! (' ' == '\x40' && '0' == '\xf0' \ + && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \ + && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2') +# error "Only ASCII and EBCDIC are supported" +#endif + +#if 'A' < 0 +# error "EBCDIC and char is signed -- not supported" +#endif + +/* Cases for control characters. */ + +#define _C_CTYPE_CNTRL \ + case '\a': case '\b': case '\f': case '\n': \ + case '\r': case '\t': case '\v': \ + _C_CTYPE_OTHER_CNTRL + +/* ASCII control characters other than those with \-letter escapes. */ + +#if C_CTYPE_ASCII +# define _C_CTYPE_OTHER_CNTRL \ + case '\x00': case '\x01': case '\x02': case '\x03': \ + case '\x04': case '\x05': case '\x06': case '\x0e': \ + case '\x0f': case '\x10': case '\x11': case '\x12': \ + case '\x13': case '\x14': case '\x15': case '\x16': \ + case '\x17': case '\x18': case '\x19': case '\x1a': \ + case '\x1b': case '\x1c': case '\x1d': case '\x1e': \ + case '\x1f': case '\x7f' +#else + /* Use EBCDIC code page 1047's assignments for ASCII control chars; + assume all EBCDIC code pages agree about these assignments. */ +# define _C_CTYPE_OTHER_CNTRL \ + case '\x00': case '\x01': case '\x02': case '\x03': \ + case '\x07': case '\x0e': case '\x0f': case '\x10': \ + case '\x11': case '\x12': case '\x13': case '\x18': \ + case '\x19': case '\x1c': case '\x1d': case '\x1e': \ + case '\x1f': case '\x26': case '\x27': case '\x2d': \ + case '\x2e': case '\x32': case '\x37': case '\x3c': \ + case '\x3d': case '\x3f' +#endif + +/* Cases for lowercase hex letters, and lowercase letters, all offset by N. */ + +#define _C_CTYPE_LOWER_A_THRU_F_N(N) \ + case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \ + case 'e' + (N): case 'f' + (N) +#define _C_CTYPE_LOWER_N(N) \ + _C_CTYPE_LOWER_A_THRU_F_N(N): \ + case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \ + case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \ + case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \ + case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \ + case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N) + +/* Cases for hex letters, digits, lower, punct, and upper. */ + +#define _C_CTYPE_A_THRU_F \ + _C_CTYPE_LOWER_A_THRU_F_N (0): \ + _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a') +#define _C_CTYPE_DIGIT \ + case '0': case '1': case '2': case '3': \ + case '4': case '5': case '6': case '7': \ + case '8': case '9' +#define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0) +#define _C_CTYPE_PUNCT \ + case '!': case '"': case '#': case '$': \ + case '%': case '&': case '\'': case '(': \ + case ')': case '*': case '+': case ',': \ + case '-': case '.': case '/': case ':': \ + case ';': case '<': case '=': case '>': \ + case '?': case '@': case '[': case '\\': \ + case ']': case '^': case '_': case '`': \ + case '{': case '|': case '}': case '~' +#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a') + + +/* Function definitions. */ + +/* Unlike the functions in , which require an argument in the range + of the 'unsigned char' type, the functions here operate on values that are + in the 'unsigned char' range or in the 'char' range. In other words, + when you have a 'char' value, you need to cast it before using it as + argument to a function: + + const char *s = ...; + if (isalpha ((unsigned char) *s)) ... + + but you don't need to cast it for the functions defined in this file: + + const char *s = ...; + if (c_isalpha (*s)) ... + */ + +C_CTYPE_INLINE bool +c_isalnum (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_isalpha (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} + +/* The function isascii is not locale dependent. + Its use in EBCDIC is questionable. */ +C_CTYPE_INLINE bool +c_isascii (int c) +{ + switch (c) + { + case ' ': + _C_CTYPE_CNTRL: + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_isblank (int c) +{ + return c == ' ' || c == '\t'; +} + +C_CTYPE_INLINE bool +c_iscntrl (int c) +{ + switch (c) + { + _C_CTYPE_CNTRL: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_isdigit (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_isgraph (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_islower (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_isprint (int c) +{ + switch (c) + { + case ' ': + _C_CTYPE_DIGIT: + _C_CTYPE_LOWER: + _C_CTYPE_PUNCT: + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_ispunct (int c) +{ + switch (c) + { + _C_CTYPE_PUNCT: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_isspace (int c) +{ + switch (c) + { + case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_isupper (int c) +{ + switch (c) + { + _C_CTYPE_UPPER: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE bool +c_isxdigit (int c) +{ + switch (c) + { + _C_CTYPE_DIGIT: + _C_CTYPE_A_THRU_F: + return true; + default: + return false; + } +} + +C_CTYPE_INLINE int +c_tolower (int c) +{ + switch (c) + { + _C_CTYPE_UPPER: + return c - 'A' + 'a'; + default: + return c; + } +} + +C_CTYPE_INLINE int +c_toupper (int c) +{ + switch (c) + { + _C_CTYPE_LOWER: + return c - 'a' + 'A'; + default: + return c; + } +} + +#ifdef __cplusplus +} +#endif + +_GL_INLINE_HEADER_END + +#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 @@ +/* Test whether a 32-bit wide character belongs to a specific character class. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2020. */ + +#include +#include + +#ifdef __CYGWIN__ +# include +#endif + +#if GNULIB_defined_mbstate_t +# include "localcharset.h" +# include "streq.h" +#endif + +#if GL_CHAR32_T_IS_UNICODE +# include "lc-charset-unicode.h" +#endif + +#include "unictype.h" + +#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t +_GL_EXTERN_INLINE +#endif +int +FUNC (wint_t wc) +{ + /* The char32_t encoding of a multibyte character is defined by the way + mbrtoc32() is defined. */ + +#if GNULIB_defined_mbstate_t /* AIX, IRIX */ + /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales + and directly for the UTF-8 locales. */ + if (wc != WEOF) + { + const char *encoding = locale_charset (); + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + return UCS_FUNC (wc); + else + return WCHAR_FUNC (wc); + } + else + return 0; + +#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */ + /* mbrtoc32() is essentially defined by the system libc. */ + +# if _GL_WCHAR_T_IS_UCS4 + /* The char32_t encoding of a multibyte character is known to be the same as + the wchar_t encoding. */ + return WCHAR_FUNC (wc); +# else + /* The char32_t encoding of a multibyte character is known to be UCS-4, + different from the wchar_t encoding. */ + if (wc != WEOF) + return UCS_FUNC (wc); + else + return 0; +# endif + +#elif _GL_SMALL_WCHAR_T /* Cygwin, mingw, MSVC */ + /* The wchar_t encoding is UTF-16. + The char32_t encoding is UCS-4. */ + +# if defined __CYGWIN__ && CYGWIN_VERSION_DLL_MAJOR >= 1007 + /* As an extension to POSIX, the iswalnum() function of Cygwin >= 1.7 + supports also wc arguments outside the Unicode BMP, that is, outside + the 'wchar_t' range. See + + = . */ + return WCHAR_FUNC (wc); +# else + if (wc == WEOF || wc == (wchar_t) wc) + /* wc is in the range for the isw* functions. */ + return WCHAR_FUNC (wc); + else + return UCS_FUNC (wc); +# endif + +#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */ + /* char32_t and wchar_t are equivalent. */ + static_assert (sizeof (char32_t) == sizeof (wchar_t)); + +# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION + return UCS_FUNC (wc); +# else + return WCHAR_FUNC (wc); +# endif +#endif +} 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 @@ +/* Test 32-bit wide character for being alphanumeric. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISALNUM +/* Specification. */ +#include + +#define FUNC c32isalnum +#define WCHAR_FUNC iswalnum +#define UCS_FUNC uc_is_alnum +#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 @@ +/* Test 32-bit wide character for being alphabetic. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISALPHA +/* Specification. */ +#include + +#define FUNC c32isalpha +#define WCHAR_FUNC iswalpha +#define UCS_FUNC uc_is_alpha +#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 @@ +/* Test 32-bit wide character for being blank. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISBLANK +/* Specification. */ +#include + +#define FUNC c32isblank +#define WCHAR_FUNC iswblank +#define UCS_FUNC uc_is_blank +#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 @@ +/* Test 32-bit wide character for being a control character. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISCNTRL +/* Specification. */ +#include + +#define FUNC c32iscntrl +#define WCHAR_FUNC iswcntrl +#define UCS_FUNC uc_is_cntrl +#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 @@ +/* Test 32-bit wide character for being a digit. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISDIGIT +/* Specification. */ +#include + +#define FUNC c32isdigit +#define WCHAR_FUNC iswdigit +#define UCS_FUNC uc_is_digit +#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 @@ +/* Test 32-bit wide character for being graphic. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISGRAPH +/* Specification. */ +#include + +#define FUNC c32isgraph +#define WCHAR_FUNC iswgraph +#define UCS_FUNC uc_is_graph +#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 @@ +/* Test 32-bit wide character for being lowercase. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISLOWER +/* Specification. */ +#include + +#define FUNC c32islower +#define WCHAR_FUNC iswlower +#define UCS_FUNC uc_is_lower +#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 @@ +/* Test 32-bit wide character for being printable. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISPRINT +/* Specification. */ +#include + +#define FUNC c32isprint +#define WCHAR_FUNC iswprint +#define UCS_FUNC uc_is_print +#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 @@ +/* Test 32-bit wide character for being a punctuation or symbol character. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISPUNCT +/* Specification. */ +#include + +#define FUNC c32ispunct +#define WCHAR_FUNC iswpunct +#define UCS_FUNC uc_is_punct +#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 @@ +/* Test 32-bit wide character for being white-space. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISSPACE +/* Specification. */ +#include + +#define FUNC c32isspace +#define WCHAR_FUNC iswspace +#define UCS_FUNC uc_is_space +#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 @@ +/* Test 32-bit wide character for being uppercase. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISUPPER +/* Specification. */ +#include + +#define FUNC c32isupper +#define WCHAR_FUNC iswupper +#define UCS_FUNC uc_is_upper +#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 @@ +/* Test 32-bit wide character for being a hexadecimal digit. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32ISXDIGIT +/* Specification. */ +#include + +#define FUNC c32isxdigit +#define WCHAR_FUNC iswxdigit +#define UCS_FUNC uc_is_xdigit +#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 @@ +/* Case mapping of a 32-bit wide character. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2023. */ + +#include +#include + +#if GNULIB_defined_mbstate_t +# include "localcharset.h" +# include "streq.h" +#endif + +#if GL_CHAR32_T_IS_UNICODE +# include "lc-charset-unicode.h" +#endif + +#include "unicase.h" + +#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t +_GL_EXTERN_INLINE +#endif +wint_t +FUNC (wint_t wc) +{ + /* The char32_t encoding of a multibyte character is defined by the way + mbrtoc32() is defined. */ + +#if GNULIB_defined_mbstate_t /* AIX, IRIX */ + /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales + and directly for the UTF-8 locales. */ + if (wc != WEOF) + { + const char *encoding = locale_charset (); + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + return UCS_FUNC (wc); + else + return WCHAR_FUNC (wc); + } + else + return wc; + +#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */ + /* mbrtoc32() is essentially defined by the system libc. */ + +# if _GL_WCHAR_T_IS_UCS4 + /* The char32_t encoding of a multibyte character is known to be the same as + the wchar_t encoding. */ + return WCHAR_FUNC (wc); +# else + /* The char32_t encoding of a multibyte character is known to be UCS-4, + different from the wchar_t encoding. */ + if (wc != WEOF) + return UCS_FUNC (wc); + else + return wc; +# endif + +#elif _GL_SMALL_WCHAR_T /* Cygwin, mingw, MSVC */ + /* The wchar_t encoding is UTF-16. + The char32_t encoding is UCS-4. */ + +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, in the UTF-8 locale, towlower and towupper are + lacking (at least) the mappings for ISO-8859-1 characters, such as + 0x00C9 <-> 0x00E9. Since it is expensive to test whether the locale + encoding is UTF-8, ignore the system's WCHAR_FUNC altogether. */ + if (wc != WEOF) + return UCS_FUNC (wc); + else + return wc; +# else + if (wc == WEOF || wc == (wchar_t) wc) + /* wc is in the range for the tow* functions. */ + return WCHAR_FUNC (wc); + else + return UCS_FUNC (wc); +# endif + +#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */ + /* char32_t and wchar_t are equivalent. */ + static_assert (sizeof (char32_t) == sizeof (wchar_t)); + +# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION + return UCS_FUNC (wc); +# else + return WCHAR_FUNC (wc); +# endif +#endif +} 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 @@ +/* Map a 32-bit wide character to lowercase. + Copyright (C) 2023-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define IN_C32TOLOWER +/* Specification. */ +#include + +#define FUNC c32tolower +#define WCHAR_FUNC towlower +#define UCS_FUNC uc_tolower +#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 @@ +/* Determine the number of screen columns needed for a 32-bit wide character. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2023. */ + +#include + +#define IN_C32WIDTH +/* Specification. */ +#include + +#include + +#ifdef __CYGWIN__ +# include +#endif + +#if GNULIB_defined_mbstate_t +# include "streq.h" +#endif + +#include "localcharset.h" + +#if GL_CHAR32_T_IS_UNICODE +# include "lc-charset-unicode.h" +#endif + +#include "uniwidth.h" + +#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t +_GL_EXTERN_INLINE +#endif +int +c32width (char32_t wc) +{ + /* The char32_t encoding of a multibyte character is defined by the way + mbrtoc32() is defined. */ + +#if GNULIB_defined_mbstate_t /* AIX, IRIX */ + /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales + and directly for the UTF-8 locales. */ + const char *encoding = locale_charset (); + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + return uc_width (wc, encoding); + else + return wcwidth (wc); + +#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */ + /* mbrtoc32() is essentially defined by the system libc. */ + +# if _GL_WCHAR_T_IS_UCS4 + /* The char32_t encoding of a multibyte character is known to be the same as + the wchar_t encoding. */ + return wcwidth (wc); +# else + /* The char32_t encoding of a multibyte character is known to be UCS-4, + different from the wchar_t encoding. */ + return uc_width (wc, locale_charset ()); +# endif + +#elif _GL_SMALL_WCHAR_T /* Cygwin, mingw, MSVC */ + /* The wchar_t encoding is UTF-16. + The char32_t encoding is UCS-4. */ + +# if defined __CYGWIN__ && CYGWIN_VERSION_DLL_MAJOR >= 1007 && 0 + /* As an extension to POSIX, the wcwidth() function of Cygwin >= 1.7 + supports also wc arguments outside the Unicode BMP, that is, outside + the 'wchar_t' range. See + . + But the resulting values for these characters are not of good quality. */ + return wcwidth (wc); +# else + if (wc == (wchar_t) wc) + /* wc is in the range for the wcwidth function. */ + return wcwidth (wc); + else + return uc_width (wc, locale_charset ()); +# endif + +#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */ + /* char32_t and wchar_t are equivalent. */ + static_assert (sizeof (char32_t) == sizeof (wchar_t)); + +# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION + return uc_width (wc, locale_charset ()); +# endif + return wcwidth (wc); +#endif +} 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 @@ /* calloc() function that is glibc compatible. This wrapper function is required at least on Tru64 UNIX 5.1 and mingw. - Copyright (C) 2004-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2004-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -17,17 +17,15 @@ /* written by Jim Meyering and Bruno Haible */ +/* Ensure that we call the system's calloc() below. */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Specification. */ #include #include - -#include "xalloc-oversized.h" - -/* Call the system's calloc below. */ -#undef calloc +#include /* Allocate and zero-fill an NxS-byte block of memory from the heap, even if N or S is zero. */ @@ -35,14 +33,19 @@ void * rpl_calloc (size_t n, size_t s) { +#if !HAVE_MALLOC_0_NONNULL if (n == 0 || s == 0) n = s = 1; +#endif - if (xalloc_oversized (n, s)) +#if !HAVE_MALLOC_PTRDIFF + ptrdiff_t signed_n; + if (ckd_mul (&signed_n, n, s)) { errno = ENOMEM; return NULL; } +#endif void *result = calloc (n, s); 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 @@ -/* Copyright (C) 1992-2024 Free Software Foundation, Inc. +/* Copyright (C) 1992-2025 Free Software Foundation, Inc. Copyright The GNU Toolchain Authors. This file is part of the GNU C Library. @@ -83,7 +83,7 @@ # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # else -# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) +# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4) # if __cplusplus >= 201103L # define __THROW noexcept (true) # else @@ -277,10 +277,10 @@ */ #endif -/* GCC and clang have various useful declarations that can be made with - the '__attribute__' syntax. All of the ways we use this do fine if - they are omitted for compilers that don't understand it. */ -#if !(defined __GNUC__ || defined __clang__) +/* GCC, clang, and compatible compilers have various useful declarations + that can be made with the '__attribute__' syntax. All of the ways we use + this do fine if they are omitted for compilers that don't understand it. */ +#if !(defined __GNUC__ || defined __clang__ || defined __TINYC__) # define __attribute__(xyz) /* Ignore */ #endif @@ -482,7 +482,7 @@ run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before version 2.8. */ -#if !(__GNUC_PREREQ (2,8) || defined __clang__) +#if ! (__GNUC_PREREQ (2,8) || defined __clang__ || 0x5150 <= __SUNPRO_C) # define __extension__ /* Ignore */ #endif @@ -497,7 +497,7 @@ # endif #endif -/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is +/* ISO C99 also allows declaring arrays as non-overlapping. The syntax is array_name[restrict] GCC 3.1 and clang support this. 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 @@ /* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004-2006, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 2004, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* close replacement. - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2024 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2024 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Type-safe arrays which grow dynamically. - Copyright 2021-2024 Free Software Foundation, Inc. + Copyright 2021-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* A POSIX-like . - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -133,7 +133,7 @@ /* These are intentionally the same values as the WSA* error numbers, defined in . */ -# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ +# define ESOCKTNOSUPPORT 10044 # define EPFNOSUPPORT 10046 /* not required by POSIX */ # define ESHUTDOWN 10058 /* not required by POSIX */ # define ETOOMANYREFS 10059 /* not required by POSIX */ @@ -270,10 +270,17 @@ # define GNULIB_defined_ENOTRECOVERABLE 1 # endif +/* On LynxOS, the macro EILSEQ is not defined. */ # ifndef EILSEQ # define EILSEQ 2015 # define GNULIB_defined_EILSEQ 1 # endif +/* On Haiku, the macro ESOCKTNOSUPPORT is not defined. */ +# ifndef ESOCKTNOSUPPORT +# define ESOCKTNOSUPPORT 2016 +# define GNULIB_defined_ESOCKTNOSUPPORT 1 +# endif + #endif /* _@GUARD_PREFIX@_ERRNO_H */ #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 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 1990-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. - This file is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This file is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ /* Written by David MacKenzie . */ #if !_LIBC # include # define _GL_NO_INLINE_ERROR +# define __error_internal(status, err, fmt, args, flags) \ + verror (status, err, fmt, args) +# define __error_at_line_internal(status, err, file, line, fmt, args, flags) \ + verror_at_line (status, err, file, line, fmt, args) +# define error_tail(status, err, fmt, args, flags) \ + error_tail (status, err, fmt, args) #endif #include @@ -31,7 +38,7 @@ #if !_LIBC && ENABLE_NLS # include "gettext.h" -# define _(msgid) gettext (msgid) +# define _(msgid) dgettext ("gnulib", msgid) #endif #ifdef _LIBC @@ -85,7 +92,7 @@ extern void __error_at_line (int status, int errnum, const char *file_name, # undef putc # define putc(c, fp) _IO_putc (c, fp) -# include +# include #else /* not _LIBC */ @@ -123,6 +130,13 @@ int strerror_r (int errnum, char *buf, size_t buflen); # if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r # endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */ + +# if GNULIB_defined_verror +# undef verror +# endif +# if GNULIB_defined_verror_at_line +# undef verror_at_line +# endif #endif /* not _LIBC */ #if !_LIBC @@ -151,8 +165,8 @@ flush_stdout (void) #if !_LIBC int stdout_fd; -# if GNULIB_FREOPEN_SAFER - /* Use of gnulib's freopen-safer module normally ensures that +# if GNULIB_FREOPEN_SAFER || GNULIB_XSTDOPEN + /* Gnulib's freopen-safer and/or xstdopen modules normally ensure that fileno (stdout) == 1 whenever stdout is open. */ stdout_fd = STDOUT_FILENO; @@ -183,7 +197,7 @@ print_errno_message (int errnum) if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) s = errbuf; else - s = 0; + s = NULL; # endif #else s = strerror (errnum); @@ -202,75 +216,18 @@ print_errno_message (int errnum) } static void _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3)) -error_tail (int status, int errnum, const char *message, va_list args) +error_tail (int status, int errnum, const char *message, va_list args, + unsigned int mode_flags) { #if _LIBC - if (_IO_fwide (stderr, 0) > 0) - { - size_t len = strlen (message) + 1; - wchar_t *wmessage = NULL; - mbstate_t st; - size_t res; - const char *tmp; - bool use_malloc = false; - - while (1) - { - if (__libc_use_alloca (len * sizeof (wchar_t))) - wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); - else - { - if (!use_malloc) - wmessage = NULL; - - wchar_t *p = (wchar_t *) realloc (wmessage, - len * sizeof (wchar_t)); - if (p == NULL) - { - free (wmessage); - fputws_unlocked (L"out of memory\n", stderr); - return; - } - wmessage = p; - use_malloc = true; - } - - memset (&st, '\0', sizeof (st)); - tmp = message; - - res = mbsrtowcs (wmessage, &tmp, len, &st); - if (res != len) - break; - - if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0)) - { - /* This really should not happen if everything is fine. */ - res = (size_t) -1; - break; - } - - len *= 2; - } - - if (res == (size_t) -1) - { - /* The string cannot be converted. */ - if (use_malloc) - { - free (wmessage); - use_malloc = false; - } - wmessage = (wchar_t *) L"???"; - } - - __vfwprintf (stderr, wmessage, args); - - if (use_malloc) - free (wmessage); - } - else + int ret = __vfxprintf (stderr, message, args, mode_flags); + if (ret < 0 && errno == ENOMEM && _IO_fwide (stderr, 0) > 0) + /* Leave a trace in case the heap allocation of the message string + failed. */ + fputws_unlocked (L"out of memory\n", stderr); +#else + vfprintf (stderr, message, args); #endif - vfprintf (stderr, message, args); ++error_message_count; if (errnum) @@ -291,16 +248,14 @@ error_tail (int status, int errnum, const char *message, va_list args) If ERRNUM is nonzero, print its corresponding system error message. Exit with status STATUS if it is nonzero. */ void -error (int status, int errnum, const char *message, ...) +__error_internal (int status, int errnum, const char *message, + va_list args, unsigned int mode_flags) { - va_list args; - -#if defined _LIBC && defined __libc_ptf_call +#if defined _LIBC /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; - __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); + __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state); #endif flush_stdout (); @@ -318,28 +273,32 @@ error (int status, int errnum, const char *message, ...) #endif } - va_start (args, message); - error_tail (status, errnum, message, args); - va_end (args); + error_tail (status, errnum, message, args, mode_flags); #ifdef _LIBC _IO_funlockfile (stderr); -# ifdef __libc_ptf_call - __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); -# endif + __pthread_setcancelstate (state, NULL); #endif } + +void +error (int status, int errnum, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + __error_internal (status, errnum, message, ap, 0); + va_end (ap); +} /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ int error_one_per_line; void -error_at_line (int status, int errnum, const char *file_name, - unsigned int line_number, const char *message, ...) +__error_at_line_internal (int status, int errnum, const char *file_name, + unsigned int line_number, const char *message, + va_list args, unsigned int mode_flags) { - va_list args; - if (error_one_per_line) { static const char *old_file_name; @@ -358,12 +317,11 @@ error_at_line (int status, int errnum, const char *file_name, old_line_number = line_number; } -#if defined _LIBC && defined __libc_ptf_call +#if defined _LIBC /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; - __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); + __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state); #endif flush_stdout (); @@ -389,18 +347,25 @@ error_at_line (int status, int errnum, const char *file_name, file_name, line_number); #endif - va_start (args, message); - error_tail (status, errnum, message, args); - va_end (args); + error_tail (status, errnum, message, args, mode_flags); #ifdef _LIBC _IO_funlockfile (stderr); -# ifdef __libc_ptf_call - __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); -# endif + __pthread_setcancelstate (state, NULL); #endif } +void +error_at_line (int status, int errnum, const char *file_name, + unsigned int line_number, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + __error_at_line_internal (status, errnum, file_name, line_number, + message, ap, 0); + va_end (ap); +} + #ifdef _LIBC /* Make the weak alias. */ # 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 @@ /* Declarations for error-reporting functions. - Copyright (C) 1995-1997, 2003, 2006, 2008-2024 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -23,20 +23,23 @@ or error_at_line(...) invocations. */ /* The include_next requires a split double-inclusion guard. */ -#if @HAVE_ERROR_H@ +#if @HAVE_ERROR_H@ && !defined __MINGW32__ # @INCLUDE_NEXT@ @NEXT_ERROR_H@ #endif #ifndef _@GUARD_PREFIX@_ERROR_H #define _@GUARD_PREFIX@_ERROR_H -/* This file uses _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_FORMAT, - _GL_ATTRIBUTE_MAYBE_UNUSED. */ +/* This file uses _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_COLD, + _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_MAYBE_UNUSED. */ #if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif -/* Get 'unreachable'. */ +/* Get va_list. */ +#include + +/* Get 'gl_unreachable'. */ #include /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */ @@ -54,11 +57,11 @@ It evaluates its arguments only once. Test case: Compile copy-file.c with "gcc -Wimplicit-fallthrough". */ #if defined __GNUC__ || defined __clang__ -/* Use 'unreachable' to tell the compiler when the function call does not +/* Use 'gl_unreachable' to tell the compiler when the function call does not return. */ # define __gl_error_call1(function, status, ...) \ ((function) (status, __VA_ARGS__), \ - (status) != 0 ? unreachable () : (void) 0) + (status) != 0 ? gl_unreachable () : (void) 0) /* If STATUS is a not a constant, the function call may or may not return; therefore -Wimplicit-fallthrough will produce a warning. Use a compound statement in order to evaluate STATUS only once. @@ -92,7 +95,8 @@ extern "C" { # define error rpl_error # endif _GL_FUNCDECL_RPL (error, void, - (int __status, int __errnum, const char *__format, ...) + (int __status, int __errnum, const char *__format, ...), + _GL_ATTRIBUTE_COLD _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))); _GL_CXXALIAS_RPL (error, void, (int __status, int __errnum, const char *__format, ...)); @@ -104,7 +108,8 @@ _GL_CXXALIAS_RPL (error, void, #else # if ! @HAVE_ERROR@ _GL_FUNCDECL_SYS (error, void, - (int __status, int __errnum, const char *__format, ...) + (int __status, int __errnum, const char *__format, ...), + _GL_ATTRIBUTE_COLD _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))); # endif _GL_CXXALIAS_SYS (error, void, @@ -117,7 +122,7 @@ _GL_CXXALIAS_SYS (error, void, # pragma GCC diagnostic ignored "-Wattributes" _GL_ATTRIBUTE_MAYBE_UNUSED static void -_GL_ATTRIBUTE_ALWAYS_INLINE +_GL_ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_COLD _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)) _gl_inline_error (int __status, int __errnum, const char *__format, ...) { @@ -147,7 +152,8 @@ _GL_CXXALIASWARN (error); # endif _GL_FUNCDECL_RPL (error_at_line, void, (int __status, int __errnum, const char *__filename, - unsigned int __lineno, const char *__format, ...) + unsigned int __lineno, const char *__format, ...), + _GL_ATTRIBUTE_COLD _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))); _GL_CXXALIAS_RPL (error_at_line, void, (int __status, int __errnum, const char *__filename, @@ -161,7 +167,8 @@ _GL_CXXALIAS_RPL (error_at_line, void, # if ! @HAVE_ERROR_AT_LINE@ _GL_FUNCDECL_SYS (error_at_line, void, (int __status, int __errnum, const char *__filename, - unsigned int __lineno, const char *__format, ...) + unsigned int __lineno, const char *__format, ...), + _GL_ATTRIBUTE_COLD _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))); # endif _GL_CXXALIAS_SYS (error_at_line, void, @@ -175,7 +182,7 @@ _GL_CXXALIAS_SYS (error_at_line, void, # pragma GCC diagnostic ignored "-Wattributes" _GL_ATTRIBUTE_MAYBE_UNUSED static void -_GL_ATTRIBUTE_ALWAYS_INLINE +_GL_ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_COLD _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)) _gl_inline_error_at_line (int __status, int __errnum, const char *__filename, unsigned int __lineno, const char *__format, ...) @@ -196,6 +203,44 @@ _gl_inline_error_at_line (int __status, int __errnum, const char *__filename, #endif _GL_CXXALIASWARN (error_at_line); +/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with 'exit (STATUS)'. + Use the globals error_print_progname and error_message_count similarly + to error(). */ + +extern void verror (int __status, int __errnum, const char *__format, + va_list __args) + _GL_ATTRIBUTE_COLD + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 0)); +#ifndef _GL_NO_INLINE_ERROR +# ifndef verror +# define verror(status, ...) \ + __gl_error_call (verror, status, __VA_ARGS__) +# define GNULIB_defined_verror 1 +# endif +#endif + +/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with 'exit (STATUS)'. + If FNAME is not NULL, prepend the message with "FNAME:LINENO:". + Use the globals error_print_progname, error_message_count, and + error_one_per_line similarly to error_at_line(). */ + +extern void verror_at_line (int __status, int __errnum, const char *__fname, + unsigned int __lineno, const char *__format, + va_list __args) + _GL_ATTRIBUTE_COLD + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 5, 0)); +#ifdef _GL_NO_INLINE_ERROR +# ifndef verror_at_line +# define verror_at_line(status, ...) \ + __gl_error_call (verror_at_line, status, __VA_ARGS__) +# define GNULIB_defined_verror_at_line 1 +# endif +#endif + /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this 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 @@ /* Failure exit status - Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Failure exit status - Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Provide file descriptor control. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -29,8 +29,7 @@ #include #ifdef __KLIBC__ -# define INCL_DOS -# include +# include #endif #if defined _WIN32 && ! defined __CYGWIN__ @@ -562,7 +561,8 @@ klibc_fcntl (int fd, int action, /* arg */...) if (result == -1 && (errno == EPERM || errno == ENOTSUP) && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) { - ULONG ulMode; + PLIBCFH pFH; + unsigned fFlags; switch (action) { @@ -574,34 +574,41 @@ klibc_fcntl (int fd, int action, /* arg */...) result = dup2 (fd, arg); break; - /* Using underlying APIs is right ? */ case F_GETFD: - if (DosQueryFHState (fd, &ulMode)) - break; + pFH = __libc_FH (fd); + if (!pFH) + { + errno = EBADF; + break; + } - result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; + result = (pFH->fFlags & ((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT ) + | O_NOINHERIT)) ? FD_CLOEXEC : 0; break; case F_SETFD: if (arg & ~FD_CLOEXEC) break; - if (DosQueryFHState (fd, &ulMode)) - break; + pFH = __libc_FH (fd); + if (!pFH) + { + errno = EBADF; + break; + } + fFlags = pFH->fFlags; if (arg & FD_CLOEXEC) - ulMode |= OPEN_FLAGS_NOINHERIT; + fFlags |= (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT; else - ulMode &= ~OPEN_FLAGS_NOINHERIT; - - /* Filter supported flags. */ - ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR - | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); + fFlags &= ~((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT); - if (DosSetFHState (fd, ulMode)) - break; - - result = 0; + result = __libc_FHSetFlags (pFH, fd, fFlags); + if (result < 0) + { + errno = -result; + result = -1; + } break; 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 @@ /* Like , but with non-working flags defined to 0. - Copyright (C) 2006-2024 Free Software Foundation, Inc. + Copyright (C) 2006-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -22,8 +22,12 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_system_fcntl_h -/* Special invocation convention. */ +#if defined __need_system_fcntl_h || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H +/* Special invocation convention: + - On Haiku we have a sequence of nested includes + -> -> + In this situation, GNULIB_defined_O_NONBLOCK gets defined before the + system's definition of O_NONBLOCK is processed. */ /* Needed before . May also define off_t to a 64-bit type on native Windows. */ @@ -50,8 +54,11 @@ #ifndef _@GUARD_PREFIX@_FCNTL_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H + /* Needed before . - May also define off_t to a 64-bit type on native Windows. */ + May also define off_t to a 64-bit type on native Windows. + Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ #include /* On some systems other than glibc, is a prerequisite of . On glibc systems, we would like to avoid namespace pollution. @@ -71,6 +78,8 @@ # include #endif +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H + #ifndef _@GUARD_PREFIX@_FCNTL_H #define _@GUARD_PREFIX@_FCNTL_H @@ -99,7 +108,7 @@ # undef creat # define creat rpl_creat # endif -_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) +_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); # elif defined _WIN32 && !defined __CYGWIN__ @@ -140,14 +149,14 @@ _GL_CXXALIASWARN (creat); # undef fcntl # define fcntl rpl_fcntl # endif -_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); +_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...), ); _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); # if !GNULIB_defined_rpl_fcntl # define GNULIB_defined_rpl_fcntl 1 # endif # else # if !@HAVE_FCNTL@ -_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); +_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...), ); # if !GNULIB_defined_fcntl # define GNULIB_defined_fcntl 1 # endif @@ -169,7 +178,7 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " # undef open # define open rpl_open # endif -_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) +_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); # elif defined _WIN32 && !defined __CYGWIN__ @@ -200,7 +209,9 @@ _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " # undef open # define open _open # endif -_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); +/* Need to cast, because in MSVC the parameter list of _open as a C++ function + is (const char *, int, int = 0). */ +_GL_CXXALIAS_MDA_CAST (open, int, (const char *filename, int flags, ...)); # else _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); # endif @@ -216,14 +227,14 @@ _GL_CXXALIASWARN (open); # define openat rpl_openat # endif _GL_FUNCDECL_RPL (openat, int, - (int fd, char const *file, int flags, /* mode_t mode */ ...) + (int fd, char const *file, int flags, /* mode_t mode */ ...), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (openat, int, (int fd, char const *file, int flags, /* mode_t mode */ ...)); # else # if !@HAVE_OPENAT@ _GL_FUNCDECL_SYS (openat, int, - (int fd, char const *file, int flags, /* mode_t mode */ ...) + (int fd, char const *file, int flags, /* mode_t mode */ ...), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (openat, int, @@ -304,7 +315,7 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " #endif #ifndef O_DIRECTORY -# define O_DIRECTORY 0 +# define O_DIRECTORY 0x20000000 /* Try to not collide with system O_* flags. */ #endif #ifndef O_DSYNC @@ -368,8 +379,12 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # define O_RSYNC 0 #endif +#if defined O_SEARCH && defined O_PATH && O_SEARCH == O_PATH +# undef O_SEARCH /* musl mistakenly #defines O_SEARCH to O_PATH. */ +#endif + #ifndef O_SEARCH -# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ +# define O_SEARCH O_RDONLY /* Often close enough in non-POSIX systems. */ #endif #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 @@ /* Hook for making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2009. 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 @@ /* Hook for making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* fflush.c -- allow flushing input streams - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -33,12 +33,15 @@ #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ +# if !defined __HAIKU__ +# define fp_ fp +# endif /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ static void clear_ungetc_buffer_preserving_position (FILE *fp) { - if (fp->_flags & _IO_IN_BACKUP) + if (fp_->_flags & _IO_IN_BACKUP) /* _IO_free_backup_area is a bit complicated. Simply call fseek. */ fseeko (fp, 0, SEEK_CUR); } @@ -50,7 +53,7 @@ static void clear_ungetc_buffer (FILE *fp) { # if defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ if (HASUB (fp)) { fp_->_p += fp_->_r; @@ -75,7 +78,7 @@ clear_ungetc_buffer (FILE *fp) /* GNU libc, BeOS, Haiku, Linux libc5 */ # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT -/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ +/* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ static int disable_seek_optimization (FILE *fp) @@ -98,7 +101,7 @@ update_fpos_cache (_GL_ATTRIBUTE_MAYBE_UNUSED FILE *fp, _GL_ATTRIBUTE_MAYBE_UNUSED off_t pos) { # if defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __CYGWIN__ || defined __ANDROID__ /* fp_->_offset is typed as an integer. */ fp_->_offset = pos; @@ -203,7 +206,7 @@ rpl_fflush (FILE *stream) } # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ { /* 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 @@ /* Basic filename support macros. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Supplemental information about the floating-point formats. - Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2007. 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 @@ /* Auxiliary definitions for . - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. This file is free software: you can redistribute it and/or modify @@ -20,14 +20,101 @@ /* Specification. */ #include -#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ +#if GNULIB_defined_long_double_union +# if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ const union gl_long_double_union gl_LDBL_MAX = - { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } }; -#elif defined __i386__ + { { DBL_MAX, DBL_MAX / 0x1p53 } }; +# elif defined __i386__ const union gl_long_double_union gl_LDBL_MAX = { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } }; -#else +# endif +# if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) +/* We can't even simply evaluate the formula (LDBL_MIN / 9223372036854775808.0L) + at run time, because it would require BEGIN_LONG_DOUBLE_ROUNDING / + END_LONG_DOUBLE_ROUNDING invocations. It simpler to just write down the + representation of LDBL_TRUE_MIN, based on + . */ +const union gl_long_double_union gl_LDBL_TRUE_MIN = + { { 0x00000001, 0x00000000, 0 } }; +# endif +#endif + +#if GNULIB_defined_FLT_SNAN +/* Define like memory_positive_SNaNf(), see signed-snan.h and snan.h, + or like setpayloadsigf() with an arbitrary payload. */ +gl_FLT_SNAN_t gl_FLT_SNAN = +# if FLT_MANT_DIG == 24 +# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__ + /* sign bit: 0, 8 exponent bits: all 1, next bit: 1, payload: 0b10...0 */ + { { 0x7FE00000U } } +# else + /* sign bit: 0, 8 exponent bits: all 1, next bit: 0, payload: 0b10...0 */ + { { 0x7FA00000U } } +# endif +# endif + ; +#endif + +#if GNULIB_defined_DBL_SNAN +/* Define like memory_positive_SNaNd(), see signed-snan.h and snan.h, + or like setpayloadsig() with an arbitrary payload. */ +gl_DBL_SNAN_t gl_DBL_SNAN = +# if DBL_MANT_DIG == 53 +# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__ + /* sign bit: 0, 11 exponent bits: all 1, next bit: 1, payload: 0b10...0 */ + { { 0x7FFC000000000000ULL } } +# else + /* sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0 */ + { { 0x7FF4000000000000ULL } } +# endif +# endif + ; +#endif + +#if GNULIB_defined_LDBL_SNAN +# ifdef WORDS_BIGENDIAN +# define TWO(hi,lo) { hi, lo } +# else +# define TWO(hi,lo) { lo, hi } +# endif +/* Define like memory_positive_SNaNl(), see signed-snan.h and snan.h, + or like setpayloadsigl() with an arbitrary payload. */ +gl_LDBL_SNAN_t gl_LDBL_SNAN = +# if LDBL_MANT_DIG == 53 /* on arm, hppa, mips, sh, but also MSVC */ +# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__ + /* sign bit: 0, 11 exponent bits: all 1, next bit: 1, payload: 0b10...0 */ + { { 0x7FFC000000000000ULL } } +# else + /* sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0 */ + { { 0x7FF4000000000000ULL } } +# endif +# elif LDBL_MANT_DIG == 64 /* on i386, x86_64, ia64, m68k */ +# if defined __m68k__ + /* sign bit: 0, 15 exponent bits: all 1, 16 gap bits: all 0, + always=1 bit: 1, next bit: 0, payload: 0b10...0 */ + { { 0x7FFF0000ULL, 0xA0000000ULL, 0x00000000ULL } } +# else + /* sign bit: 0, 15 exponent bits: all 1, always=1 bit: 1, next bit: 0, payload: 0b10...0 + (see ) */ + { TWO (0x00007FFFULL, 0xA000000000000000ULL) } +# endif +# elif LDBL_MANT_DIG == 106 /* on powerpc, powerpc64, powerpc64le */ + /* most-significant double: + sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0, + least-significant double: 0.0 */ + { { 0x7FF4000000000000ULL, 0ULL } } +# elif LDBL_MANT_DIG == 113 /* on alpha, arm64, loongarch64, mips64, riscv64, s390x, sparc64 */ +# if (defined __mips__ && !MIPS_NAN2008_FLOAT) + /* sign bit: 0, 15 exponent bits: all 1, next bit: 1, payload: 0b10...0 */ + { TWO (0x7FFFC00000000000ULL, 0ULL) } +# else + /* sign bit: 0, 15 exponent bits: all 1, next bit: 0, payload: 0b10...0 */ + { TWO (0x7FFF400000000000ULL, 0ULL) } +# endif +# endif + ; +#endif + /* This declaration is solely to ensure that after preprocessing this file is never empty. */ typedef int dummy; -#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 @@ /* A correct . - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -28,6 +28,8 @@ #ifndef _@GUARD_PREFIX@_FLOAT_H #define _@GUARD_PREFIX@_FLOAT_H +/* ============================ ISO C99 support ============================ */ + /* 'long double' properties. */ #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) @@ -111,44 +113,38 @@ extern const union gl_long_double_union gl_LDBL_MAX; # define LDBL_MAX_10_EXP 4932 #endif -/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are - wrong. - On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */ -#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ +/* On PowerPC with gcc 15 when using __ibm128 long double, the value of + LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX, and LDBL_NORM_MAX are wrong. */ +#if (defined _ARCH_PPC && LDBL_MANT_DIG == 106 \ + && defined __GNUC__) # undef LDBL_MIN_EXP # define LDBL_MIN_EXP DBL_MIN_EXP # undef LDBL_MIN_10_EXP # define LDBL_MIN_10_EXP DBL_MIN_10_EXP # undef LDBL_MIN # define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ -#endif -#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ # undef LDBL_MAX -/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }. - It is not easy to define: - #define LDBL_MAX 1.79769313486231580793728971405302307166e308L - is too small, whereas - #define LDBL_MAX 1.79769313486231580793728971405302307167e308L - is too large. Apparently a bug in GCC decimal-to-binary conversion. - Also, I can't get values larger than - #define LDBL63 ((long double) (1ULL << 63)) - #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) - #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) - #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) - #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL) - which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }. - So, define it like this through a reference to an external variable +/* LDBL_MAX is 2**1024 - 2**918, represented as: { 0x7FEFFFFF, 0xFFFFFFFF, + 0x7C9FFFFF, 0xFFFFFFFF }. + + Do not write it as a constant expression, as GCC would likely treat + that as infinity due to the vagaries of this platform's funky arithmetic. + Instead, define it through a reference to an external variable. + Like the following, but using a union to avoid type mismatches: - const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }; + const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / 0x1p53 }; extern const long double LDBL_MAX; - or through a pointer cast + The following alternative would not work as well when GCC is optimizing: - #define LDBL_MAX \ - (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }) + #define LDBL_MAX (*(long double const *) (double[]) + { DBL_MAX, DBL_MAX / 0x1p53 }) - Unfortunately, this is not a constant expression, and the latter expression - does not work well when GCC is optimizing.. */ + The following alternative would require GCC 6 or later: + + #define LDBL_MAX __builtin_pack_longdouble (DBL_MAX, DBL_MAX / 0x1p53) + + Unfortunately none of the alternatives are constant expressions. */ # if !GNULIB_defined_long_double_union union gl_long_double_union { @@ -159,6 +155,8 @@ union gl_long_double_union # endif extern const union gl_long_double_union gl_LDBL_MAX; # define LDBL_MAX (gl_LDBL_MAX.ld) +# undef LDBL_NORM_MAX +# define LDBL_NORM_MAX LDBL_MAX #endif /* 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; # endif #endif +/* On PowerPC platforms, 'long double' has a double-double representation. + Up to ISO C 17, this was outside the scope of ISO C because it can represent + numbers with mantissas of the form 1.<52 bits><52 bits>, such as + 1.0L + 4.94065645841246544176568792868221e-324L = 1 + 2^-1074; see + ISO C 17 § 5.2.4.2.2.(3). + In ISO C 23, wording has been included that makes this 'long double' + representation compliant; see ISO C 23 § 5.2.5.3.3.(8)-(9). In this setting, + numbers with mantissas of the form 1.<52 bits><52 bits> are + called "unnormalized". And since LDBL_EPSILON must be normalized (per + ISO C 23 § 5.2.5.3.3.(33)), it must be 2^-105. */ +#if defined __powerpc__ && LDBL_MANT_DIG == 106 +# undef LDBL_EPSILON +# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ +#endif + +/* ============================ ISO C11 support ============================ */ + +/* 'float' properties */ + +#ifndef FLT_HAS_SUBNORM +# define FLT_HAS_SUBNORM 1 +#endif +#ifndef FLT_DECIMAL_DIG +/* FLT_MANT_DIG = 24 => FLT_DECIMAL_DIG = 9 */ +# define FLT_DECIMAL_DIG ((int)(FLT_MANT_DIG * 0.3010299956639812 + 2)) +#endif +#if defined _AIX && !defined __GNUC__ +/* On AIX, the value of FLT_TRUE_MIN in /usr/include/float.h is a 'double', + not a 'float'. */ +# undef FLT_TRUE_MIN +#endif +#ifndef FLT_TRUE_MIN +/* FLT_MIN / 2^(FLT_MANT_DIG-1) */ +# define FLT_TRUE_MIN (FLT_MIN / 8388608.0f) +#endif + +/* 'double' properties */ + +#ifndef DBL_HAS_SUBNORM +# define DBL_HAS_SUBNORM 1 +#endif +#ifndef DBL_DECIMAL_DIG +/* DBL_MANT_DIG = 53 => DBL_DECIMAL_DIG = 17 */ +# define DBL_DECIMAL_DIG ((int)(DBL_MANT_DIG * 0.3010299956639812 + 2)) +#endif +#ifndef DBL_TRUE_MIN +/* DBL_MIN / 2^(DBL_MANT_DIG-1) */ +# define DBL_TRUE_MIN (DBL_MIN / 4503599627370496.0) +#endif + +/* 'long double' properties */ + +#ifndef LDBL_HAS_SUBNORM +# define LDBL_HAS_SUBNORM 1 +#endif +#ifndef LDBL_DECIMAL_DIG +/* LDBL_MANT_DIG = 53 => LDBL_DECIMAL_DIG = 17 */ +/* LDBL_MANT_DIG = 64 => LDBL_DECIMAL_DIG = 21 */ +/* LDBL_MANT_DIG = 106 => LDBL_DECIMAL_DIG = 33 */ +/* LDBL_MANT_DIG = 113 => LDBL_DECIMAL_DIG = 36 */ +# define LDBL_DECIMAL_DIG ((int)(LDBL_MANT_DIG * 0.3010299956639812 + 2)) +#endif +#ifndef LDBL_TRUE_MIN +/* LDBL_MIN / 2^(LDBL_MANT_DIG-1) */ +# if LDBL_MANT_DIG == 53 +# define LDBL_TRUE_MIN (LDBL_MIN / 4503599627370496.0L) +# elif LDBL_MANT_DIG == 64 +# if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__) +/* Work around FreeBSD/x86 problem mentioned above. */ +extern const union gl_long_double_union gl_LDBL_TRUE_MIN; +# define LDBL_TRUE_MIN (gl_LDBL_TRUE_MIN.ld) +# else +# define LDBL_TRUE_MIN (LDBL_MIN / 9223372036854775808.0L) +# endif +# elif LDBL_MANT_DIG == 106 +# define LDBL_TRUE_MIN (LDBL_MIN / 40564819207303340847894502572032.0L) +# elif LDBL_MANT_DIG == 113 +# define LDBL_TRUE_MIN (LDBL_MIN / 5192296858534827628530496329220096.0L) +# endif +#endif + +/* ============================ ISO C23 support ============================ */ + +/* 'float' properties */ + +#ifndef FLT_IS_IEC_60559 +# if defined __m68k__ +# define FLT_IS_IEC_60559 0 +# else +# define FLT_IS_IEC_60559 1 +# endif +#endif +#ifndef FLT_NORM_MAX +# define FLT_NORM_MAX FLT_MAX +#endif +#ifndef FLT_SNAN +/* For sh, beware of . */ +# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ +# define FLT_SNAN __builtin_nansf ("") +# else +typedef union { unsigned int word[1]; float value; } gl_FLT_SNAN_t; +extern gl_FLT_SNAN_t gl_FLT_SNAN; +# define FLT_SNAN (gl_FLT_SNAN.value) +# define GNULIB_defined_FLT_SNAN 1 +# endif +#endif + +/* 'double' properties */ + +#ifndef DBL_IS_IEC_60559 +# if defined __m68k__ +# define DBL_IS_IEC_60559 0 +# else +# define DBL_IS_IEC_60559 1 +# endif +#endif +#ifndef DBL_NORM_MAX +# define DBL_NORM_MAX DBL_MAX +#endif +#ifndef DBL_SNAN +/* For sh, beware of . */ +# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ +# define DBL_SNAN __builtin_nans ("") +# else +typedef union { unsigned long long word[1]; double value; } gl_DBL_SNAN_t; +extern gl_DBL_SNAN_t gl_DBL_SNAN; +# define DBL_SNAN (gl_DBL_SNAN.value) +# define GNULIB_defined_DBL_SNAN 1 +# endif +#endif + +/* 'long double' properties */ + +#ifndef LDBL_IS_IEC_60559 +# if defined __m68k__ +# define LDBL_IS_IEC_60559 0 +# elif LDBL_MANT_DIG == 53 || LDBL_MANT_DIG == 113 +# define LDBL_IS_IEC_60559 1 +# else +# define LDBL_IS_IEC_60559 0 +# endif +#endif +#ifndef LDBL_NORM_MAX +# ifdef __LDBL_NORM_MAX__ +# define LDBL_NORM_MAX __LDBL_NORM_MAX__ +# else +# define LDBL_NORM_MAX LDBL_MAX +# endif +#endif +#ifndef LDBL_SNAN +/* For sh, beware of . */ +# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__ +# define LDBL_SNAN __builtin_nansl ("") +# else +# if LDBL_MANT_DIG == 53 +typedef union { unsigned long long word[1]; long double value; } gl_LDBL_SNAN_t; +# elif defined __m68k__ +typedef union { unsigned int word[3]; long double value; } gl_LDBL_SNAN_t; +# else +typedef union { unsigned long long word[2]; long double value; } gl_LDBL_SNAN_t; +# endif +extern gl_LDBL_SNAN_t gl_LDBL_SNAN; +# define LDBL_SNAN (gl_LDBL_SNAN.value) +# define GNULIB_defined_LDBL_SNAN 1 +# endif +#endif + +/* ================================= Other ================================= */ + #if @REPLACE_ITOLD@ /* Pull in a function that fixes the 'int' to 'long double' conversion 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 @@ /* Round towards negative infinity. - Copyright (C) 2007, 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2007, 2010-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Round towards negative infinity. - Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Open a stream to a file. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -19,12 +19,12 @@ /* If the user's config.h happens to include , let it include only the system's here, so that orig_fopen doesn't recurse to rpl_fopen. */ -#define _GL_ALREADY_INCLUDING_STDIO_H +#define _GL_SKIP_GNULIB_STDIO_H #include /* Get the original definition of fopen. It might be defined as a macro. */ #include -#undef _GL_ALREADY_INCLUDING_STDIO_H +#undef _GL_SKIP_GNULIB_STDIO_H static FILE * orig_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 @@ /* Flushing buffers of a FILE stream. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -37,7 +37,7 @@ fpurge (FILE *fp) /* The __fpurge function does not have a return value. */ return 0; -#elif HAVE_FPURGE /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin >= 1.7 */ +#elif HAVE_FPURGE /* FreeBSD, NetBSD, 2.0 <= OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin >= 1.7 */ /* Call the system's fpurge function. */ # undef fpurge @@ -46,7 +46,7 @@ fpurge (FILE *fp) # endif int result = fpurge (fp); # if defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ if (result == 0) /* Correct the invariants that fpurge broke. on BSD systems says: @@ -76,7 +76,7 @@ fpurge (FILE *fp) } return 0; # elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD < 2.0, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ fp_->_p = fp_->_bf._base; fp_->_r = 0; 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 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -25,6 +25,10 @@ */ #if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))) +/* This code is not compiled on systems that have a working __freading function, + namely glibc >= 2.7, OpenBSD >= 7.6, Solaris >= 7, UnixWare >= 7.1.4.MP4, + Cygwin >= 1.7.34, Android API >= 28, musl libc, Haiku >= hrev58760. */ + bool freading (FILE *fp) { @@ -37,7 +41,7 @@ freading (FILE *fp) || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 && fp->_IO_read_base != NULL)); # elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD < 7.6, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ return (fp_->_flags & __SRD) != 0; # elif defined __EMX__ /* emx+gcc */ 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 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Make free() preserve errno. - Copyright (C) 2003, 2006, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2003, 2006, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* An fseek() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* An fseeko() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -48,12 +48,15 @@ fseeko (FILE *fp, off_t offset, int whence) /* These tests are based on fpurge.c. */ #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 +# if !defined __HAIKU__ +# define fp_ fp +# endif /* GNU libc, BeOS, Haiku, Linux libc5 */ - if (fp->_IO_read_end == fp->_IO_read_ptr - && fp->_IO_write_ptr == fp->_IO_write_base - && fp->_IO_save_base == NULL) + if (fp_->_IO_read_end == fp_->_IO_read_ptr + && fp_->_IO_write_ptr == fp_->_IO_write_base + && fp_->_IO_save_base == NULL) #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __SL64 && defined __SCLE /* Cygwin */ if ((fp->_flags & __SL64) == 0) { @@ -101,6 +104,9 @@ fseeko (FILE *fp, off_t offset, int whence) #elif defined EPLAN9 /* Plan9 */ if (fp->rp == fp->buf && fp->wp == fp->buf) +#elif defined __OpenBSD__ && !defined __sferror /* OpenBSD >= 7.8 */ + /* fseeko and fflush work as advertised. */ + if (0) #elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION /* Cross-compiling to some other system advertising conformance to POSIX.1-2008 or later. Assume fseeko and fflush work as advertised. @@ -118,7 +124,7 @@ fseeko (FILE *fp, off_t offset, int whence) if (pos == -1) { #if defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ fp_->_flags &= ~__SOFF; #endif return -1; @@ -126,10 +132,10 @@ fseeko (FILE *fp, off_t offset, int whence) #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - fp->_flags &= ~_IO_EOF_SEEN; - fp->_offset = pos; + fp_->_flags &= ~_IO_EOF_SEEN; + fp_->_offset = pos; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix /* fp_->_offset is typed as an integer. */ 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 @@ +/* Set the error indicator of a stream. + Copyright (C) 2007-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "fseterr.h" + +#include + +#include "stdio-impl.h" + +/* This file is not used on systems that have the __fseterr function, + namely OpenBSD >= 7.6, musl libc, Haiku >= hrev58760. */ + +void +fseterr (FILE *fp) +{ + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_flags |= _IO_ERR_SEEN; +#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD < 7.6, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + fp_->_flags |= __SERR; +#elif defined __EMX__ /* emx+gcc */ + fp->_flags |= _IOERR; +#elif defined __minix /* Minix */ + fp->_flags |= _IOERR; +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ + fp_->_flag |= _IOERR; +#elif defined __UCLIBC__ /* uClibc */ + fp->__modeflags |= __FLAG_ERROR; +#elif defined __QNX__ /* QNX */ + fp->_Mode |= 0x200 /* _MERR */; +#elif defined __MINT__ /* Atari FreeMiNT */ + fp->__error = 1; +#elif defined EPLAN9 /* Plan9 */ + if (fp->state != 0 /* CLOSED */) + fp->state = 5 /* ERR */; +#elif 0 /* unknown */ + /* Portable fallback, based on an idea by Rich Felker. + Wow! 6 system calls for something that is just a bit operation! + Not activated on any system, because there is no way to repair FP when + the sequence of system calls fails, and library code should not call + abort(). */ + int saved_errno; + int fd; + int fd2; + + saved_errno = errno; + fflush (fp); + fd = fileno (fp); + fd2 = dup (fd); + if (fd2 >= 0) + { + close (fd); + fputc ('\0', fp); /* This should set the error indicator. */ + fflush (fp); /* Or this. */ + if (dup2 (fd2, fd) < 0) + /* Whee... we botched the stream and now cannot restore it! */ + abort (); + close (fd2); + } + errno = saved_errno; +#else + #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." +#endif +} 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 @@ +/* Set the error indicator of a stream. + Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _FSETERR_H +#define _FSETERR_H + +/* This file uses HAVE___FSETERR. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#include + +/* Set the error indicator of the stream FP. + The "error indicator" is set when an I/O operation on the stream fails, and + is cleared (together with the "end-of-file" indicator) by clearerr (FP). */ + +#if HAVE___FSETERR /* musl libc */ + +/* Haiku has __fseterr but does not declare it. */ +# if defined __HAIKU__ +extern void __fseterr (FILE *fp); +# endif + +# include +# define fseterr(fp) __fseterr (fp) + +#else + +# ifdef __cplusplus +extern "C" { +# endif + +extern void fseterr (FILE *fp); + +# ifdef __cplusplus +} +# endif + +#endif + +#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 @@ /* fstat() replacement. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* fsusage.c -- return space usage of mounted file systems - Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2024 Free Software + Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ /* fsusage.h -- declarations for file system space usage info - Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2024 Free Software + Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ /* An ftell() function that works around platform bugs. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* An ftello() function that works around platform bugs. - Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -20,7 +20,7 @@ #include #include -#include "intprops.h" +#include /* Get lseek. */ #include @@ -34,7 +34,10 @@ ftello (FILE *fp) # undef ftell # define ftello ftell #endif -#if _GL_WINDOWS_64_BIT_OFF_T +#if (defined _WIN32 && !defined __CYGWIN__) \ + /* We need to test _FILE_OFFSET_BITS for mingw-w64 */ \ + /* and _GL_WINDOWS_64_BIT_OFF_T for MSVC. */ \ + && (_FILE_OFFSET_BITS == 64 || _GL_WINDOWS_64_BIT_OFF_T) # undef ftello # if HAVE__FTELLI64 /* msvc, mingw64 */ # define ftello _ftelli64 @@ -97,7 +100,7 @@ ftello (FILE *fp) /* Compute pos + buffered, with overflow check. */ off_t sum; - if (! INT_ADD_OK (pos, buffered, &sum)) + if (ckd_add (&sum, pos, buffered)) { errno = EOVERFLOW; 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 @@ -/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2024 Free Software +/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Philip Blundell , 1997. @@ -27,8 +27,8 @@ # include #else # include "gettext.h" -# define _(String) gettext (String) -# define N_(String) String +# define _(msgid) dgettext ("gnulib", msgid) +# define N_(msgid) msgid #endif #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 @@ /* Get address information (partial implementation). - Copyright (C) 1997, 2001-2002, 2004-2024 Free Software Foundation, Inc. + Copyright (C) 1997, 2001-2002, 2004-2025 Free Software Foundation, Inc. Contributed by Simon Josefsson . This file is free software: you can redistribute it and/or modify @@ -40,8 +40,8 @@ #include #include "gettext.h" -#define _(String) gettext (String) -#define N_(String) String +#define _(msgid) dgettext ("gnulib", msgid) +#define N_(msgid) msgid /* BeOS has AF_INET, but not PF_INET. */ #ifndef PF_INET @@ -54,7 +54,7 @@ #if HAVE_GETADDRINFO -/* Override with cdecl calling convention. */ +/* Override with cdecl calling convention and mingw fix. */ int getaddrinfo (const char *restrict nodename, @@ -63,6 +63,10 @@ getaddrinfo (const char *restrict nodename, struct addrinfo **restrict res) # undef getaddrinfo { + if (hints && (hints->ai_flags & AI_NUMERICSERV) != 0 + && servname && !(*servname >= '0' && *servname <= '9')) + return EAI_NONAME; + return getaddrinfo (nodename, servname, hints, res); } @@ -169,16 +173,43 @@ validate_family (int family) { /* FIXME: Support more families. */ # if HAVE_IPV4 - if (family == PF_INET) - return true; + if (family == PF_INET) + return true; # endif # if HAVE_IPV6 - if (family == PF_INET6) - return true; + if (family == PF_INET6) + return true; # endif - if (family == PF_UNSPEC) - return true; - return false; + if (family == PF_UNSPEC) + return true; + return false; +} + +static bool +is_numeric_host (const char *host, int family) +{ +# if HAVE_IPV4 + if (family == PF_INET || family == PF_UNSPEC) + { + /* glibc supports IPv4 addresses in numbers-and-dots notation, that is, + also hexadecimal and octal number formats and formats that don't + require all four bytes to be explicitly written, via inet_aton(). + But POSIX doesn't require support for these legacy formats. Therefore + we are free to use inet_pton() instead of inet_aton(). */ + struct in_addr addr; + if (inet_pton (AF_INET, host, &addr)) + return true; + } +# endif +# if HAVE_IPV6 + if (family == PF_INET6 || family == PF_UNSPEC) + { + struct in6_addr addr; + if (inet_pton (AF_INET6, host, &addr)) + return true; + } +# endif + return false; } /* Translate name of a service location and/or a service name to set of @@ -210,10 +241,17 @@ getaddrinfo (const char *restrict nodename, # ifdef WINDOWS_NATIVE if (use_win32_p ()) - return getaddrinfo_ptr (nodename, servname, hints, res); + { + if (hints && (hints->ai_flags & AI_NUMERICSERV) != 0 + && servname && !(*servname >= '0' && *servname <= '9')) + return EAI_NONAME; + return getaddrinfo_ptr (nodename, servname, hints, res); + } # endif - if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE))) + if (hints + && (hints->ai_flags + & ~(AI_CANONNAME | AI_PASSIVE | AI_NUMERICHOST | AI_NUMERICSERV))) /* FIXME: Support more flags. */ return EAI_BADFLAGS; @@ -225,12 +263,18 @@ getaddrinfo (const char *restrict nodename, /* FIXME: Support other socktype. */ return EAI_SOCKTYPE; /* FIXME: Better return code? */ - if (!nodename) + if (nodename != NULL) + { + if (hints && (hints->ai_flags & AI_NUMERICHOST) != 0 + && !is_numeric_host (nodename, hints->ai_family)) + return EAI_NONAME; + } + else { if (!(hints->ai_flags & AI_PASSIVE)) return EAI_NONAME; -# ifdef HAVE_IPV6 +# if HAVE_IPV6 nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0"; # else 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 @@ /* getdelim.c --- Implementation of replacement getdelim function. - Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2024 Free Software + Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2025 Free Software Foundation, Inc. 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 @@ /* getdtablesize() function: Return maximum possible file descriptor value + 1. - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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 @@ /* gethostname emulation for SysV and POSIX.1. - Copyright (C) 1992, 2003, 2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 1992, 2003, 2006, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* getline.c --- Implementation of replacement getline function. - Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Get the system load averages. - Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2024 Free Software + Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2025 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with gnulib. @@ -47,8 +47,6 @@ N_NAME_POINTER The nlist n_name element is a pointer, not an array. HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'. - LINUX_LDAV_FILE [__linux__, __ANDROID__, __CYGWIN__]: File - containing load averages. Specific system predefines this file uses, aside from setting default values if not emacs: @@ -65,8 +63,7 @@ UMAX4_3 VMS _WIN32 Native Windows (possibly also defined on Cygwin) - __linux__, __ANDROID__ Linux: assumes /proc file system mounted. - Support from Michael K. Johnson. + __linux__, __ANDROID__ Linux: assumes sysinfo() call. __CYGWIN__ Cygwin emulates linux /proc/loadavg. __NetBSD__ NetBSD: assumes /kern file system mounted. @@ -108,10 +105,10 @@ # endif /* Same issues as for NeXT apply to the HURD-based GNU system. */ -# ifdef __GNU__ +# if defined __gnu_hurd__ || defined NeXT # undef BSD # undef FSCALE -# endif /* __GNU__ */ +# endif /* __gnu_hurd__ || NeXT */ /* Set values that are different from the defaults, which are set a little farther down with #ifndef. */ @@ -143,7 +140,7 @@ # define SUNOS_5 # endif -# if defined (__osf__) && (defined (__alpha) || defined (__alpha__)) +# if defined (__osf__) && defined (__alpha) # define OSF_ALPHA # include # include @@ -312,8 +309,7 @@ # endif # endif -# if defined (__GNU__) && !defined (NeXT) -/* Note that NeXT Openstep defines __GNU__ even though it should not. */ +# if defined __gnu_hurd__ && !defined NeXT /* GNU system acts much like NeXT, for load average purposes, but not exactly. */ # define NeXT @@ -358,6 +354,11 @@ # include # endif +# if defined __linux__ || defined __ANDROID__ +# include +# include +# endif + # if (defined __linux__ || defined __ANDROID__ \ || defined __CYGWIN__ || defined SUNOS_5 \ || (defined LOAD_AVE_TYPE && ! defined __VMS)) @@ -498,20 +499,33 @@ getloadavg (double loadavg[], int nelem) } # endif -# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__) - /* Linux without glibc, Android, Cygwin */ +# if (!defined LDAV_DONE \ + && (defined __ANDROID__ ? 13 <= __ANDROID_API__ : defined __linux__)) + /* non-Android Linux without glibc, Android 3.2+, Cygwin */ # define LDAV_DONE # undef LOAD_AVE_TYPE -# ifndef LINUX_LDAV_FILE -# define LINUX_LDAV_FILE "/proc/loadavg" -# endif + { + struct sysinfo info; + if (sysinfo (&info) < 0) + return -1; + loadavg[0] = info.loads[0] / (double)(1U << SI_LOAD_SHIFT); + loadavg[1] = info.loads[1] / (double)(1U << SI_LOAD_SHIFT); + loadavg[2] = info.loads[2] / (double)(1U << SI_LOAD_SHIFT); + elem = 3; + } +# endif /* __ANDROID__ ? 13 <= __ANDROID_API__ : __linux__ */ + +# if !defined (LDAV_DONE) && defined __CYGWIN__ + /* Cygwin */ +# define LDAV_DONE +# undef LOAD_AVE_TYPE char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")]; char const *ptr = ldavgbuf; int fd, count, saved_errno; - fd = open (LINUX_LDAV_FILE, O_RDONLY | O_CLOEXEC); + fd = open ("/proc/loadavg", O_RDONLY | O_CLOEXEC); if (fd == -1) return -1; count = read (fd, ldavgbuf, sizeof ldavgbuf - 1); @@ -554,7 +568,7 @@ getloadavg (double loadavg[], int nelem) return elem; -# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */ +# endif /* __CYGWIN__ */ # if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */ # 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 @@ /* getopt-on-non-glibc compatibility macros. - Copyright (C) 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1989-2025 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. @@ -46,10 +46,14 @@ # endif #endif +#if defined __clang__ + /* clang really only groks GNU C 4.2, regardless of its value of __GNUC__. */ +# undef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) ((maj) < 4 + ((min) <= 2)) +#endif #ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_VERSION__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__)) # else # define __GNUC_PREREQ(maj, min) 0 # 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 @@ /* Declarations for getopt (basic, portable features only). - Copyright (C) 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1989-2025 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. 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 @@ /* Declarations for getopt (GNU extensions). - Copyright (C) 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1989-2025 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. 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 @@ /* getopt (basic, portable features) gnulib wrapper header. - Copyright (C) 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1989-2025 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. @@ -31,6 +31,16 @@ functions and variables. Renaming avoids problems with some compilers and linkers. */ #ifdef __GETOPT_PREFIX + +/* Include platform-dependent header files that may declare getopt() and + friends. */ +# if defined _AIX || defined __hpux || defined __sun || defined __QNX__ +# include +# endif +# if defined MUSL_LIBC || (defined __FreeBSD__ || defined __DragonFly__) || defined __NetBSD__ || defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined _AIX || defined __sun || defined __minix || defined __HAIKU__ +# include +# endif + # ifndef __GETOPT_ID # define __GETOPT_CONCAT(x, y) x ## y # 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 @@ /* getopt (GNU extensions) gnulib wrapper header. - Copyright (C) 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1989-2025 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library. @@ -38,11 +38,9 @@ # endif # undef getopt_long # undef getopt_long_only -# undef option # undef _getopt_internal # define getopt_long __GETOPT_ID (getopt_long) # define getopt_long_only __GETOPT_ID (getopt_long_only) -# define option __GETOPT_ID (option) # define _getopt_internal __GETOPT_ID (getopt_internal) /* 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 @@ /* Getopt for GNU. - Copyright (C) 1987-2024 Free Software Foundation, Inc. + Copyright (C) 1987-2025 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. @@ -42,7 +42,7 @@ # define funlockfile(fp) _IO_funlockfile (fp) #else # include "gettext.h" -# define _(msgid) gettext (msgid) +# define _(msgid) dgettext ("gnulib", msgid) /* When used standalone, flockfile and funlockfile might not be available. */ # if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \ @@ -723,7 +723,7 @@ _getopt_internal (int argc, char **argv, const char *optstring, return result; } -/* glibc gets a LSB-compliant getopt and a POSIX-complaint __posix_getopt. +/* glibc gets a LSB-compliant getopt and a POSIX-compliant __posix_getopt. Standalone applications just get a POSIX-compliant getopt. POSIX and LSB both require these functions to take 'char *const *argv' even though this is incorrect (because of the permutation). */ @@ -732,7 +732,7 @@ _getopt_internal (int argc, char **argv, const char *optstring, NAME (int argc, char *const *argv, const char *optstring) \ { \ return _getopt_internal (argc, (char **)argv, optstring, \ - 0, 0, 0, POSIXLY_CORRECT); \ + NULL, NULL, 0, POSIXLY_CORRECT); \ } #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 @@ /* Declarations for getopt. - Copyright (C) 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1989-2025 Free Software Foundation, Inc. This file is part of gnulib. Unlike most of the getopt implementation, it is NOT shared with the GNU C Library, which supplies a different version of @@ -30,7 +30,12 @@ ; our definitions will be present soon enough. */ #if @HAVE_GETOPT_H@ # define _GL_SYSTEM_GETOPT +/* Rename the system's 'struct option' to 'struct sys_option', + so that we don't have to rename ours to 'struct rpl_option' + (which would cause significant trouble in C++ mode). */ +# define option sys_option # @INCLUDE_NEXT@ @NEXT_GETOPT_H@ +# undef option # undef _GL_SYSTEM_GETOPT #endif 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 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987-2024 Free Software Foundation, Inc. + Copyright (C) 1987-2025 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. 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 @@ /* Internal declarations for getopt. - Copyright (C) 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1989-2025 Free Software Foundation, Inc. This file is part of the GNU C Library and is also part of gnulib. Patches to this file should be submitted to both projects. 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 @@ /* Program name management. - Copyright (C) 2016-2024 Free Software Foundation, Inc. + Copyright (C) 2016-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Program name management. - Copyright (C) 2016-2024 Free Software Foundation, Inc. + Copyright (C) 2016-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2024 Free Software - Foundation, Inc. + Copyright (C) 1995-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -18,6 +17,7 @@ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 + /* NLS can be disabled through the configure --disable-nls option or through "#define ENABLE NLS 0" before including this file. */ #if defined ENABLE_NLS && ENABLE_NLS @@ -45,32 +45,90 @@ as well because people using "gettext.h" will not include , and also including would fail on SunOS 4, whereas is OK. */ -#if defined(__sun) -# include -#endif +# if defined(__sun) +# include +# endif /* Many header files from the libstdc++ coming with g++ 3.3 or newer include , which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. */ -#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) -# include -# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H -# include +# if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) +# include +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H +# include +# endif # endif -#endif -/* Disabled NLS. - The casts to 'const char *' serve the purpose of producing warnings - for invalid uses of the value returned from these functions. - On pre-ANSI systems without 'const', the config.h file is supposed to - contain "#define const". */ -# undef gettext -# define gettext(Msgid) ((const char *) (Msgid)) -# undef dgettext -# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) -# undef dcgettext -# define dcgettext(Domainname, Msgid, Category) \ - ((void) (Category), dgettext (Domainname, Msgid)) +/* Disabled NLS. */ +# if defined __GNUC__ && !defined __clang__ && !defined __cplusplus +/* Use inline functions, to avoid warnings + warning: format not a string literal and no format arguments + that don't occur with enabled NLS. */ +/* The return type 'const char *' serves the purpose of producing warnings + for invalid uses of the value returned from these functions. */ +# if __GNUC__ >= 9 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" +# endif +# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4 +__attribute__ ((__always_inline__, __gnu_inline__)) +# else +__attribute__ ((__always_inline__)) +# endif +extern inline +# if !defined(__sun) +const +# endif +char * +gettext (const char *msgid) +{ + return msgid; +} +# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4 +__attribute__ ((__always_inline__, __gnu_inline__)) +# else +__attribute__ ((__always_inline__)) +# endif +extern inline +# if !defined(__sun) +const +# endif +char * +dgettext (const char *domain, const char *msgid) +{ + (void) domain; + return msgid; +} +# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4 +__attribute__ ((__always_inline__, __gnu_inline__)) +# else +__attribute__ ((__always_inline__)) +# endif +extern inline +# if !defined(__sun) +const +# endif +char * +dcgettext (const char *domain, const char *msgid, int category) +{ + (void) domain; + (void) category; + return msgid; +} +# if __GNUC__ >= 9 +# pragma GCC diagnostic pop +# endif +# else +/* The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. */ +# undef gettext +# define gettext(Msgid) ((const char *) (Msgid)) +# undef dgettext +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) +# undef dcgettext +# define dcgettext(Domainname, Msgid, Category) \ + ((void) (Category), dgettext (Domainname, Msgid)) +# endif # undef ngettext # define ngettext(Msgid1, Msgid2, N) \ ((N) == 1 \ @@ -93,12 +151,14 @@ #endif + /* Prefer gnulib's setlocale override over libintl's setlocale override. */ #ifdef GNULIB_defined_setlocale # undef setlocale # define setlocale rpl_setlocale #endif + /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. @@ -108,6 +168,7 @@ initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String + /* The separator between msgctxt and msgid in a .mo file. */ #define GETTEXT_CONTEXT_GLUE "\004" @@ -115,6 +176,9 @@ MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be short and rarely need to change. The letter 'p' stands for 'particular' or 'special'. */ + +#include /* for LC_MESSAGES */ + #ifdef DEFAULT_TEXT_DOMAIN # define pgettext(Msgctxt, Msgid) \ pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) @@ -178,11 +242,12 @@ npgettext_aux (const char *domain, return translation; } + /* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID can be arbitrary expressions. But for string literals these macros are less efficient than those above. */ -#include +#include /* for memcpy */ /* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. This relates to the -Wvla and -Wvla-larger-than warnings, enabled in @@ -199,7 +264,7 @@ npgettext_aux (const char *domain, #endif #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS -#include +# include /* for malloc, free */ #endif #define pgettext_expr(Msgctxt, Msgid) \ @@ -297,4 +362,5 @@ dcnpgettext_expr (const char *domain, return (n == 1 ? msgid : msgid_plural); } + #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 @@ /* Wrap openssl crypto hash routines in gnulib interface. -*- coding: utf-8 -*- - Copyright (C) 2013-2024 Free Software Foundation, Inc. + Copyright (C) 2013-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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) return 0; } -/* -------------------------- gl_once_t datatype -------------------------- */ - #endif /* ========================================================================= */ @@ -271,7 +269,7 @@ glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock) /* Note: PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is the only value that causes the writer to be preferred. PTHREAD_RWLOCK_PREFER_WRITER_NP does not do this; see - http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */ + https://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */ err = pthread_rwlockattr_setkind_np (&attributes, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); if (err == 0) @@ -698,46 +696,6 @@ glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) # endif -/* -------------------------- gl_once_t datatype -------------------------- */ - -static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT; - -int -glthread_once_singlethreaded (pthread_once_t *once_control) -{ - /* We don't know whether pthread_once_t is an integer type, a floating-point - type, a pointer type, or a structure type. */ - char *firstbyte = (char *)once_control; - if (*firstbyte == *(const char *)&fresh_once) - { - /* First time use of once_control. Invert the first byte. */ - *firstbyte = ~ *(const char *)&fresh_once; - return 1; - } - else - return 0; -} - -# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK) - -int -glthread_once_multithreaded (pthread_once_t *once_control, - void (*init_function) (void)) -{ - int err = pthread_once (once_control, init_function); - if (err == ENOSYS) - { - /* This happens on FreeBSD 11: The pthread_once function in libc returns - ENOSYS. */ - if (glthread_once_singlethreaded (once_control)) - init_function (); - return 0; - } - return err; -} - -# endif - #endif /* ========================================================================= */ 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 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -64,13 +64,6 @@ Taking the lock: err = glthread_recursive_lock_lock (&name); Releasing the lock: err = glthread_recursive_lock_unlock (&name); De-initialization: err = glthread_recursive_lock_destroy (&name); - - Once-only execution: - Type: gl_once_t - Initializer: gl_once_define(extern, name) - Execution: gl_once (name, initfunction); - Equivalent functions with control of error handling: - Execution: err = glthread_once (&name, initfunction); */ @@ -88,17 +81,9 @@ #include #include -#if !defined c11_threads_in_use -# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC -# define c11_threads_in_use() 1 -# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK -# include -# pragma weak thrd_exit -# define c11_threads_in_use() (thrd_exit != NULL) -# else -# define c11_threads_in_use() 0 -# endif -#endif +#include "glthread/once.h" + +/* c11_threads_in_use() is defined in glthread/once.h. */ /* ========================================================================= */ @@ -195,14 +180,6 @@ extern int glthread_recursive_lock_lock (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); -/* -------------------------- gl_once_t datatype -------------------------- */ - -typedef once_flag gl_once_t; -# define gl_once_define(STORAGECLASS, NAME) \ - STORAGECLASS once_flag NAME = ONCE_FLAG_INIT; -# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (call_once (ONCE_CONTROL, INITFUNCTION), 0) - # ifdef __cplusplus } # endif @@ -221,80 +198,7 @@ typedef once_flag gl_once_t; extern "C" { # endif -# if PTHREAD_IN_USE_DETECTION_HARD - -/* The pthread_in_use() detection needs to be done at runtime. */ -# define pthread_in_use() \ - glthread_in_use () -extern int glthread_in_use (void); - -# endif - -# if USE_POSIX_THREADS_WEAK - -/* Use weak references to the POSIX threads library. */ - -/* Weak references avoid dragging in external libraries if the other parts - of the program don't use them. Here we use them, because we don't want - every program that uses libintl to depend on libpthread. This assumes - that libpthread would not be loaded after libintl; i.e. if libintl is - loaded first, by an executable that does not depend on libpthread, and - then a module is dynamically loaded that depends on libpthread, libintl - will not be multithread-safe. */ - -/* The way to test at runtime whether libpthread is present is to test - whether a function pointer's value, such as &pthread_mutex_init, is - non-NULL. However, some versions of GCC have a bug through which, in - PIC mode, &foo != NULL always evaluates to true if there is a direct - call to foo(...) in the same function. To avoid this, we test the - address of a function in libpthread that we don't use. */ - -# pragma weak pthread_mutex_init -# pragma weak pthread_mutex_lock -# pragma weak pthread_mutex_unlock -# pragma weak pthread_mutex_destroy -# pragma weak pthread_rwlock_init -# pragma weak pthread_rwlock_rdlock -# pragma weak pthread_rwlock_wrlock -# pragma weak pthread_rwlock_unlock -# pragma weak pthread_rwlock_destroy -# pragma weak pthread_once -# pragma weak pthread_cond_init -# pragma weak pthread_cond_wait -# pragma weak pthread_cond_signal -# pragma weak pthread_cond_broadcast -# pragma weak pthread_cond_destroy -# pragma weak pthread_mutexattr_init -# pragma weak pthread_mutexattr_settype -# pragma weak pthread_mutexattr_destroy -# pragma weak pthread_rwlockattr_init -# if __GNU_LIBRARY__ > 1 -# pragma weak pthread_rwlockattr_setkind_np -# endif -# pragma weak pthread_rwlockattr_destroy -# ifndef pthread_self -# pragma weak pthread_self -# endif - -# if !PTHREAD_IN_USE_DETECTION_HARD - /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols - can be used to determine whether libpthread is in use. These are: - pthread_mutexattr_gettype - pthread_rwlockattr_destroy - pthread_rwlockattr_init - */ -# pragma weak pthread_mutexattr_gettype -# define pthread_in_use() \ - (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) -# endif - -# else - -# if !PTHREAD_IN_USE_DETECTION_HARD -# define pthread_in_use() 1 -# endif - -# endif +/* pthread_in_use() is defined in glthread/once.h. */ /* -------------------------- gl_lock_t datatype -------------------------- */ @@ -510,26 +414,6 @@ extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *l # endif -/* -------------------------- gl_once_t datatype -------------------------- */ - -typedef pthread_once_t gl_once_t; -# define gl_once_define(STORAGECLASS, NAME) \ - STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT; -# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK -# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (pthread_in_use () \ - ? pthread_once (ONCE_CONTROL, INITFUNCTION) \ - : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) -# else -# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (pthread_in_use () \ - ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ - : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) -extern int glthread_once_multithreaded (pthread_once_t *once_control, - void (*init_function) (void)); -# endif -extern int glthread_once_singlethreaded (pthread_once_t *once_control); - # ifdef __cplusplus } # endif @@ -546,7 +430,6 @@ extern int glthread_once_singlethreaded (pthread_once_t *once_control); # include "windows-mutex.h" # include "windows-rwlock.h" # include "windows-recmutex.h" -# include "windows-once.h" # ifdef __cplusplus extern "C" { @@ -619,14 +502,6 @@ typedef glwthread_recmutex_t gl_recursive_lock_t; # define glthread_recursive_lock_destroy(LOCK) \ glwthread_recmutex_destroy (LOCK) -/* -------------------------- gl_once_t datatype -------------------------- */ - -typedef glwthread_once_t gl_once_t; -# define gl_once_define(STORAGECLASS, NAME) \ - STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT; -# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0) - # ifdef __cplusplus } # endif @@ -670,14 +545,6 @@ typedef int gl_recursive_lock_t; # define glthread_recursive_lock_unlock(NAME) 0 # define glthread_recursive_lock_destroy(NAME) 0 -/* -------------------------- gl_once_t datatype -------------------------- */ - -typedef int gl_once_t; -# define gl_once_define(STORAGECLASS, NAME) \ - STORAGECLASS gl_once_t NAME = 0; -# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ - (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0) - #endif /* ========================================================================= */ @@ -784,16 +651,6 @@ typedef int gl_once_t; } \ while (0) -/* -------------------------- gl_once_t datatype -------------------------- */ - -#define gl_once(NAME, INITFUNCTION) \ - do \ - { \ - if (glthread_once (&NAME, INITFUNCTION)) \ - abort (); \ - } \ - while (0) - /* ========================================================================= */ #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 @@ +/* Once-only initialization in multithreaded situations. + Copyright (C) 2005-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h. */ + +#include + +#include "glthread/once.h" + +/* ========================================================================= */ + +#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS + +#endif + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT; + +int +glthread_once_singlethreaded (pthread_once_t *once_control) +{ + /* We don't know whether pthread_once_t is an integer type, a floating-point + type, a pointer type, or a structure type. */ + char *firstbyte = (char *)once_control; + if (*firstbyte == *(const char *)&fresh_once) + { + /* First time use of once_control. Invert the first byte. */ + *firstbyte = ~ *(const char *)&fresh_once; + return 1; + } + else + return 0; +} + +# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK) + +int +glthread_once_multithreaded (pthread_once_t *once_control, + void (*init_function) (void)) +{ + int err = pthread_once (once_control, init_function); + if (err == ENOSYS) + { + /* This happens on FreeBSD 11: The pthread_once function in libc returns + ENOSYS. */ + if (glthread_once_singlethreaded (once_control)) + init_function (); + return 0; + } + return err; +} + +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WINDOWS_THREADS + +#endif + +/* ========================================================================= */ 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 @@ +/* Once-only initialization in multithreaded situations. + Copyright (C) 2005-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */ + +/* This file contains once-only initialization primitives for use with a given + thread library. + It does not contain primitives for creating threads or for other + synchronization primitives. + + Once-only execution: + Type: gl_once_t + Initializer: gl_once_define(extern, name) + Execution: gl_once (name, initfunction); + Equivalent functions with control of error handling: + Execution: err = glthread_once (&name, initfunction); +*/ + + +#ifndef _ONCE_H +#define _ONCE_H + +/* This file uses HAVE_THREADS_H. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#include +#include + +#if !defined c11_threads_in_use +# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC +# define c11_threads_in_use() 1 +# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK +# include +# pragma weak thrd_exit +# define c11_threads_in_use() (thrd_exit != NULL) +# else +# define c11_threads_in_use() 0 +# endif +#endif + +/* ========================================================================= */ + +#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS + +/* Use the ISO C threads library. */ + +# include + +# ifdef __cplusplus +extern "C" { +# endif + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef once_flag gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS once_flag NAME = ONCE_FLAG_INIT; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (call_once (ONCE_CONTROL, INITFUNCTION), 0) + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include + +# ifdef __cplusplus +extern "C" { +# endif + +# if PTHREAD_IN_USE_DETECTION_HARD + +/* The pthread_in_use() detection needs to be done at runtime. */ +# define pthread_in_use() \ + glthread_in_use () +extern int glthread_in_use (void); + +# endif + +# if USE_POSIX_THREADS_WEAK + +/* Use weak references to the POSIX threads library. */ + +/* Weak references avoid dragging in external libraries if the other parts + of the program don't use them. Here we use them, because we don't want + every program that uses libintl to depend on libpthread. This assumes + that libpthread would not be loaded after libintl; i.e. if libintl is + loaded first, by an executable that does not depend on libpthread, and + then a module is dynamically loaded that depends on libpthread, libintl + will not be multithread-safe. */ + +/* The way to test at runtime whether libpthread is present is to test + whether a function pointer's value, such as &pthread_mutex_init, is + non-NULL. However, some versions of GCC have a bug through which, in + PIC mode, &foo != NULL always evaluates to true if there is a direct + call to foo(...) in the same function. To avoid this, we test the + address of a function in libpthread that we don't use. */ + +# pragma weak pthread_mutex_init +# pragma weak pthread_mutex_lock +# pragma weak pthread_mutex_unlock +# pragma weak pthread_mutex_destroy +/* Work around clang bug */ +# ifndef pthread_rwlock_init +# pragma weak pthread_rwlock_init +# endif +# pragma weak pthread_rwlock_rdlock +# pragma weak pthread_rwlock_wrlock +# pragma weak pthread_rwlock_unlock +# pragma weak pthread_rwlock_destroy +# pragma weak pthread_once +# pragma weak pthread_cond_init +# pragma weak pthread_cond_wait +# pragma weak pthread_cond_signal +# pragma weak pthread_cond_broadcast +# pragma weak pthread_cond_destroy +# pragma weak pthread_mutexattr_init +# pragma weak pthread_mutexattr_settype +# pragma weak pthread_mutexattr_destroy +/* Work around clang bug */ +# ifndef pthread_rwlockattr_init +# pragma weak pthread_rwlockattr_init +# endif +# if __GNU_LIBRARY__ > 1 +# pragma weak pthread_rwlockattr_setkind_np +# endif +# pragma weak pthread_rwlockattr_destroy +# ifndef pthread_self +# pragma weak pthread_self +# endif + +# if !PTHREAD_IN_USE_DETECTION_HARD + /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols + can be used to determine whether libpthread is in use. These are: + pthread_mutexattr_gettype + pthread_rwlockattr_destroy + pthread_rwlockattr_init + */ +# pragma weak pthread_mutexattr_gettype +# define pthread_in_use() \ + (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) +# endif + +# else + +# if !PTHREAD_IN_USE_DETECTION_HARD +# define pthread_in_use() 1 +# endif + +# endif + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef pthread_once_t gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT; +# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (pthread_in_use () \ + ? pthread_once (ONCE_CONTROL, INITFUNCTION) \ + : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) +# else +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (pthread_in_use () \ + ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ + : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) +extern int glthread_once_multithreaded (pthread_once_t *once_control, + void (*init_function) (void)); +# endif +extern int glthread_once_singlethreaded (pthread_once_t *once_control); + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WINDOWS_THREADS + +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ +# include + +# include "windows-once.h" + +# ifdef __cplusplus +extern "C" { +# endif + +/* We can use CRITICAL_SECTION directly, rather than the native Windows Event, + Mutex, Semaphore types, because + - we need only to synchronize inside a single process (address space), + not inter-process locking, + - we don't need to support trylock operations. (TryEnterCriticalSection + does not work on Windows 95/98/ME. Packages that need trylock usually + define their own mutex type.) */ + +/* There is no way to statically initialize a CRITICAL_SECTION. It needs + to be done lazily, once only. For this we need spinlocks. */ + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef glwthread_once_t gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0) + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS) + +/* Provide dummy implementation if threads are not supported. */ + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef int gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_once_t NAME = 0; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0) + +#endif + +/* ========================================================================= */ + +/* Macros with built-in error handling. */ + +/* -------------------------- gl_once_t datatype -------------------------- */ + +#define gl_once(NAME, INITFUNCTION) \ + do \ + { \ + if (glthread_once (&NAME, INITFUNCTION)) \ + abort (); \ + } \ + while (0) + +/* ========================================================================= */ + +#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 @@ /* Multithreading primitives. - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* hard-locale.c -- Determine whether a locale is hard. - Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2024 Free Software + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2025 Free Software Foundation, Inc. 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 @@ /* Determine whether a locale is hard. - Copyright (C) 1999, 2003-2004, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 1999, 2003-2004, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* malloc with idx_t rather than size_t - Copyright 2021-2024 Free Software Foundation, Inc. + Copyright 2021-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* ialloc.h -- malloc with idx_t rather than size_t - Copyright 2021-2024 Free Software Foundation, Inc. + Copyright 2021-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -29,9 +29,6 @@ #include #include #include -#if defined __CHERI_PURE_CAPABILITY__ -# include -#endif _GL_INLINE_HEADER_BEGIN #ifndef IALLOC_INLINE @@ -68,19 +65,7 @@ IALLOC_INLINE void * irealloc (void *p, idx_t s) { - if (s <= SIZE_MAX) - { - /* Work around GNU realloc glitch by treating a zero size as if it - were 1, so that returning NULL is equivalent to failing. */ - p = realloc (p, s | !s); -#if defined __CHERI_PURE_CAPABILITY__ - if (p != NULL) - p = cheri_bounds_set (p, s); -#endif - return p; - } - else - return _gl_alloc_nomem (); + return s <= SIZE_MAX ? realloc (p, s) : _gl_alloc_nomem (); } /* icalloc (num, size) is like calloc (num, size). @@ -112,23 +97,9 @@ icalloc (idx_t n, idx_t s) IALLOC_INLINE void * ireallocarray (void *p, idx_t n, idx_t s) { - if (n <= SIZE_MAX && s <= SIZE_MAX) - { - /* Work around GNU reallocarray glitch by treating a zero size as if - it were 1, so that returning NULL is equivalent to failing. */ - size_t nx = n; - size_t sx = s; - if (n == 0 || s == 0) - nx = sx = 1; - p = reallocarray (p, nx, sx); -#if defined __CHERI_PURE_CAPABILITY__ - if (p != NULL && (n == 0 || s == 0)) - p = cheri_bounds_set (p, 0); -#endif - return p; - } - else - return _gl_alloc_nomem (); + return (n <= SIZE_MAX && s <= SIZE_MAX + ? reallocarray (p, n, s) + : _gl_alloc_nomem ()); } #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 @@ /* Dropping uid/gid privileges of the current process temporarily. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,18 +25,18 @@ /* The privileged uid and gid that the process had earlier. */ #if HAVE_GETUID -static int saved_uid = -1; +static uid_t saved_uid = -1; #endif #if HAVE_GETGID -static int saved_gid = -1; +static gid_t saved_gid = -1; #endif int idpriv_temp_drop (void) { #if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID) - int uid = getuid (); - int gid = getgid (); + uid_t uid = getuid (); + gid_t gid = getgid (); /* Find out about the privileged uid and gid at the first call. */ if (saved_uid == -1) @@ -124,8 +124,8 @@ int idpriv_temp_restore (void) { #if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID) - int uid = getuid (); - int gid = getgid (); + uid_t uid = getuid (); + gid_t gid = getgid (); if (saved_uid == -1 || saved_gid == -1) /* 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 @@ /* Dropping uid/gid privileges of the current process. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* A type for indices and sizes. - Copyright (C) 2020-2024 Free Software Foundation, Inc. + Copyright (C) 2020-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form - Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -117,7 +117,7 @@ inet_ntop (int af, const void *restrict src, * 'dst' (as a const) * notes: * (1) uses no statics - * (2) takes a u_char* not an in_addr as input + * (2) takes a 'unsigned char *' not an in_addr as input * author: * Paul Vixie, 1996. */ 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 @@ +/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form + + Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include + +/* Specification. */ +#include + +#if HAVE_DECL_INET_PTON + +# undef inet_pton + +int +rpl_inet_pton (int af, const char *restrict src, void *restrict dst) +{ + return inet_pton (af, src, dst); +} + +#else + +# include +# include +# include + +# define NS_INADDRSZ 4 +# define NS_IN6ADDRSZ 16 +# define NS_INT16SZ 2 + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static int inet_pton4 (const char *src, unsigned char *dst); +# if HAVE_IPV6 +static int inet_pton6 (const char *src, unsigned char *dst); +# endif + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid ('dst' is untouched in this case) + * -1 if some other error occurred ('dst' is untouched in this case, too) + * author: + * Paul Vixie, 1996. + */ +int +inet_pton (int af, const char *restrict src, void *restrict dst) +{ + switch (af) + { + case AF_INET: + return (inet_pton4 (src, dst)); + +# if HAVE_IPV6 + case AF_INET6: + return (inet_pton6 (src, dst)); +# endif + + default: + errno = EAFNOSUPPORT; + return (-1); + } + /* NOTREACHED */ +} + +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal, octal (with the + * exception of 0) and shorthand. + * return: + * 1 if 'src' is a valid dotted quad, else 0. + * notice: + * does not touch 'dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4 (const char *restrict src, unsigned char *restrict dst) +{ + int saw_digit, octets, ch; + unsigned char tmp[NS_INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') + { + + if (ch >= '0' && ch <= '9') + { + unsigned new = *tp * 10 + (ch - '0'); + + if (saw_digit && *tp == 0) + return (0); + if (new > 255) + return (0); + *tp = new; + if (!saw_digit) + { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } + else if (ch == '.' && saw_digit) + { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } + else + return (0); + } + if (octets < 4) + return (0); + memcpy (dst, tmp, NS_INADDRSZ); + return (1); +} + +# if HAVE_IPV6 + +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if 'src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch 'dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6 (const char *restrict src, unsigned char *restrict dst) +{ + static const char xdigits[] = "0123456789abcdef"; + unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *curtok; + int ch, saw_xdigit; + unsigned val; + + tp = memset (tmp, '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return (0); + curtok = src; + saw_xdigit = 0; + val = 0; + while ((ch = c_tolower (*src++)) != '\0') + { + const char *pch; + + pch = strchr (xdigits, ch); + if (pch != NULL) + { + val <<= 4; + val |= (pch - xdigits); + if (val > 0xffff) + return (0); + saw_xdigit = 1; + continue; + } + if (ch == ':') + { + curtok = src; + if (!saw_xdigit) + { + if (colonp) + return (0); + colonp = tp; + continue; + } + else if (*src == '\0') + { + return (0); + } + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + saw_xdigit = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4 (curtok, tp) > 0) + { + tp += NS_INADDRSZ; + saw_xdigit = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + return (0); + } + if (saw_xdigit) + { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + } + if (colonp != NULL) + { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + if (tp == endp) + return (0); + for (i = 1; i <= n; i++) + { + endp[-i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return (0); + memcpy (dst, tmp, NS_IN6ADDRSZ); + return (1); +} + +# endif + +#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 @@ /* intprops-internal.h -- properties of integer types not visible to users - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -21,7 +21,7 @@ #include /* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED. */ -#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) +#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__ # pragma GCC diagnostic ignored "-Wtype-limits" #endif @@ -77,10 +77,11 @@ /* Does the __typeof__ keyword work? This could be done by 'configure', but for now it's easier to do it by hand. */ -#if (2 <= __GNUC__ \ - || (4 <= __clang_major__) \ - || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ - || (0x5110 <= __SUNPRO_C && !__STDC__)) +#if ((defined __GNUC__ && 2 <= __GNUC__) \ + || (defined __clang_major__ && 4 <= __clang_major__) \ + || (defined __IBMC__ && 1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ + || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__) \ + || (defined _MSC_VER && 1939 <= _MSC_VER)) # define _GL_HAVE___TYPEOF__ 1 #else # define _GL_HAVE___TYPEOF__ 0 @@ -119,8 +120,8 @@ #endif /* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ -#if defined __clang_major__ && __clang_major__ < 14 -/* Work around Clang bug . */ +#if defined __clang_major__ && __clang_major__ < 21 +/* Work around Clang bug . */ # define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 #else # define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW @@ -163,7 +164,7 @@ #if _GL_HAS_BUILTIN_MUL_OVERFLOW # if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \ - && !defined __EDG__) + && !defined __clang__ && !defined __EDG__) # define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) # else /* Work around GCC bug 91450. */ @@ -182,13 +183,13 @@ _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) #endif -/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: +/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25764. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 - https://llvm.org/bugs/show_bug.cgi?id=25390 - For now, assume all versions of GCC-like compilers generate bogus + https://github.com/llvm/llvm-project/issues/25764 + For now, assume GCC < 14 and all Clang versions generate bogus warnings for _Generic. This matters only for compilers that lack relevant builtins. */ -#if __GNUC__ || defined __clang__ +#if (__GNUC__ && __GNUC__ < 14) || defined __clang__ # define _GL__GENERIC_BOGUS 1 #else # 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 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -34,6 +34,14 @@ signed or floating type. Do not evaluate E. */ #define EXPR_SIGNED(e) _GL_EXPR_SIGNED (e) +/* The same value as as the arithmetic expression E, but with E's type + after integer promotions. For example, if E is of type 'enum {A, B}' + then 'switch (INT_PROMOTE (E))' pacifies gcc -Wswitch-enum if some + enum values are deliberately omitted from the switch's cases. + Here, unary + is safer than a cast or inline function, as unary + + does only integer promotions and is disallowed on pointers. */ +#define INT_PROMOTE(e) (+ (e)) + /* Minimum and maximum values for integer types and expressions. */ 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 @@ -/* Copyright (C) 2006-2024 Free Software Foundation, Inc. +/* Copyright (C) 2006-2025 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Derek Price. This file is part of gnulib. @@ -913,11 +913,11 @@ extern "C" { # undef imaxabs # define imaxabs rpl_imaxabs # endif -_GL_FUNCDECL_RPL (imaxabs, intmax_t, (intmax_t x)); +_GL_FUNCDECL_RPL (imaxabs, intmax_t, (intmax_t x), ); _GL_CXXALIAS_RPL (imaxabs, intmax_t, (intmax_t x)); # else # if !@HAVE_DECL_IMAXABS@ -_GL_FUNCDECL_SYS (imaxabs, intmax_t, (intmax_t x)); +_GL_FUNCDECL_SYS (imaxabs, intmax_t, (intmax_t x), ); # endif _GL_CXXALIAS_SYS (imaxabs, intmax_t, (intmax_t x)); # endif @@ -944,11 +944,11 @@ typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; # undef imaxdiv # define imaxdiv rpl_imaxdiv # endif -_GL_FUNCDECL_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); +_GL_FUNCDECL_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom), ); _GL_CXXALIAS_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); # else # if !@HAVE_DECL_IMAXDIV@ -_GL_FUNCDECL_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); +_GL_FUNCDECL_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom), ); # endif _GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); # endif @@ -970,7 +970,7 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " # define strtoimax rpl_strtoimax # endif _GL_FUNCDECL_RPL (strtoimax, intmax_t, - (const char *restrict, char **restrict, int) + (const char *restrict, char **restrict, int), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoimax, intmax_t, (const char *restrict, char **restrict, int)); @@ -978,7 +978,7 @@ _GL_CXXALIAS_RPL (strtoimax, intmax_t, # if !@HAVE_DECL_STRTOIMAX@ # undef strtoimax _GL_FUNCDECL_SYS (strtoimax, intmax_t, - (const char *restrict, char **restrict, int) + (const char *restrict, char **restrict, int), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoimax, intmax_t, @@ -1000,7 +1000,7 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " # define strtoumax rpl_strtoumax # endif _GL_FUNCDECL_RPL (strtoumax, uintmax_t, - (const char *restrict, char **restrict, int) + (const char *restrict, char **restrict, int), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoumax, uintmax_t, (const char *restrict, char **restrict, int)); @@ -1008,7 +1008,7 @@ _GL_CXXALIAS_RPL (strtoumax, uintmax_t, # if !@HAVE_DECL_STRTOUMAX@ # undef strtoumax _GL_FUNCDECL_SYS (strtoumax, uintmax_t, - (const char *restrict, char **restrict, int) + (const char *restrict, char **restrict, int), _GL_ARG_NONNULL ((1))); # endif _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 @@ /* Test wide character for being blank. - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Test whether a wide character has a given property. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 @@ /* Test whether a wide character has a given property. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 @@ /* Test wide character for being a digit. - Copyright (C) 2020-2024 Free Software Foundation, Inc. + Copyright (C) 2020-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Test wide character for being a punctuation or symbol character. - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Test wide character for being a hexadecimal digit. - Copyright (C) 2020-2024 Free Software Foundation, Inc. + Copyright (C) 2020-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Replacement for 'int' to 'long double' conversion routine. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 @@ /* Substitute for and wrapper around . - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -115,6 +115,18 @@ typedef int nl_item; # define ABMON_10 (ABMON_1 + 9) # define ABMON_11 (ABMON_1 + 10) # define ABMON_12 (ABMON_1 + 11) +# define ABALTMON_1 10220 +# define ABALTMON_2 (ABALTMON_1 + 1) +# define ABALTMON_3 (ABALTMON_1 + 2) +# define ABALTMON_4 (ABALTMON_1 + 3) +# define ABALTMON_5 (ABALTMON_1 + 4) +# define ABALTMON_6 (ABALTMON_1 + 5) +# define ABALTMON_7 (ABALTMON_1 + 6) +# define ABALTMON_8 (ABALTMON_1 + 7) +# define ABALTMON_9 (ABALTMON_1 + 8) +# define ABALTMON_10 (ABALTMON_1 + 9) +# define ABALTMON_11 (ABALTMON_1 + 10) +# define ABALTMON_12 (ABALTMON_1 + 11) # define ERA 10047 # define ERA_D_FMT 10048 # define ERA_D_T_FMT 10049 @@ -171,6 +183,37 @@ typedef int nl_item; # define GNULIB_defined_ALTMON 1 # endif +# if !@HAVE_LANGINFO_ABALTMON@ +# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 27 +# define ABALTMON_1 _NL_ABALTMON_1 +# define ABALTMON_2 _NL_ABALTMON_2 +# define ABALTMON_3 _NL_ABALTMON_3 +# define ABALTMON_4 _NL_ABALTMON_4 +# define ABALTMON_5 _NL_ABALTMON_5 +# define ABALTMON_6 _NL_ABALTMON_6 +# define ABALTMON_7 _NL_ABALTMON_7 +# define ABALTMON_8 _NL_ABALTMON_8 +# define ABALTMON_9 _NL_ABALTMON_9 +# define ABALTMON_10 _NL_ABALTMON_10 +# define ABALTMON_11 _NL_ABALTMON_11 +# define ABALTMON_12 _NL_ABALTMON_12 +# else +# define ABALTMON_1 10220 +# define ABALTMON_2 (ABALTMON_1 + 1) +# define ABALTMON_3 (ABALTMON_1 + 2) +# define ABALTMON_4 (ABALTMON_1 + 3) +# define ABALTMON_5 (ABALTMON_1 + 4) +# define ABALTMON_6 (ABALTMON_1 + 5) +# define ABALTMON_7 (ABALTMON_1 + 6) +# define ABALTMON_8 (ABALTMON_1 + 7) +# define ABALTMON_9 (ABALTMON_1 + 8) +# define ABALTMON_10 (ABALTMON_1 + 9) +# define ABALTMON_11 (ABALTMON_1 + 10) +# define ABALTMON_12 (ABALTMON_1 + 11) +# define GNULIB_defined_ABALTMON 1 +# endif +# endif + # if !@HAVE_LANGINFO_ERA@ # define ERA 10047 # define ERA_D_FMT 10048 @@ -205,11 +248,11 @@ typedef int nl_item; # undef nl_langinfo # define nl_langinfo rpl_nl_langinfo # endif -_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item)); +_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item), ); _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item)); # else # if !@HAVE_NL_LANGINFO@ -_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); +_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item), ); # endif _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); # 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 @@ /* Dispatching based on the current locale's character encoding. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Dispatching based on the current locale's character encoding. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* System definitions for code taken from the GNU C Library - Copyright 2017-2024 Free Software Foundation, Inc. + Copyright 2017-2025 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -48,6 +48,11 @@ /* From glibc . */ +#if defined __clang__ + /* clang really only groks GNU C 4.2, regardless of its value of __GNUC__. */ +# undef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) ((maj) < 4 + ((min) <= 2)) +#endif #ifndef __GNUC_PREREQ # if defined __GNUC__ && defined __GNUC_MINOR__ # 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 @@ /* A GNU-like . - Copyright 2016-2024 Free Software Foundation, Inc. + Copyright 2016-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -20,7 +20,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined _GL_ALREADY_INCLUDING_LIMITS_H +#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H /* Special invocation convention: On Haiku/x86_64, we have a sequence of nested includes -> -> . @@ -34,12 +34,12 @@ #ifndef _@GUARD_PREFIX@_LIMITS_H -# define _GL_ALREADY_INCLUDING_LIMITS_H +# define _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_LIMITS_H@ -# undef _GL_ALREADY_INCLUDING_LIMITS_H +# undef _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H #ifndef _@GUARD_PREFIX@_LIMITS_H #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 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -380,7 +380,7 @@ static const struct table_entry alias_table[] = # if defined OS2 /* OS/2 */ /* The list of encodings is taken from "List of OS/2 Codepages" by Alex Taylor: - . + . See also "__convcp() of kLIBC": . */ { "CP1004", "CP1252" }, @@ -939,8 +939,10 @@ locale_charset (void) sprintf (buf, "CP%u", GetACP ()); } /* For a locale name such as "French_France.65001", in Windows 10, - setlocale now returns "French_France.utf8" instead. */ - if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0) + setlocale now returns "French_France.utf8" instead, or in the UTF-8 + environment (with modern system settings) "fr_FR.UTF-8". */ + if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0 + || strcmp (buf + 2, "UTF-8") == 0) codeset = "UTF-8"; else { 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 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2003, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2025 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. 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 @@ /* A POSIX . - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -20,7 +20,7 @@ @PRAGMA_COLUMNS@ #if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \ - || defined _GL_ALREADY_INCLUDING_LOCALE_H + || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_LOCALE_H /* Special invocation convention: - Inside mingw header files, @@ -34,12 +34,12 @@ #ifndef _@GUARD_PREFIX@_LOCALE_H -#define _GL_ALREADY_INCLUDING_LOCALE_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_LOCALE_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_LOCALE_H@ -#undef _GL_ALREADY_INCLUDING_LOCALE_H +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_LOCALE_H #ifndef _@GUARD_PREFIX@_LOCALE_H #define _@GUARD_PREFIX@_LOCALE_H @@ -69,6 +69,85 @@ # define LC_MESSAGES 1729 #endif +#if !@HAVE_LOCALE_T@ +# if !defined GNULIB_defined_locale_t +/* The values of the POSIX-standardized LC_* macros are: + + LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME + + glibc, Solaris, 3 0 5 4 1 2 + Android + macOS, *BSD 1 2 6 3 4 5 + native Windows 1 2 1729 3 4 5 + + We map these to the log2(LC_*_MASK) values, chosen to be compatible with + later releases of the same operating system. */ +# if defined __APPLE__ && defined __MACH__ /* macOS */ +/* LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME + + category 1 2 6 3 4 5 + log2(LC_*_MASK) 0 1 2 3 4 5 + */ +# define gl_log2_lc_mask(category) ((0x2543100 >> (4 * (category))) & 0xf) +# elif defined __FreeBSD__ || defined __DragonFly__ /* FreeBSD */ +/* LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME + + category 1 2 6 3 4 5 + log2(LC_*_MASK) 0 1 5 2 3 4 + */ +# define gl_log2_lc_mask(category) ((category) - 1) +# elif defined _WIN32 && !defined __CYGWIN__ /* native Windows */ +# define gl_log2_lc_mask(category) \ + ((category) == LC_MESSAGES ? 0 : (category)) +# else /* glibc, Solaris, Android, NetBSD, OpenBSD */ +# define gl_log2_lc_mask(category) (category) +# endif +/* From there we map them to array indices 0..5. */ +# if (gl_log2_lc_mask (LC_COLLATE) == 0 || gl_log2_lc_mask (LC_CTYPE) == 0 \ + || gl_log2_lc_mask (LC_MESSAGES) == 0) + /* glibc, Solaris, Android, macOS, FreeBSD, native Windows */ +# define gl_log2_lcmask_to_index(c) (c) +# define gl_index_to_log2_lcmask(i) (i) +# else + /* NetBSD, OpenBSD */ +# define gl_log2_lcmask_to_index(c) ((c) - 1) +# define gl_index_to_log2_lcmask(i) ((i) + 1) +# endif +/* Define the LC_*_MASK macros. */ +# define LC_COLLATE_MASK (1 << gl_log2_lc_mask (LC_COLLATE)) +# define LC_CTYPE_MASK (1 << gl_log2_lc_mask (LC_CTYPE)) +# define LC_MESSAGES_MASK (1 << gl_log2_lc_mask (LC_MESSAGES)) +# define LC_MONETARY_MASK (1 << gl_log2_lc_mask (LC_MONETARY)) +# define LC_NUMERIC_MASK (1 << gl_log2_lc_mask (LC_NUMERIC)) +# define LC_TIME_MASK (1 << gl_log2_lc_mask (LC_TIME)) +# define LC_ALL_MASK \ + (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK \ + | LC_NUMERIC_MASK | LC_TIME_MASK) +/* Now define the locale_t type. */ +struct gl_locale_category_t +{ + char *name; + bool is_c_locale; +# if @HAVE_WINDOWS_LOCALE_T@ + /* Use the native Windows '_locale_t' type. + Documentation: + + This field is NULL if is_c_locale is true. But don't use this NULL value, + since for the native Windows *_l functions a null _locale_t means to use + the global locale. */ + _locale_t system_locale; +# endif +}; +struct gl_locale_t +{ + struct gl_locale_category_t category[6]; +}; +typedef struct gl_locale_t *locale_t; +# define LC_GLOBAL_LOCALE ((locale_t)(-1)) +# define GNULIB_defined_locale_t 1 +# endif +#endif + /* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and int_n_*. Instead of overriding 'struct lconv', merely define these member names as macros. This avoids trouble in C++ mode. */ @@ -83,7 +162,8 @@ /* Bionic libc's 'struct lconv' is just a dummy. */ #if @REPLACE_STRUCT_LCONV@ -# define lconv rpl_lconv +# if !defined GNULIB_defined_struct_lconv +# define lconv rpl_lconv struct lconv { /* All 'char *' are actually 'const char *'. */ @@ -160,6 +240,8 @@ struct lconv number. */ char int_n_sep_by_space; }; +# define GNULIB_defined_struct_lconv 1 +# endif #endif #if @GNULIB_LOCALECONV@ @@ -168,7 +250,7 @@ struct lconv # undef localeconv # define localeconv rpl_localeconv # endif -_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void)); +_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void), ); _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void)); # else _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void)); @@ -177,8 +259,10 @@ _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void)); _GL_CXXALIASWARN (localeconv); # endif #elif @REPLACE_STRUCT_LCONV@ -# undef localeconv -# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv +# if !GNULIB_LOCALECONV +# undef localeconv +# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv +# endif #elif defined GNULIB_POSIXCHECK # undef localeconv # if HAVE_RAW_DECL_LOCALECONV @@ -195,7 +279,7 @@ _GL_WARN_ON_USE (localeconv, # define setlocale rpl_setlocale # define GNULIB_defined_setlocale 1 # endif -_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale)); +_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale), ); _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); # else _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 - " # include "setlocale_null.h" #endif -#if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@) +#if @GNULIB_NEWLOCALE@ || (@GNULIB_GETLOCALENAME_L_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@) # if @REPLACE_NEWLOCALE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef newlocale @@ -224,24 +308,22 @@ _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - " # define GNULIB_defined_newlocale 1 # endif _GL_FUNCDECL_RPL (newlocale, locale_t, - (int category_mask, const char *name, locale_t base) + (int category_mask, const char *name, locale_t base), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (newlocale, locale_t, (int category_mask, const char *name, locale_t base)); # else -# if @HAVE_NEWLOCALE@ +# if !@HAVE_NEWLOCALE@ +_GL_FUNCDECL_SYS (newlocale, locale_t, + (int category_mask, const char *name, locale_t base), + _GL_ARG_NONNULL ((2))); +# endif _GL_CXXALIAS_SYS (newlocale, locale_t, (int category_mask, const char *name, locale_t base)); -# endif # endif -# if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@ +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (newlocale); # endif -# if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@ -# ifndef HAVE_WORKING_NEWLOCALE -# define HAVE_WORKING_NEWLOCALE 1 -# endif -# endif #elif defined GNULIB_POSIXCHECK # undef newlocale # if HAVE_RAW_DECL_NEWLOCALE @@ -249,53 +331,50 @@ _GL_WARN_ON_USE (newlocale, "newlocale is not portable"); # endif #endif -#if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@) -# if @HAVE_DUPLOCALE@ /* locale_t may be undefined if !@HAVE_DUPLOCALE@. */ -# if @REPLACE_DUPLOCALE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef duplocale -# define duplocale rpl_duplocale -# define GNULIB_defined_duplocale 1 -# endif -_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); +#if @GNULIB_DUPLOCALE@ || (@GNULIB_GETLOCALENAME_L_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@) +# if @REPLACE_DUPLOCALE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef duplocale +# define duplocale rpl_duplocale +# define GNULIB_defined_duplocale 1 +# endif +_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); -# else -_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); +# else +# if !@HAVE_DUPLOCALE@ +_GL_FUNCDECL_SYS (duplocale, locale_t, (locale_t locale), _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); # endif -# if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@ +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (duplocale); # endif -# if @HAVE_DUPLOCALE@ -# ifndef HAVE_WORKING_DUPLOCALE -# define HAVE_WORKING_DUPLOCALE 1 -# endif -# endif #elif defined GNULIB_POSIXCHECK # undef duplocale # if HAVE_RAW_DECL_DUPLOCALE -_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " +_GL_WARN_ON_USE (duplocale, "duplocale is unportable and buggy on some glibc systems - " "use gnulib module duplocale for portability"); # endif #endif -#if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@) +#if @GNULIB_FREELOCALE@ || (@GNULIB_GETLOCALENAME_L_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@) # if @REPLACE_FREELOCALE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef freelocale # define freelocale rpl_freelocale # define GNULIB_defined_freelocale 1 # endif -_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); # else -# if @HAVE_FREELOCALE@ +# if !@HAVE_FREELOCALE@ +_GL_FUNCDECL_SYS (freelocale, void, (locale_t locale), _GL_ARG_NONNULL ((1))); +# endif /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is int. */ _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); -# endif # endif -# if __GLIBC__ >= 2 && @HAVE_FREELOCALE@ +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (freelocale); # endif #elif defined GNULIB_POSIXCHECK @@ -305,6 +384,36 @@ _GL_WARN_ON_USE (freelocale, "freelocale is not portable"); # endif #endif +#if @GNULIB_GETLOCALENAME_L@ +# if @REPLACE_GETLOCALENAME_L@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getlocalename_l +# define getlocalename_l rpl_getlocalename_l +# endif +_GL_FUNCDECL_RPL (getlocalename_l, const char *, + (int category, locale_t locale), + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (getlocalename_l, const char *, + (int category, locale_t locale)); +# else +# if !@HAVE_GETLOCALENAME_L@ +_GL_FUNCDECL_SYS (getlocalename_l, const char *, + (int category, locale_t locale), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (getlocalename_l, const char *, + (int category, locale_t locale)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (getlocalename_l); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getlocalename_l +# if HAVE_RAW_DECL_GETLOCALENAME_L +_GL_WARN_ON_USE (getlocalename_l, "getlocalename_l is not portable"); +# endif +#endif + #endif /* _@GUARD_PREFIX@_LOCALE_H */ #endif /* _@GUARD_PREFIX@_LOCALE_H */ -#endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */ +#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 @@ /* Query locale dependent information for formatting numbers. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* An lseek() function that detects pipes. - Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ +/* Work around a bug of lstat on some systems + + Copyright (C) 1997-2006, 2008-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* written by Jim Meyering */ + +/* If the user's config.h happens to include , let it include only + the system's here, so that orig_lstat doesn't recurse to + rpl_lstat. */ +#define __need_system_sys_stat_h +#include + +#if !HAVE_LSTAT +/* On systems that lack symlinks, our replacement already + defined lstat as stat, so there is nothing further to do other than + avoid an empty file. */ +typedef int dummy; +#else /* HAVE_LSTAT */ + +/* Get the original definition of lstat. It might be defined as a macro. */ +# include +# include +# undef __need_system_sys_stat_h + +static int +orig_lstat (const char *filename, struct stat *buf) +{ + return lstat (filename, buf); +} + +/* Specification. */ +# ifdef __osf__ +/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc + eliminates this include because of the preliminary #include + above. */ +# include "sys/stat.h" +# else +# include +# endif + +# include "stat-time.h" + +# include +# include + +/* lstat works differently on Linux and Solaris systems. POSIX (see + "pathname resolution" in the glossary) requires that programs like + 'ls' take into consideration the fact that FILE has a trailing slash + when FILE is a symbolic link. On Linux and Solaris 10 systems, the + lstat function already has the desired semantics (in treating + 'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)', + but on Solaris 9 and earlier it does not. + + If FILE has a trailing slash and specifies a symbolic link, + then use stat() to get more info on the referent of FILE. + If the referent is a non-directory, then set errno to ENOTDIR + and return -1. Otherwise, return stat's result. */ + +int +rpl_lstat (const char *file, struct stat *sbuf) +{ + int result = orig_lstat (file, sbuf); + + /* This replacement file can blindly check against '/' rather than + using the ISSLASH macro, because all platforms with '\\' either + lack symlinks (mingw) or have working lstat (cygwin) and thus do + not compile this file. 0 len should have already been filtered + out above, with a failure return of ENOENT. */ + if (result == 0) + { + if (S_ISDIR (sbuf->st_mode) || file[strlen (file) - 1] != '/') + result = stat_time_normalize (result, sbuf); + else + { + /* At this point, a trailing slash is permitted only on + symlink-to-dir; but it should have found information on the + directory, not the symlink. Call 'stat' to get info about the + link's referent. Our replacement stat guarantees valid results, + even if the symlink is not pointing to a directory. */ + if (!S_ISLNK (sbuf->st_mode)) + { + errno = ENOTDIR; + return -1; + } + result = stat (file, sbuf); + } + } + return result; +} + +#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 @@ # 00gnulib.m4 # serial 9 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl This file must be named something that sorts before all other dnl 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 @@ # __inline.m4 # serial 1 -dnl Copyright 2017-2024 Free Software Foundation, Inc. +dnl Copyright 2017-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Test for __inline keyword 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 @@ # absolute-header.m4 # serial 18 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Derek Price. 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 @@ # af_alg.m4 # serial 6 -dnl Copyright 2018-2024 Free Software Foundation, Inc. +dnl Copyright 2018-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Matteo Croce. 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 @@ # alloca.m4 # serial 21 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2024 Free Software Foundation, +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ALLOCA], [ 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 @@ # arpa_inet_h.m4 -# serial 17 -dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. +# serial 18 +dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Simon Josefsson and Bruno Haible @@ -68,8 +69,12 @@ AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS], AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_HTONL=1; AC_SUBST([HAVE_DECL_HTONL]) + HAVE_DECL_HTONS=1; AC_SUBST([HAVE_DECL_HTONS]) HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) + HAVE_DECL_NTOHL=1; AC_SUBST([HAVE_DECL_NTOHL]) + HAVE_DECL_NTOHS=1; AC_SUBST([HAVE_DECL_NTOHS]) REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP]) REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON]) ]) 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 @@ # assert_h.m4 -# serial 1 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +# serial 5 +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert. @@ -12,30 +13,31 @@ AC_DEFUN([gl_ASSERT_H], AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], [gl_saved_CFLAGS=$CFLAGS for gl_working in "yes, a keyword" "yes, an macro"; do - AS_CASE([$gl_working], - [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"]) - - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#if defined __clang__ && __STDC_VERSION__ < 202311 - #pragma clang diagnostic error "-Wc2x-extensions" - #pragma clang diagnostic error "-Wc++1z-extensions" - #endif - #ifdef INCLUDE_ASSERT_H - #include - #endif - static_assert (2 + 2 == 4, "arithmetic does not work"); - static_assert (2 + 2 == 4); - ]], - [[ - static_assert (sizeof (char) == 1, "sizeof does not work"); - static_assert (sizeof (char) == 1); - ]])], - [gl_cv_static_assert=$gl_working], - [gl_cv_static_assert=no]) - CFLAGS=$gl_saved_CFLAGS - test "$gl_cv_static_assert" != no && break - done]) + AS_CASE([$gl_working], + [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#if defined __clang__ && __STDC_VERSION__ < 202311 + #pragma clang diagnostic error "-Wc2x-extensions" + #pragma clang diagnostic error "-Wc++1z-extensions" + #endif + #ifdef INCLUDE_ASSERT_H + #include + #endif + static_assert (2 + 2 == 4, "arithmetic does not work"); + static_assert (2 + 2 == 4); + ]], + [[ + static_assert (sizeof (char) == 1, "sizeof does not work"); + static_assert (sizeof (char) == 1); + ]]) + ], + [gl_cv_static_assert=$gl_working], + [gl_cv_static_assert=no]) + CFLAGS=$gl_saved_CFLAGS + test "$gl_cv_static_assert" != no && break + done + ]) GL_GENERATE_ASSERT_H=false AS_CASE([$gl_cv_static_assert], @@ -48,6 +50,10 @@ AC_DEFUN([gl_ASSERT_H], dnl The "zz" puts this toward config.h's end, to avoid potential dnl collisions with other definitions. + dnl Hardcode the known configuration results for GCC and clang, so that + dnl a configuration made with the C compiler works also with the C++ compiler + dnl and vice versa. + dnl The seemingly redundant parentheses are necessary for MSVC 14. dnl #undef assert so that programs are not tempted to use it without dnl specifically including assert.h. dnl #undef __ASSERT_H__ so that on IRIX, when programs later include @@ -55,7 +61,18 @@ AC_DEFUN([gl_ASSERT_H], dnl Break the #undef_s apart with a comment so that 'configure' does dnl not comment them out. AH_VERBATIM([zzstatic_assert], -[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ +[#if (!(defined __clang__ \ + ? (defined __cplusplus \ + ? __cplusplus >= 201703L \ + : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \ + && !defined __sun) \ + : (defined __GNUC__ \ + ? (defined __cplusplus \ + ? __cplusplus >= 201103L && __GNUG__ >= 6 \ + : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \ + && !defined __sun) \ + : defined HAVE_C_STATIC_ASSERT)) \ + && !defined assert \ && (!defined __cplusplus \ || (__cpp_static_assert < 201411 \ && __GNUG__ < 6 && __clang_major__ < 6))) @@ -65,8 +82,9 @@ AC_DEFUN([gl_ASSERT_H], #undef/**/__ASSERT_H__ #endif /* Solaris 11.4 defines static_assert as a macro with 2 arguments. - We need it also to be invocable with a single argument. */ - #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus + We need it also to be invocable with a single argument. + Haiku 2022 does not define static_assert at all. */ + #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus #undef/**/static_assert #define static_assert _Static_assert #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 @@ # base64.m4 # serial 4 -dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_BASE64], [ 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 @@ # btowc.m4 -# serial 14 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +# serial 15 +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_BTOWC], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([gt_TYPE_WINT_T]) dnl Check whether is usable at all, first. Otherwise the test dnl program below may lead to an endless loop. See @@ -133,6 +135,13 @@ int main () ]) ]) + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then + dnl On mingw/ucrt, we override the return type of btowc(). + dnl While the original wint_t (= unsigned short) and the overridden wint_t + dnl (= unsigned int) are equivalent in function parameters, this is not + dnl the case for function return types. + REPLACE_BTOWC=1 + fi case "$gl_cv_func_btowc_nul" in *yes) ;; *) 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 @@ +# build-to-host.m4 +# serial 5 +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Bruno Haible. + +dnl When the build environment ($build_os) is different from the target runtime +dnl environment ($host_os), file names may need to be converted from the build +dnl environment syntax to the target runtime environment syntax. This is +dnl because the Makefiles are executed (mostly) by build environment tools and +dnl therefore expect file names in build environment syntax, whereas the runtime +dnl expects file names in target runtime environment syntax. +dnl +dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need +dnl be converted from Cygwin syntax to native Windows syntax: +dnl /cygdrive/c/foo/bar -> C:\foo\bar +dnl /usr/local/share -> C:\cygwin64\usr\local\share +dnl +dnl gl_BUILD_TO_HOST([somedir]) +dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must +dnl already have its final value assigned, and produces two additional +dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the +dnl same file name value, just in different syntax: +dnl - somedir_c is the file name in target runtime environment syntax, +dnl as a C string (starting and ending with a double-quote, +dnl and with escaped backslashes and double-quotes in +dnl between). +dnl - somedir_c_make is the same thing, escaped for use in a Makefile. + +AC_DEFUN([gl_BUILD_TO_HOST], +[ + AC_REQUIRE([AC_CANONICAL_BUILD]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_BUILD_TO_HOST_INIT]) + + dnl Define somedir_c. + gl_final_[$1]="$[$1]" + dnl Translate it from build syntax to host syntax. + case "$build_os" in + cygwin*) + case "$host_os" in + mingw* | windows*) + gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;; + esac + ;; + esac + dnl Convert it to C string syntax. + [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"` + [$1]_c='"'"$[$1]_c"'"' + AC_SUBST([$1_c]) + + dnl Define somedir_c_make. + [$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"` + dnl Use the substituted somedir variable, when possible, so that the user + dnl may adjust somedir a posteriori when there are no special characters. + if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then + [$1]_c_make='\"$([$1])\"' + fi + AC_SUBST([$1_c_make]) +]) + +dnl Some initializations for gl_BUILD_TO_HOST. +AC_DEFUN([gl_BUILD_TO_HOST_INIT], +[ + gl_sed_double_backslashes='s/\\/\\\\/g' + gl_sed_escape_doublequotes='s/"/\\"/g' +changequote(,)dnl + gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" +changequote([,])dnl + gl_sed_escape_for_make_2='s,\$,\\$$,g' + dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr + dnl does not understand '\r'. + case `echo r | tr -d '\r'` in + '') gl_tr_cr='\015' ;; + *) gl_tr_cr='\r' ;; + esac +]) + + +dnl The following macros are convenience invocations of gl_BUILD_TO_HOST +dnl for some of the variables that are defined by Autoconf. +dnl To do so for _all_ the possible variables, use the module 'configmake'. + +dnl Defines bindir_c and bindir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_BINDIR], +[ + dnl Find the final value of bindir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_bindir="${bindir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval bindir="$bindir" + gl_BUILD_TO_HOST([bindir]) + bindir="${gl_saved_bindir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines datadir_c and datadir_c_make, +dnl where datadir = $(datarootdir) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_DATADIR], +[ + dnl Find the final value of datadir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_datadir="${datadir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval datadir="$datadir" + gl_BUILD_TO_HOST([datadir]) + datadir="${gl_saved_datadir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines libdir_c and libdir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBDIR], +[ + dnl Find the final value of libdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libdir="${libdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libdir="$libdir" + gl_BUILD_TO_HOST([libdir]) + libdir="${gl_saved_libdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines libexecdir_c and libexecdir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBEXECDIR], +[ + dnl Find the final value of libexecdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libexecdir="${libexecdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libexecdir="$libexecdir" + gl_BUILD_TO_HOST([libexecdir]) + libexecdir="${gl_saved_libexecdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines localedir_c and localedir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LOCALEDIR], +[ + dnl Find the final value of localedir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_localedir="${localedir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval localedir="$localedir" + gl_BUILD_TO_HOST([localedir]) + localedir="${gl_saved_localedir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkgdatadir_c and pkgdatadir_c_make, +dnl where pkgdatadir = $(datadir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGDATADIR], +[ + dnl Find the final value of pkgdatadir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_datadir="${datadir}" + gl_saved_pkgdatadir="${pkgdatadir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval datadir="$datadir" + eval pkgdatadir="$pkgdatadir" + gl_BUILD_TO_HOST([pkgdatadir]) + pkgdatadir="${gl_saved_pkgdatadir}" + datadir="${gl_saved_datadir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkglibdir_c and pkglibdir_c_make, +dnl where pkglibdir = $(libdir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBDIR], +[ + dnl Find the final value of pkglibdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libdir="${libdir}" + gl_saved_pkglibdir="${pkglibdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libdir="$libdir" + eval pkglibdir="$pkglibdir" + gl_BUILD_TO_HOST([pkglibdir]) + pkglibdir="${gl_saved_pkglibdir}" + libdir="${gl_saved_libdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkglibexecdir_c and pkglibexecdir_c_make, +dnl where pkglibexecdir = $(libexecdir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBEXECDIR], +[ + dnl Find the final value of pkglibexecdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libexecdir="${libexecdir}" + gl_saved_pkglibexecdir="${pkglibexecdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libexecdir="$libexecdir" + eval pkglibexecdir="$pkglibexecdir" + gl_BUILD_TO_HOST([pkglibexecdir]) + pkglibexecdir="${gl_saved_pkglibexecdir}" + libexecdir="${gl_saved_libexecdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) 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 @@ # builtin-expect.m4 -# serial 1 -dnl Copyright 2016-2024 Free Software Foundation, Inc. +# serial 3 +dnl Copyright 2016-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. -dnl Check for __builtin_expect. +dnl Provide a GCC-compatible __builtin_expect macro in . dnl Written by Paul Eggert. @@ -47,5 +48,4 @@ AC_DEFUN([gl___BUILTIN_EXPECT], #elif HAVE___BUILTIN_EXPECT == 2 # include #endif - ]) -]) +])]) 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 @@ # byteswap.m4 -# serial 5 -dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. +# serial 7 +dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Oskar Liljeblad. AC_DEFUN([gl_BYTESWAP], [ dnl Prerequisites of lib/byteswap.in.h. - AC_CHECK_HEADERS([byteswap.h], [ + AC_CHECK_HEADERS_ONCE([byteswap.h]) + if test $ac_cv_header_byteswap_h = yes; then + AC_CACHE_CHECK([for working bswap_16, bswap_32, bswap_64], + [gl_cv_header_working_byteswap_h], + [gl_cv_header_working_byteswap_h=no + dnl Check that floating point arguments work. + dnl This also checks C libraries with implementations like + dnl '#define bswap_16(x) (((x) >> 8 & 0xff) | (((x) & 0xff) << 8))' + dnl that mistakenly evaluate their arguments multiple times. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[int value_16 = bswap_16 (0.0); + int value_32 = bswap_32 (0.0); + int value_64 = bswap_64 (0.0); + return !(value_16 + value_32 + value_64); + ]]) + ], + [gl_cv_header_working_byteswap_h=yes], + [gl_cv_header_working_byteswap_h=no]) + ]) + fi + if test "$gl_cv_header_working_byteswap_h" = yes; then GL_GENERATE_BYTESWAP_H=false - ], [ + else GL_GENERATE_BYTESWAP_H=true - ]) + fi ]) 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 @@ # c-bool.m4 -# serial 1 -dnl Copyright 2022-2024 Free Software Foundation, Inc. +# serial 3 +dnl Copyright 2022-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for bool that conforms to C2023. @@ -29,12 +30,23 @@ AC_DEFUN([gl_C_BOOL], dnl The "zz" puts this toward config.h's end, to avoid potential dnl collisions with other definitions. dnl If 'bool', 'true' and 'false' do not work, arrange for them to work. - dnl In C, this means including if it is not already included. + dnl Hardcode the known configuration results for GCC and clang, so that + dnl a configuration made with the C compiler works also with the C++ compiler + dnl and vice versa. + dnl The seemingly redundant parentheses are necessary for MSVC 14. + dnl "Arrange for them to work", in C, means including if it is + dnl not already included. dnl However, if the preprocessor mistakenly treats 'true' as 0, dnl define it to a bool expression equal to 1; this is needed in dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. AH_VERBATIM([zzbool], -[#ifndef HAVE_C_BOOL +[#if !(defined __cplusplus \ + ? 1 \ + : (defined __clang__ \ + ? __STDC_VERSION__ >= 202000L && __clang_major__ >= 15 \ + : (defined __GNUC__ \ + ? __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \ + : defined HAVE_C_BOOL))) # if !defined __cplusplus && !defined __bool_true_false_are_defined # if HAVE_STDBOOL_H # include 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 @@ +# c32rtomb.m4 +# serial 8 +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_C32RTOMB], +[ + AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + + AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB]) + if test $gl_cv_func_c32rtomb = no; then + HAVE_C32RTOMB=0 + else + dnl When we override mbrtoc32, redefining the meaning of the char32_t + dnl values, we need to override c32rtomb as well, for consistency. + if test $HAVE_WORKING_MBRTOC32 = 0; then + REPLACE_C32RTOMB=1 + fi + AC_CACHE_CHECK([whether c32rtomb return value is correct], + [gl_cv_func_c32rtomb_retval], + [ + dnl Initial guess, used when cross-compiling. +changequote(,)dnl + case "$host_os" in + # Guess no on AIX. + aix*) gl_cv_func_c32rtomb_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_c32rtomb_retval="guessing yes" ;; + esac +changequote([,])dnl + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#ifdef __HAIKU__ + #include +#endif +#include +int main () +{ + int result = 0; + if (c32rtomb (NULL, 0, NULL) != 1) + result |= 1; + return result; +}]])], + [gl_cv_func_c32rtomb_retval=yes], + [gl_cv_func_c32rtomb_retval=no], + [:]) + ]) + case "$gl_cv_func_c32rtomb_retval" in + *yes) ;; + *) AC_DEFINE([C32RTOMB_RETVAL_BUG], [1], + [Define if the c32rtomb function has an incorrect return value.]) + REPLACE_C32RTOMB=1 ;; + esac + if test $HAVE_WORKING_C32RTOMB = 0; then + REPLACE_C32RTOMB=1 + fi + fi +]) + +AC_DEFUN([gl_CHECK_FUNC_C32RTOMB], +[ + dnl Cf. gl_CHECK_FUNCS_ANDROID + AC_CHECK_DECL([c32rtomb], , , + [[#ifdef __HAIKU__ + #include + #endif + #include + ]]) + if test $ac_cv_have_decl_c32rtomb = yes; then + dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a + dnl static inline function on Haiku 2020. + AC_CACHE_CHECK([for c32rtomb], [gl_cv_func_c32rtomb], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #ifdef __HAIKU__ + #include + #endif + #include + ]], + [[char buf[8]; + return c32rtomb (buf, 0, NULL) == 0; + ]]) + ], + [gl_cv_func_c32rtomb=yes], + [gl_cv_func_c32rtomb=no]) + ]) + else + gl_cv_func_c32rtomb=no + fi +]) + +dnl Test whether c32rtomb works not worse than wcrtomb. +dnl Result is HAVE_WORKING_C32RTOMB. + +AC_DEFUN([gl_C32RTOMB_SANITYCHECK], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_TYPE_CHAR32_T]) + AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + AC_REQUIRE([AC_CANONICAL_HOST]) + if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_c32rtomb = no; then + HAVE_WORKING_C32RTOMB=0 + else + AC_CACHE_CHECK([whether c32rtomb works as well as wcrtomb], + [gl_cv_func_c32rtomb_sanitycheck], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. +changequote(,)dnl + case "$host_os" in + # Guess no on Solaris derivatives. + solaris*) + if test -f /etc/release && grep 'Oracle Solaris' /etc/release >/dev/null; then + gl_cv_func_c32rtomb_sanitycheck="guessing yes" + else + gl_cv_func_c32rtomb_sanitycheck="guessing no" + fi + ;; + # Guess yes otherwise. + *) + gl_cv_func_c32rtomb_sanitycheck="guessing yes" + ;; + esac +changequote([,])dnl + if test $LOCALE_ZH_CN != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +#ifdef __HAIKU__ + #include +#endif +#include +int main () +{ + int result = 0; + /* This fails on Solaris 11 OmniOS: + c32rtomb returns (size_t)-1. + wcrtomb returns 4 (correct). */ + if (strcmp ("$LOCALE_ZH_CN", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + mbstate_t state; + wchar_t wc = (wchar_t) 0xBADFACE; + char buf[16]; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\201\060\211\070", 4, &state) == 4 + && wcrtomb (buf, wc, NULL) == 4 + && memcmp (buf, "\201\060\211\070", 4) == 0) + { + char32_t c32 = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtoc32 (&c32, "\201\060\211\070", 4, &state) == 4 + && c32rtomb (buf, c32, NULL) != 4) + result |= 1; + } + } + return result; +}]])], + [gl_cv_func_c32rtomb_sanitycheck=yes], + [gl_cv_func_c32rtomb_sanitycheck=no], + [:]) + fi + ]) + case "$gl_cv_func_c32rtomb_sanitycheck" in + *yes) + HAVE_WORKING_C32RTOMB=1 + AC_DEFINE([HAVE_WORKING_C32RTOMB], [1], + [Define if the c32rtomb function basically works.]) + ;; + *) HAVE_WORKING_C32RTOMB=0 ;; + esac + fi + AC_SUBST([HAVE_WORKING_C32RTOMB]) +]) 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 @@ # calloc.m4 -# serial 31 -dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. +# serial 36 +dnl Copyright (C) 2004-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Written by Jim Meyering. @@ -12,42 +13,35 @@ dnl with or without modifications, as long as this notice is preserved. # If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc # and arrange to use a calloc wrapper function that does work in that case. -# _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) -# ------------------------------------- +# gl_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) +# --------------------------------------- # If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. -AC_DEFUN([_AC_FUNC_CALLOC_IF], +AC_DEFUN([gl_FUNC_CALLOC_IF], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], - [ac_cv_func_calloc_0_nonnull], - [if test $cross_compiling != yes; then - ac_cv_func_calloc_0_nonnull=yes - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT], - [[int result = 0; - char * volatile p = calloc (0, 0); - if (!p) - result |= 1; - free (p); - return result; - ]])], - [], - [ac_cv_func_calloc_0_nonnull=no]) - else - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; - # Guess yes on musl systems. - *-musl* | midipix*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; - # Guess yes on native Windows. - mingw* | windows*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; - esac - fi - ]) - AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) + [gl_cv_func_calloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + /* Use pcalloc to test; "volatile" prevents the compiler + from optimizing the calloc call away. */ + void *(*volatile pcalloc) (size_t, size_t) = calloc;]], + [[void *p = pcalloc (0, 0); + int result = !p; + free (p); + return result;]])], + [gl_cv_func_calloc_0_nonnull=yes], + [gl_cv_func_calloc_0_nonnull=no], + [AS_CASE([$host_os], + [# Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midipix* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | windows* | msys*], + [gl_cv_func_calloc_0_nonnull="guessing yes"], + [# If we don't know, obey --enable-cross-guesses. + gl_cv_func_calloc_0_nonnull="$gl_cross_guess_normal"])])]) + AS_CASE([$gl_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) ]) @@ -58,9 +52,14 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) + + dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT + dnl gets defined already before this macro gets invoked. This helps + dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise. + REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then - _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) + gl_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) fi ])# gl_FUNC_CALLOC_GNU @@ -73,9 +72,7 @@ AC_DEFUN([gl_FUNC_CALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) - if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then - REPLACE_CALLOC_FOR_CALLOC_POSIX=1 - fi + REPLACE_CALLOC_FOR_CALLOC_POSIX=$REPLACE_MALLOC_FOR_MALLOC_POSIX dnl Although in theory we should also test for size_t overflow, dnl in practice testing for ptrdiff_t overflow suffices 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 @@ # close.m4 # serial 10 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_CLOSE], [ 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 @@ # codeset.m4 # serial 5 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2024 Free Software +dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2025 Free Software dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. 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 @@ # double-slash-root.m4 # serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_DOUBLE_SLASH_ROOT], [ 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 @@ # dup2.m4 # serial 28 -dnl Copyright (C) 2002, 2005, 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_DUP2], [ 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 @@ -# eealloc.m4 -# serial 3 -dnl Copyright (C) 2003, 2009-2024 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_EEALLOC], -[ - AC_REQUIRE([gl_EEMALLOC]) - AC_REQUIRE([gl_EEREALLOC]) -]) - -AC_DEFUN([gl_EEMALLOC], -[ - _AC_FUNC_MALLOC_IF( - [gl_cv_func_malloc_0_nonnull=1], - [gl_cv_func_malloc_0_nonnull=0]) - AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull], - [If malloc(0) is != NULL, define this to 1. Otherwise define this - to 0.]) -]) - -AC_DEFUN([gl_EEREALLOC], -[ - _AC_FUNC_REALLOC_IF( - [gl_cv_func_realloc_0_nonnull=1], - [gl_cv_func_realloc_0_nonnull=0]) - AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull], - [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this - to 0.]) -]) 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 @@ # environ.m4 # serial 8 -dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_ENVIRON], [ 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 @@ # errno_h.m4 -# serial 14 -dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. +# serial 18 +dnl Copyright (C) 2004, 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.61]) AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], [ AC_REQUIRE([AC_PROG_CC]) + + dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT + dnl gets defined already before this macro gets invoked. This persuades + dnl AIX 7.3 errno.h to assign ENOTEMPTY a value different than EEXIST. + AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ AC_EGREP_CPP([booboo],[ #include @@ -63,6 +69,9 @@ booboo #endif #if !defined EILSEQ booboo +#endif +#if !defined ESOCKTNOSUPPORT +booboo #endif ], [gl_cv_header_errno_h_complete=no], 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 @@ # error.m4 # serial 16 -dnl Copyright (C) 1996-1998, 2001-2004, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1996-1998, 2001-2004, 2009-2025 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_ERROR], [ 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 @@ # error_h.m4 -# serial 4 -dnl Copyright (C) 1996-2024 Free Software Foundation, Inc. +# serial 5 +dnl Copyright (C) 1996-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. dnl Provide a working . @@ -111,12 +112,15 @@ AC_DEFUN_ONCE([gl_ERROR_H], esac fi - if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \ - || test $HAVE_ERROR_AT_LINE = 0 || test $REPLACE_ERROR_AT_LINE = 1; then - COMPILE_ERROR_C=1 - else - COMPILE_ERROR_C=0 - fi + m4_ifdef([gl_HAVE_MODULE_VERROR], + [COMPILE_ERROR_C=1], + [if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \ + || test $HAVE_ERROR_AT_LINE = 0 \ + || test $REPLACE_ERROR_AT_LINE = 1; then + COMPILE_ERROR_C=1 + else + COMPILE_ERROR_C=0 + fi]) AC_SUBST([HAVE_ERROR]) 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 @@ # exponentd.m4 -# serial 4 -dnl Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. +# serial 5 +dnl Copyright (C) 2007-2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION], [ AC_CACHE_CHECK([where to find the exponent in a 'double'], @@ -84,7 +85,7 @@ int main () dnl The newer VFP instructions assume little-endian order dnl consistently. AC_EGREP_CPP([mixed_endianness], [ -#if defined arm || defined __arm || defined __arm__ +#if defined __arm__ mixed_endianness #endif ], 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 @@ +# extensions-aix.m4 +# serial 1 +dnl Copyright (C) 2024-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +# On AIX, most extensions are already enabled through the _ALL_SOURCE macro, +# defined by gl_USE_SYSTEM_EXTENSIONS. gl_USE_AIX_EXTENSIONS additionally +# activates more GNU and Linux-like behaviours, affecting +# - the time_t type, +# - errno values in : ENOTEMPTY +# - functions in : malloc calloc realloc valloc +# +# - functions in : strerror_r (returns 'char *', like glibc) +# - functions in : scandir, alphasort, readdir_r +# - functions in : gethostbyname_r gethostbyaddr_r +# - declarations in : sbrk +# and a couple of secondary header files. + +AC_DEFUN_ONCE([gl_USE_AIX_EXTENSIONS], +[ + AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], + [Define so that AIX headers are more compatible with GNU/Linux.]) +]) 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 @@ # extensions.m4 # serial 25 -*- Autoconf -*- -dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Enable extensions on systems that normally disable them. 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 @@ # extern-inline.m4 # serial 1 -dnl Copyright 2012-2024 Free Software Foundation, Inc. +dnl Copyright 2012-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl 'extern inline' a la ISO C99. 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 @@ # fclose.m4 # serial 12 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_FCLOSE], [ 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 @@ # fcntl-o.m4 -# serial 8 -dnl Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc. +# serial 12 +dnl Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Paul Eggert. AC_PREREQ([2.60]) -# Test whether the flags O_NOATIME and O_NOFOLLOW actually work. +# Test whether the flags O_DIRECTORY, O_NOATIME and O_NOFOLLOW actually work. +# Define HAVE_WORKING_O_DIRECTORY to 1 if O_DIRECTORY works, or to 0 otherwise. # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. AC_DEFUN([gl_FCNTL_O_FLAGS], @@ -30,16 +32,23 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], #else /* on Windows with MSVC */ # include # include - # defined sleep(n) _sleep ((n) * 1000) + # define sleep(n) _sleep ((n) * 1000) #endif + #include #include ]GL_MDA_DEFINES[ + #ifndef O_DIRECTORY + #define O_DIRECTORY 0 + #endif #ifndef O_NOATIME #define O_NOATIME 0 #endif #ifndef O_NOFOLLOW #define O_NOFOLLOW 0 #endif + #ifndef O_SEARCH + #define O_SEARCH O_RDONLY + #endif static int const constants[] = { O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, @@ -52,30 +61,37 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], { static char const sym[] = "conftest.sym"; if (symlink ("/dev/null", sym) != 0) - result |= 2; + result |= 1; else { int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); if (fd >= 0) { close (fd); - result |= 4; + result |= 3; } } if (unlink (sym) != 0 || symlink (".", sym) != 0) - result |= 2; + result |= 1; else { int fd = open (sym, O_RDONLY | O_NOFOLLOW); if (fd >= 0) { close (fd); - result |= 4; + result |= 3; } } unlink (sym); } #endif + { + int fd = open ("confdefs.h", O_SEARCH | O_DIRECTORY); + if (!(fd < 0 && errno == ENOTDIR)) + result |= 4; + if (0 <= fd) + close (fd); + } { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME); @@ -111,31 +127,46 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], } return result;]])], [gl_cv_header_working_fcntl_h=yes], - [case $? in #( - 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( - 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( - *) gl_cv_header_working_fcntl_h='no';; - esac], - [case "$host_os" in - # Guess 'no' on native Windows. - mingw* | windows*) gl_cv_header_working_fcntl_h='no' ;; - *) gl_cv_header_working_fcntl_h=cross-compiling ;; - esac - ]) - ]) + [AS_CASE([$?], + dnl We cannot catch exit code 1 or 2 here, because + dnl - exit code 1 can occur through a compilation error on mingw (e.g. + dnl when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when + dnl result = 1, whereas + dnl - exit code 2 can occur through a compilation error on MSVC (e.g. + dnl again when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when + dnl result = 2. + [ 3], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW)"], + [ 4], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY)"], + [ 7], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY)"], + [64], [gl_cv_header_working_fcntl_h="no (bad O_NOATIME)"], + [67], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_NOATIME)"], + [68], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY, O_NOATIME)"], + [71], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY, O_NOATIME)"], + [gl_cv_header_working_fcntl_h="no"])], + [AS_CASE([$host_os,$gl_cross_guess_normal], + # The O_DIRECTORY test is known to fail on Mac OS X 10.4.11 (2007) + # (see ) + # and to succeed on Mac OS X 10.5.8 [darwin9.8.0] (2009). + # Guess it fails on Mac OS X 10.4.x and earlier. + [darwin[[0-8]].*yes], + [gl_cv_header_working_fcntl_h="guessing no (bad O_DIRECTORY)"], + # Known to be "no" on native MS-Windows. + [mingw* | windows*], + [gl_cv_header_working_fcntl_h=no], + [gl_cv_header_working_fcntl_h=$gl_cross_guess_normal])])]) + + AS_CASE([$gl_cv_header_working_fcntl_h], + [*O_DIRECTORY* | *no], [gl_val=0], [gl_val=1]) + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_DIRECTORY], [$gl_val], + [Define to 1 if O_DIRECTORY works, 0 otherwise.]) - case $gl_cv_header_working_fcntl_h in #( - *O_NOATIME* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], - [Define to 1 if O_NOATIME works.]) + AS_CASE([$gl_cv_header_working_fcntl_h], + [*O_NOATIME* | *no], [gl_val=0], [gl_val=1]) + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$gl_val], + [Define to 1 if O_NOATIME works, 0 otherwise.]) - case $gl_cv_header_working_fcntl_h in #( - *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], - [Define to 1 if O_NOFOLLOW works.]) + AS_CASE([$gl_cv_header_working_fcntl_h], + [*O_NOFOLLOW* | *no], [gl_val=0], [gl_val=1]) + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$gl_val], + [Define to 1 if O_NOFOLLOW works, 0 otherwise.]) ]) 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 @@ # fcntl.m4 # serial 12 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # For now, this module ensures that fcntl() # - 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 @@ # fcntl_h.m4 # serial 20 -dnl Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Configure fcntl.h. 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 @@ # fflush.m4 -# serial 19 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 20 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Eric Blake @@ -79,8 +80,9 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no], [case "$host_os" in - # Guess no on native Windows. - mingw* | windows*) gl_cv_func_fflush_stdin="guessing no" ;; + # Guess no on NetBSD, OpenBSD, native Windows. + netbsd* | openbsd* | mingw* | windows*) + gl_cv_func_fflush_stdin="guessing no" ;; *) gl_cv_func_fflush_stdin=cross ;; esac ]) @@ -92,8 +94,8 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN], *) gl_func_fflush_stdin='(-1)' ;; esac AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin], - [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008, - 0 if fflush is known to not work, -1 if unknown.]) + [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008 + or later, 0 if fflush is known to not work, -1 if unknown.]) ]) # 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 @@ # float_h.m4 -# serial 14 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 15 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FLOAT_H], [ @@ -54,6 +55,31 @@ changequote([,])dnl ;; esac + dnl Test for completeness w.r.t. ISO C 23. + REPLACE_FLOAT_SNAN=0 + AC_CACHE_CHECK([whether float.h conforms to ISO C23], + [gl_cv_header_float_h_isoc23], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x[] = { FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG }; + float maxf = FLT_NORM_MAX; + double maxd = DBL_NORM_MAX; + long double maxl = LDBL_NORM_MAX; + ]], + [[float sf = FLT_SNAN; + double sd = DBL_SNAN; + long double sl = LDBL_SNAN; + return (sf != 0) + (sd != 0) + (sl != 0); + ]])], + [gl_cv_header_float_h_isoc23=yes], + [gl_cv_header_float_h_isoc23=no]) + ]) + if test $gl_cv_header_float_h_isoc23 != yes; then + GL_GENERATE_FLOAT_H=true + REPLACE_FLOAT_SNAN=1 + fi + dnl Test against glibc-2.7 Linux/SPARC64 bug. REPLACE_ITOLD=0 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 @@ # floorf.m4 # serial 21 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FLOORF], [ 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 @@ # fopen.m4 # serial 16 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FOPEN_ITSELF], [ 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 @@ # fpurge.m4 -# serial 14 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 16 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FPURGE], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_HEADERS_ONCE([stdio_ext.h]) AC_CHECK_FUNCS_ONCE([fpurge]) gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include ]]) AC_CHECK_DECLS([fpurge], , , [[#include ]]) - if test "x$ac_cv_func_fpurge" = xyes; then + if test $ac_cv_func_fpurge = yes; then HAVE_FPURGE=1 # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune. AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include -]], - [[FILE *f = fopen ("conftest.txt", "w+"); - if (!f) - return 1; - if (fputc ('a', f) != 'a') - { fclose (f); return 2; } - rewind (f); - if (fgetc (f) != 'a') - { fclose (f); return 3; } - if (fgetc (f) != EOF) - { fclose (f); return 4; } - if (fpurge (f) != 0) - { fclose (f); return 5; } - if (putc ('b', f) != 'b') - { fclose (f); return 6; } - if (fclose (f) != 0) - return 7; - if ((f = fopen ("conftest.txt", "r")) == NULL) - return 8; - if (fgetc (f) != 'a') - { fclose (f); return 9; } - if (fgetc (f) != 'b') - { fclose (f); return 10; } - if (fgetc (f) != EOF) - { fclose (f); return 11; } - if (fclose (f) != 0) - return 12; - if (remove ("conftest.txt") != 0) - return 13; - return 0; - ]])], - [gl_cv_func_fpurge_works=yes], - [gl_cv_func_fpurge_works=no], - [case "$host_os" in - # Guess yes on musl systems. - *-musl* | midipix*) gl_cv_func_fpurge_works="guessing yes" ;; - # Otherwise obey --enable-cross-guesses. - *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; - esac - ]) + [if test $ac_cv_have_decl_fpurge = yes; then + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[FILE *f = fopen ("conftest.txt", "w+"); + if (!f) + return 1; + if (fputc ('a', f) != 'a') + { fclose (f); return 2; } + rewind (f); + if (fgetc (f) != 'a') + { fclose (f); return 3; } + if (fgetc (f) != EOF) + { fclose (f); return 4; } + if (fpurge (f) != 0) + { fclose (f); return 5; } + if (putc ('b', f) != 'b') + { fclose (f); return 6; } + if (fclose (f) != 0) + return 7; + if ((f = fopen ("conftest.txt", "r")) == NULL) + return 8; + if (fgetc (f) != 'a') + { fclose (f); return 9; } + if (fgetc (f) != 'b') + { fclose (f); return 10; } + if (fgetc (f) != EOF) + { fclose (f); return 11; } + if (fclose (f) != 0) + return 12; + if (remove ("conftest.txt") != 0) + return 13; + return 0; + ]])], + [gl_cv_func_fpurge_works=yes], + [gl_cv_func_fpurge_works=no], + [# Obey --enable-cross-guesses. + gl_cv_func_fpurge_works="$gl_cross_guess_normal" + ]) + else + gl_cv_func_fpurge_works=no + fi ]) case "$gl_cv_func_fpurge_works" in *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 @@ # freading.m4 # serial 3 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FREADING], [ 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 @@ # free.m4 # serial 6 -dnl Copyright (C) 2003-2005, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2005, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Written by Paul Eggert and Bruno Haible. 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 @@ # fseek.m4 # serial 4 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FSEEK], [ 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 @@ # fseeko.m4 -# serial 20 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 21 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FSEEKO], [ @@ -69,6 +70,10 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET], # Prerequisites of lib/fseeko.c. AC_DEFUN([gl_PREREQ_FSEEKO], [ + if test $gl_cv_func_fseeko != no; then + AC_DEFINE([HAVE_FSEEKO], [1], + [Define to 1 if the system has the fseeko function.]) + fi dnl Native Windows has the function _fseeki64. mingw hides it in some dnl circumstances, but mingw64 makes it usable again. 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 @@ +# fseterr.m4 +# serial 2 +dnl Copyright (C) 2012-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_FSETERR], +[ + gl_CHECK_FUNCS_ANDROID([__fseterr], + [[#include + #include + ]]) +]) 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 @@ # fstat.m4 # serial 10 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FSTAT], [ 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 @@ # fstypename.m4 # serial 6 -dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2024 Free Software +dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2025 Free Software dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Jim Meyering. dnl 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 @@ # fsusage.m4 # serial 35 -dnl Copyright (C) 1997-1998, 2000-2001, 2003-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1997-1998, 2000-2001, 2003-2025 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Obtaining file system usage information. 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 @@ # ftell.m4 # serial 3 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FTELL], [ 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 @@ # ftello.m4 -# serial 16 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 17 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FTELLO], [ @@ -157,6 +158,10 @@ main (void) # Prerequisites of lib/ftello.c. AC_DEFUN([gl_PREREQ_FTELLO], [ + if test $gl_cv_func_ftello != no; then + AC_DEFINE([HAVE_FTELLO], [1], + [Define to 1 if the system has the ftello function.]) + fi dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64 dnl makes it usable again. 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 @@ # getaddrinfo.m4 -# serial 35 -dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. +# serial 38 +dnl Copyright (C) 2004-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_GETADDRINFO], [ AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H + AC_REQUIRE([AC_CANONICAL_HOST]) GETADDRINFO_LIB= gai_saved_LIBS="$LIBS" @@ -87,6 +89,46 @@ int getaddrinfo (const char *, const char *, const struct addrinfo *, struct add HAVE_GETADDRINFO=0 fi fi + if test $HAVE_GETADDRINFO != 0; then + AC_CACHE_CHECK([whether getaddrinfo supports AI_NUMERICSERV], + [gl_cv_func_getaddrinfo_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#include +#include + ]], [[ + struct addrinfo hints; + struct addrinfo *ai; + memset (&hints, 0, sizeof (hints)); + hints.ai_flags = AI_NUMERICSERV; + return getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME; + ]]) + ], + [gl_cv_func_getaddrinfo_works=yes], + [gl_cv_func_getaddrinfo_works=no], + [case "$host_os" in + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_getaddrinfo_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_getaddrinfo_works="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_getaddrinfo_works" in + *yes) ;; + *) REPLACE_GETADDRINFO=1 ;; + esac + fi AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) 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 @@ # getdelim.m4 # serial 19 -dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.59]) 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 @@ # getdtablesize.m4 # serial 8 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_GETDTABLESIZE], [ 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 @@ # gethostname.m4 # serial 16 -dnl Copyright (C) 2002, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Ensure # - 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 @@ # getline.m4 # serial 33 -dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation, +dnl Copyright (C) 1998-2003, 2005-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.59]) 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 @@ # getloadavg.m4 # serial 13 -dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2024 Free Software -dnl Foundation, Inc. +dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2025 Free +dnl Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for getloadavg. 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 @@ # getopt.m4 -# serial 49 -dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc. +# serial 50 +dnl Copyright (C) 2002-2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Request a POSIX compliant getopt function. AC_DEFUN([gl_FUNC_GETOPT_POSIX], @@ -77,7 +78,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS], fi dnl POSIX 2008 does not specify leading '+' behavior, but see - dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on + dnl https://austingroupbugs.net/view.php?id=191 for a recommendation on dnl the next version of POSIX. For now, we only guarantee leading '+' dnl behavior with getopt-gnu. if test -z "$gl_replace_getopt"; then @@ -366,14 +367,7 @@ dnl is ambiguous with environment values that contain newlines. AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], [ - AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) - if test $ac_cv_header_sys_cdefs_h = yes; then - HAVE_SYS_CDEFS_H=1 - else - HAVE_SYS_CDEFS_H=0 - fi - AC_SUBST([HAVE_SYS_CDEFS_H]) - + gl_CHECK_HEADER_SYS_CDEFS_H AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], [Define to rpl_ if the getopt replacement functions and variables 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 @@ # getprogname.m4 # serial 8 -dnl Copyright (C) 2016-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2016-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for getprogname or replacements for it 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 @@ # gl-openssl.m4 # serial 7 -dnl Copyright (C) 2013-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2013-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT], [ 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 @@ -# Copyright (C) 2002-2024 Free Software Foundation, Inc. +# Copyright (C) 2002-2025 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # 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 @@ # gnulib-common.m4 -# serial 93 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 113 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.62]) @@ -19,44 +20,62 @@ AC_DEFUN([gl_COMMON_BODY], [ AH_VERBATIM([0witness], [/* Witness that has been included. */ #define _GL_CONFIG_H_INCLUDED 1 +]) + dnl Avoid warnings from gcc -Wtrailing-whitespace. + dnl This is a temporary workaround until Autoconf fixes it. + dnl Test case: + dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...]) + dnl should produce "#define FOO /**/", not "#define FOO ". + AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wtrailing-whitespace" +#endif +]) + AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ +# pragma GCC diagnostic pop +#endif ]) AH_VERBATIM([_GL_GNUC_PREREQ], -[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ -#if defined __GNUC__ && defined __GNUC_MINOR__ +[/* True if the compiler says it groks GNU C version MAJOR.MINOR. + Except that + - clang groks GNU C 4.2, even on Windows, where it does not define + __GNUC__. + - The OpenMandriva-modified clang compiler pretends that it groks + GNU C version 13.1, but it doesn't: It does not support + __attribute__ ((__malloc__ (f, i))), nor does it support + __attribute__ ((__warning__ (message))) on a function redeclaration. + - Users can make clang lie as well, through the -fgnuc-version option. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__ # define _GL_GNUC_PREREQ(major, minor) \ ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#elif defined __clang__ + /* clang really only groks GNU C 4.2. */ +# define _GL_GNUC_PREREQ(major, minor) \ + ((major) < 4 + ((minor) <= 2)) #else # define _GL_GNUC_PREREQ(major, minor) 0 #endif ]) AH_VERBATIM([_Noreturn], -[/* The _Noreturn keyword of C11. */ +[/* The _Noreturn keyword of C11. + Do not use [[noreturn]], because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would be valid only with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. So even though C23 deprecates _Noreturn, + it is currently more portable to prefer it to [[noreturn]]. + + Also, do not try to work around LLVM bug 59792 (clang 15 or earlier). + This rare bug can be worked around by compiling with 'clang -D_Noreturn=', + though the workaround may generate many false-alarm warnings. */ #ifndef _Noreturn -# if (defined __cplusplus \ - && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ - || (defined _MSC_VER && 1900 <= _MSC_VER)) \ - && 0) - /* [[noreturn]] is not practically usable, because with it the syntax - extern _Noreturn void func (...); - would not be valid; such a declaration would only be valid with 'extern' - and '_Noreturn' swapped, or without the 'extern' keyword. However, some - AIX system header files and several gnulib header files use precisely - this syntax with 'extern'. */ -# define _Noreturn [[noreturn]] -# elif (defined __clang__ && __clang_major__ < 16 \ - && defined _GL_WORK_AROUND_LLVM_BUG_59792) - /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around - that rare LLVM bug, though you may get many false-alarm warnings. */ -# define _Noreturn -# elif ((!defined __cplusplus || defined __clang__) \ - && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ - || (!defined __STRICT_ANSI__ \ - && (_GL_GNUC_PREREQ (4, 7) \ - || (defined __apple_build_version__ \ - ? 6000000 <= __apple_build_version__ \ - : 3 < __clang_major__ + (5 <= __clang_minor__)))))) +# if ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0))) /* _Noreturn works as-is. */ # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C + /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the + latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */ # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) @@ -90,6 +109,9 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) # else # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr +/* The following lines list the first GCC version that supports the attribute. + Although the lines are not used in GCC 5 and later (as GCC 5 introduced + __has_attribute support), list GCC versions 5+ anyway for completeness. */ # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) @@ -110,12 +132,15 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_nonnull_if_nonzero _GL_GNUC_PREREQ (15, 1) # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) +# define _GL_ATTR_reproducible _GL_GNUC_PREREQ (15, 1) # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) +# define _GL_ATTR_unsequenced _GL_GNUC_PREREQ (15, 1) # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) # endif @@ -131,6 +156,23 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_HAVE___HAS_C_ATTRIBUTE 0 #endif +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in function declarations. There are two problems here. + (Last tested with gcc/g++ 14 and clang/clang++ 18.) + + 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration + in any order. + =========================== foo.c = foo.cc =========================== + __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int); + [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int); + ====================================================================== + This gives a syntax error + - in C mode with gcc + , and + - in C++ mode with clang++ version < 16, and + - in C++ mode, inside extern "C" {}, still in newer clang++ versions + . + */ /* Define if, in a function declaration, the attributes in bracket syntax [[...]] must come before the attributes in __attribute__((...)) syntax. If this is defined, it is best to avoid the bracket syntax, so that the @@ -145,6 +187,176 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_BRACKET_BEFORE_ATTRIBUTE 1 # endif #endif +/* + 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration + - without 'extern', in C as well as in C++, + - with 'extern', in C, + - with 'extern "C"', in C++ + in the same position. That is, we don't want to be forced to use a + macro which arranges for the attribute to come before 'extern' in + one case and after 'extern' in the other case, because such a macro + would make the source code of .h files pretty ugly. + =========================== foo.c = foo.cc =========================== + #ifdef __cplusplus + # define CC "C" + #else + # define CC + #endif + + #define ND [[__nodiscard__]] + #define WUR __attribute__((__warn_unused_result__)) + + #ifdef __cplusplus + extern "C" { + #endif + // gcc clang g++ clang++ + + ND int foo (int); + int ND foo (int); // warn error warn error + int foo ND (int); + int foo (int) ND; // warn error warn error + + WUR int foo (int); + int WUR foo (int); + int fo1 WUR (int); // error error error error + int foo (int) WUR; + + #ifdef __cplusplus + } + #endif + + // gcc clang g++ clang++ + + ND extern CC int foo (int); // error error + extern CC ND int foo (int); // error error + extern CC int ND foo (int); // warn error warn error + extern CC int foo ND (int); + extern CC int foo (int) ND; // warn error warn error + + WUR extern CC int foo (int); // warn + extern CC WUR int foo (int); + extern CC int WUR foo (int); + extern CC int foo WUR (int); // error error error error + extern CC int foo (int) WUR; + + ND EXTERN_C_FUNC int foo (int); // error error + EXTERN_C_FUNC ND int foo (int); + EXTERN_C_FUNC int ND foo (int); // warn error warn error + EXTERN_C_FUNC int foo ND (int); + EXTERN_C_FUNC int foo (int) ND; // warn error warn error + + WUR EXTERN_C_FUNC int foo (int); // warn + EXTERN_C_FUNC WUR int foo (int); + EXTERN_C_FUNC int WUR foo (int); + EXTERN_C_FUNC int fo2 WUR (int); // error error error error + EXTERN_C_FUNC int foo (int) WUR; + ====================================================================== + So, if we insist on using the 'extern' keyword ('extern CC' idiom): + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] + in both C and C++, there is one available position: + - between the function name and the parameter list. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax + in both C and C++, there are several available positions: + - before the return type, + - between return type and function name, + - at the end of the declaration. + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to + __attribute__((...)) syntax in C++, there is no available position: + it would need to come before 'extern' in C but after 'extern "C"' + in C++. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and + to bracket syntax [[...]] in C++, there is one available position: + - before the return type. + Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally + omits the 'extern' keyword: + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] + in both C and C++, there are two available positions: + - before the return type, + - between the function name and the parameter list. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax + in both C and C++, there are several available positions: + - before the return type, + - between return type and function name, + - at the end of the declaration. + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to + __attribute__((...)) syntax in C++, there is one available position: + - before the return type. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and + to bracket syntax [[...]] in C++, there is one available position: + - before the return type. + The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and + put the attributes before the return type. This works regardless + to what the _GL_ATTRIBUTE_* macros expand. + */ + +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in static/inline function definitions. + + There are similar constraints as for function declarations. However, here, + we cannot omit the storage-class specifier. Therefore, the following rule + applies: + * The macros + _GL_ATTRIBUTE_CONST + _GL_ATTRIBUTE_DEPRECATED + _GL_ATTRIBUTE_MAYBE_UNUSED + _GL_ATTRIBUTE_NODISCARD + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_REPRODUCIBLE + _GL_ATTRIBUTE_UNSEQUENCED + which may expand to bracket syntax [[...]], must come first, before the + storage-class specifier. + * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax, + are better placed between the storage-class specifier and the return + type. + */ + +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in variable declarations. + + At which position can they be placed? + (Last tested with gcc/g++ 14 and clang/clang++ 18.) + + =========================== foo.c = foo.cc =========================== + #ifdef __cplusplus + # define CC "C" + #else + # define CC + #endif + + #define BD [[__deprecated__]] + #define AD __attribute__ ((__deprecated__)) + + // gcc clang g++ clang++ + + BD extern CC int var; // error error + extern CC BD int var; // error error + extern CC int BD var; // warn error warn error + extern CC int var BD; + + AD extern CC int var; // warn + extern CC AD int var; + extern CC int AD var; + extern CC int var AD; + + BD extern CC int z[]; // error error + extern CC BD int z[]; // error error + extern CC int BD z[]; // warn error warn error + extern CC int z1 BD []; + extern CC int z[] BD; // warn error error + + AD extern CC int z[]; // warn + extern CC AD int z[]; + extern CC int AD z[]; + extern CC int z2 AD []; // error error error error + extern CC int z[] AD; + ====================================================================== + + * For non-array variables, the only good position is after the variable name, + that is, at the end of the declaration. + * For array variables, you will need to distinguish C and C++: + - In C, before the 'extern' keyword. + - In C++, between the 'extern "C"' and the variable's type. + */ ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. [ /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function @@ -152,7 +364,7 @@ AC_DEFUN([gl_COMMON_BODY], [ _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied by the Nth argument of the function is the size of the returned memory block. */ -/* Applies to: function, pointer to function, function types. */ +/* Applies to: functions, pointer to functions, function types. */ #ifndef _GL_ATTRIBUTE_ALLOC_SIZE # if _GL_HAS_ATTRIBUTE (alloc_size) # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) @@ -163,7 +375,7 @@ AC_DEFUN([gl_COMMON_BODY], [ /* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the function and report an error if it cannot do so. */ -/* Applies to: function. */ +/* Applies to: functions. */ #ifndef _GL_ATTRIBUTE_ALWAYS_INLINE # if _GL_HAS_ATTRIBUTE (always_inline) # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) @@ -175,7 +387,7 @@ AC_DEFUN([gl_COMMON_BODY], [ /* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show in stack traces when debugging. The compiler should omit the function from stack traces. */ -/* Applies to: function. */ +/* Applies to: functions. */ #ifndef _GL_ATTRIBUTE_ARTIFICIAL # if _GL_HAS_ATTRIBUTE (artificial) # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) @@ -201,18 +413,23 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif #endif -/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate - calls to the function with the same arguments. - This attribute is safe for a function that neither depends on nor affects - observable state, and always returns exactly once - e.g., does not loop - forever, and does not call longjmp. - (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ +/* _GL_ATTRIBUTE_CONST declares: + It is OK for a compiler to move calls to the function and to omit + calls to the function if another call has the same arguments or the + result is not used. + This attribute is safe for a function that neither depends on + nor affects state, and always returns exactly once - + e.g., does not raise an exception, call longjmp, or loop forever. + (This attribute is stricter than _GL_ATTRIBUTE_PURE because the + function cannot observe state. It is stricter than + _GL_ATTRIBUTE_UNSEQUENCED because the function must return exactly + once and cannot depend on state addressed by its arguments.) */ /* Applies to: functions. */ #ifndef _GL_ATTRIBUTE_CONST # if _GL_HAS_ATTRIBUTE (const) # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) # else -# define _GL_ATTRIBUTE_CONST +# define _GL_ATTRIBUTE_CONST _GL_ATTRIBUTE_UNSEQUENCED # endif #endif @@ -460,6 +677,17 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif #endif +/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP + (a pointer) must not be NULL if the argument NI (an integer) is != 0. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO +# if _GL_HAS_ATTRIBUTE (nonnull_if_nonzero) +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) __attribute__ ((__nonnull_if_nonzero__ (np, ni))) +# else +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) +# endif +#endif + /* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is not meant to be NUL-terminated. */ /* Applies to: struct/union members and variables that are arrays of element @@ -481,7 +709,7 @@ AC_DEFUN([gl_COMMON_BODY], [ other attributes. */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 +# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -505,9 +733,9 @@ AC_DEFUN([gl_COMMON_BODY], [ minimizing the memory required. */ /* Applies to: struct members, struct, union, in C++ also: class. */ +#ifndef _GL_ATTRIBUTE_PACKED /* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite __has_attribute OK. */ -#ifndef _GL_ATTRIBUTE_PACKED # if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) # else @@ -515,18 +743,51 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif #endif -/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate - calls to the function with the same arguments if observable state is not - changed between calls. - This attribute is safe for a function that does not affect - observable state, and always returns exactly once. - (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ +/* _GL_ATTRIBUTE_PURE declares: + It is OK for a compiler to move calls to the function and to omit + calls to the function if another call has the same arguments or the + result is not used, and if observable state is the same. + This attribute is safe for a function that does not affect observable state + and always returns exactly once. + (This attribute is looser than _GL_ATTRIBUTE_CONST because the function + can depend on observable state. It is stricter than + _GL_ATTRIBUTE_REPRODUCIBLE because the function must return exactly + once and cannot affect state addressed by its arguments.) */ /* Applies to: functions. */ #ifndef _GL_ATTRIBUTE_PURE # if _GL_HAS_ATTRIBUTE (pure) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define _GL_ATTRIBUTE_PURE +# define _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_REPRODUCIBLE +# endif +#endif + +/* _GL_ATTRIBUTE_REPRODUCIBLE declares: + It is OK for a compiler to move calls to the function and to omit duplicate + calls to the function with the same arguments, so long as the state + addressed by its arguments is the same and is updated in time for + the rest of the program. + This attribute is safe for a function that is effectless and idempotent; see + ISO C 23 § 6.7.12.7 for a definition of these terms. + (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because + the function need not be stateless and idempotent. It is looser + than _GL_ATTRIBUTE_PURE because the function need not return + exactly once and can affect state addressed by its arguments.) + See also and + . + ATTENTION! Efforts are underway to change the meaning of this attribute. + See . */ +/* Applies to: functions, pointer to functions, function types. */ +#ifndef _GL_ATTRIBUTE_REPRODUCIBLE +/* This may be revisited when gcc and clang support [[reproducible]] or possibly + __attribute__ ((__reproducible__)). */ +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAS_ATTRIBUTE (reproducible) +# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]] +# endif +# endif +# ifndef _GL_ATTRIBUTE_REPRODUCIBLE +# define _GL_ATTRIBUTE_REPRODUCIBLE # endif #endif @@ -554,6 +815,35 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif #endif +/* _GL_ATTRIBUTE_UNSEQUENCED declares: + It is OK for a compiler to move calls to the function and to omit duplicate + calls to the function with the same arguments, so long as the state + addressed by its arguments is the same. + This attribute is safe for a function that is effectless, idempotent, + stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of + these terms. + (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because + the function must be stateless and independent. It is looser than + _GL_ATTRIBUTE_CONST because the function need not return exactly + once and can depend on state addressed by its arguments.) + See also and + . + ATTENTION! Efforts are underway to change the meaning of this attribute. + See . */ +/* Applies to: functions, pointer to functions, function types. */ +#ifndef _GL_ATTRIBUTE_UNSEQUENCED +/* This may be revisited when gcc and clang support [[unsequenced]] or possibly + __attribute__ ((__unsequenced__)). */ +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAS_ATTRIBUTE (unsequenced) +# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]] +# endif +# endif +# ifndef _GL_ATTRIBUTE_UNSEQUENCED +# define _GL_ATTRIBUTE_UNSEQUENCED +# endif +#endif + /* A helper macro. Don't use it directly. */ #ifndef _GL_ATTRIBUTE_UNUSED # if _GL_HAS_ATTRIBUTE (unused) @@ -578,6 +868,35 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_UNUSED_LABEL # endif #endif + +/* The following attributes enable detection of multithread-safety problems + and resource leaks at compile-time, by clang ≥ 15, when the warning option + -Wthread-safety is enabled. For usage, see + . */ +#ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE +# if __clang_major__ >= 15 +# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \ + __attribute__ ((__capability__ (concept))) +# else +# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) +# endif +#endif +#ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY +# if __clang_major__ >= 15 +# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \ + __attribute__ ((__acquire_capability__ (resource))) +# else +# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) +# endif +#endif +#ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY +# if __clang_major__ >= 15 +# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \ + __attribute__ ((__release_capability__ (resource))) +# else +# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) +# endif +#endif ]) AH_VERBATIM([c_linkage], [/* In C++, there is the concept of "language linkage", that encompasses @@ -628,8 +947,8 @@ AC_DEFUN([gl_COMMON_BODY], [ -1 if n1 < n2 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional jump with nearly all GCC versions up to GCC 10. - This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many - GCC versions up to GCC 9. + This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with + many GCC versions up to GCC 9. The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 avoids conditional jumps in all GCC versions >= 3.4. */ #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) @@ -1006,7 +1325,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS], AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([for C compiler option to allow warnings], [gl_cv_cc_wallow], - [rm -f conftest* + [rm -fr conftest* echo 'int dummy;' > conftest.c AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null 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], else gl_cv_cc_wallow=none fi - rm -f conftest* + rm -fr conftest* ]) case "$gl_cv_cc_wallow" in none) GL_CFLAG_ALLOW_WARNINGS='' ;; @@ -1037,7 +1356,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS], if test -n "$CXX" && test "$CXX" != no; then AC_CACHE_CHECK([for C++ compiler option to allow warnings], [gl_cv_cxx_wallow], - [rm -f conftest* + [rm -fr conftest* echo 'int dummy;' > conftest.cc AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null 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], else gl_cv_cxx_wallow=none fi - rm -f conftest* + rm -fr conftest* ]) case "$gl_cv_cxx_wallow" in none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; @@ -1087,11 +1406,12 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], dnl -Wno-type-limits >= 4.3 >= 3.9 dnl -Wno-undef >= 3 >= 3.9 dnl -Wno-unsuffixed-float-constants >= 4.5 + dnl -Wno-unused-const-variable >= 4.4 >= 3.9 dnl -Wno-unused-function >= 3 >= 3.9 dnl -Wno-unused-parameter >= 3 >= 3.9 dnl cat > conftest.c <<\EOF - #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-cast-qual -Wno-conversion -Wno-float-equal @@ -1100,23 +1420,26 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], -Wno-unused-function -Wno-unused-parameter #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-float-conversion #endif - #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wimplicit-fallthrough #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-pedantic #endif #if 3 < __clang_major__ + (9 <= __clang_minor__) -Wno-tautological-constant-out-of-range-compare #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-sign-conversion -Wno-type-limits #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 + #if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) + -Wno-unused-const-variable + #endif + #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__) -Wno-unsuffixed-float-constants #endif EOF @@ -1240,13 +1563,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS], if test $[ac_cv_func_][$1] = yes; then [gl_cv_onwards_func_][$1]=yes else + dnl This is a bit complicated, because here we need the behaviour + dnl of AC_CHECK_DECL before the + dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26). + [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]" unset [ac_cv_have_decl_][$1] + ac_c_future_darwin_options_saved="$ac_c_future_darwin_options" + ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options" + ac_c_future_darwin_options= + ac_cxx_future_darwin_options= AC_CHECK_DECL([$1], , , [$2]) + ac_c_future_darwin_options="$ac_c_future_darwin_options_saved" + ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved" if test $[ac_cv_have_decl_][$1] = yes; then [gl_cv_onwards_func_][$1]='future OS version' else [gl_cv_onwards_func_][$1]=no fi + [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]" + unset [ac_cv_have_decl_][$1][_saved] fi else AC_CHECK_FUNC([$1]) @@ -1299,7 +1634,7 @@ dnl dnl This macro sets two variables: dnl - gl_cv_onwards_func_ to yes / no / "future OS version" dnl - ac_cv_func_ to yes / no / no -dnl The first variable allows to distinguish all three cases. +dnl The first variable allows distinguishing all three cases. dnl The second variable is set, so that an invocation dnl gl_CHECK_FUNCS_ANDROID([func], [[#include ]]) dnl can be used as a drop-in replacement for @@ -1352,7 +1687,7 @@ dnl dnl This macro sets two variables: dnl - gl_cv_onwards_func_ to yes / no / "future OS version" dnl - ac_cv_func_ to yes / no / no -dnl The first variable allows to distinguish all three cases. +dnl The first variable allows distinguishing all three cases. dnl The second variable is set, so that an invocation dnl gl_CHECK_FUNCS_MACOS([func], [[#include ]]) dnl 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 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2024 Free Software Foundation, Inc. +# Copyright (C) 2002-2025 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,14 +45,30 @@ AC_DEFUN([gl_EARLY], # Code from module absolute-header: # Code from module alignasof: # Code from module alloca-opt: - # Code from module arpa_inet: + # Code from module arpa_inet-h: # Code from module assert-h: # Code from module attribute: # Code from module base64: # Code from module basename-lgpl: + # Code from module bool: # Code from module btowc: # Code from module builtin-expect: # Code from module byteswap: + # Code from module c-ctype: + # Code from module c32isalnum: + # Code from module c32isalpha: + # Code from module c32isblank: + # Code from module c32iscntrl: + # Code from module c32isdigit: + # Code from module c32isgraph: + # Code from module c32islower: + # Code from module c32isprint: + # Code from module c32ispunct: + # Code from module c32isspace: + # Code from module c32isupper: + # Code from module c32isxdigit: + # Code from module c32tolower: + # Code from module c32width: # Code from module c99: # Code from module calloc-gnu: # Code from module calloc-posix: @@ -66,11 +82,15 @@ AC_DEFUN([gl_EARLY], # Code from module double-slash-root: # Code from module dup2: # Code from module environ: - # Code from module errno: + # Code from module errno-h: # Code from module error: # Code from module error-h: # Code from module exitfail: # Code from module extensions: + # This is actually already done in the pre-early phase. + # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + # Code from module extensions-aix: + AC_REQUIRE([gl_USE_AIX_EXTENSIONS]) # Code from module extern-inline: # Code from module fcntl: # Code from module fcntl-h: @@ -78,7 +98,7 @@ AC_DEFUN([gl_EARLY], # Code from module fflush: AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) # Code from module filename: - # Code from module float: + # Code from module float-h: # Code from module floorf: # Code from module fopen: # Code from module fopen-gnu: @@ -88,6 +108,7 @@ AC_DEFUN([gl_EARLY], # Code from module fseek: # Code from module fseeko: AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) + # Code from module fseterr: # Code from module fstat: # Code from module fsusage: # Code from module ftell: @@ -105,6 +126,7 @@ AC_DEFUN([gl_EARLY], # Code from module getprogname: # Code from module gettext-h: # Code from module glibc-internal/dynarray: + # Code from module gnulib-i18n: # Code from module hard-locale: # Code from module hostent: # Code from module ialloc: @@ -112,29 +134,35 @@ AC_DEFUN([gl_EARLY], # Code from module idx: # Code from module include_next: # Code from module inet_ntop: + # Code from module inet_pton: # Code from module intprops: - # Code from module inttypes-incomplete: + # Code from module inttypes-h-incomplete: # Code from module iswblank: # Code from module iswctype: # Code from module iswdigit: # Code from module iswpunct: # Code from module iswxdigit: - # Code from module langinfo: + # Code from module langinfo-h: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) # Code from module libc-config: # Code from module limits-h: # Code from module localcharset: - # Code from module locale: + # Code from module locale-h: # Code from module localeconv: # Code from module lock: # Code from module lseek: + # Code from module lstat: # Code from module malloc-gnu: # Code from module malloc-posix: # Code from module malloca: - # Code from module math: + # Code from module math-h: + # Code from module mbchar: + # Code from module mbiterf: + # Code from module mbrtoc32: # Code from module mbrtowc: # Code from module mbsinit: + # Code from module mbsnlen: # Code from module mbszero: # Code from module mbtowc: # Code from module memchr: @@ -145,16 +173,20 @@ AC_DEFUN([gl_EARLY], # Code from module msvc-inval: # Code from module msvc-nothrow: # Code from module multiarch: - # Code from module netdb: - # Code from module netinet_in: + # Code from module netdb-h: + # Code from module netinet_in-h: # Code from module nl_langinfo: # Code from module nocrash: + # Code from module once: # Code from module open: # Code from module pathmax: - # Code from module realloc-gnu: + # Code from module pthread-h: + gl_ANYTHREADLIB_EARLY + # Code from module pthread-once: # Code from module realloc-posix: # Code from module reallocarray: # Code from module regex: + # Code from module sched-h: # Code from module servent: # Code from module setenv: # Code from module setlocale-null: @@ -172,33 +204,56 @@ AC_DEFUN([gl_EARLY], # Code from module stat: # Code from module stat-time: # Code from module std-gnu11: - # Code from module stdbool: - # Code from module stdckdint: - # Code from module stddef: - # Code from module stdint: - # Code from module stdio: + # Code from module stdckdint-h: + # Code from module stddef-h: + # Code from module stdint-h: + # Code from module stdio-h: gl_STDIO_H_EARLY - # Code from module stdlib: + # Code from module stdlib-h: # Code from module strcase: + # Code from module strcasecmp: # Code from module strcasestr: # Code from module strcasestr-simple: # Code from module streq: # Code from module strerror: # Code from module strerror-override: - # Code from module string: - # Code from module strings: + # Code from module string-h: + # Code from module strings-h: + # Code from module strncasecmp: + # Code from module strncpy: # Code from module strsep: # Code from module strstr-simple: - # Code from module sys_socket: - # Code from module sys_stat: - # Code from module sys_types: - # Code from module sys_uio: + # Code from module sys_socket-h: + # Code from module sys_stat-h: + # Code from module sys_types-h: + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + # Code from module sys_uio-h: # Code from module threadlib: gl_THREADLIB_EARLY # Code from module time-h: # Code from module time_r: # Code from module timegm: - # Code from module unistd: + # Code from module uchar-h: + # Code from module unicase/base: + # Code from module unicase/tolower: + # Code from module unictype/base: + # Code from module unictype/ctype-alnum: + # Code from module unictype/ctype-alpha: + # Code from module unictype/ctype-blank: + # Code from module unictype/ctype-cntrl: + # Code from module unictype/ctype-digit: + # Code from module unictype/ctype-graph: + # Code from module unictype/ctype-lower: + # Code from module unictype/ctype-print: + # Code from module unictype/ctype-punct: + # Code from module unictype/ctype-space: + # Code from module unictype/ctype-upper: + # Code from module unictype/ctype-xdigit: + # Code from module uninorm/base: + # Code from module unistd-h: + # Code from module unitypes-h: + # Code from module uniwidth/base: + # Code from module uniwidth/width: # Code from module unlocked-io-internal: # Code from module unsetenv: # Code from module vararrays: @@ -206,10 +261,12 @@ AC_DEFUN([gl_EARLY], # Code from module vasprintf: # Code from module verify: # Code from module vsnprintf: - # Code from module wchar: + # Code from module vsnzprintf: + # Code from module wchar-h: # Code from module wcrtomb: # Code from module wctype: # Code from module wctype-h: + # Code from module wcwidth: # Code from module windows-mutex: # Code from module windows-once: # Code from module windows-recmutex: @@ -250,6 +307,7 @@ AC_DEFUN([gl_INIT], gl_CONDITIONAL_HEADER([assert.h]) AC_PROG_MKDIR_P gl_FUNC_BASE64 + gl_C_BOOL gl_FUNC_BTOWC gl_CONDITIONAL([GL_COND_OBJ_BTOWC], [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) @@ -261,6 +319,104 @@ AC_DEFUN([gl_INIT], gl_BYTESWAP gl_CONDITIONAL_HEADER([byteswap.h]) AC_PROG_MKDIR_P + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isalnum]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isalpha]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isblank]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32iscntrl]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isdigit]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isgraph]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32islower]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isprint]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32ispunct]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isspace]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isupper]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isxdigit]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32tolower]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32width]) gl_FUNC_CALLOC_GNU if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then AC_LIBOBJ([calloc]) @@ -275,6 +431,7 @@ AC_DEFUN([gl_INIT], gl_FUNC_CLOSE gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) gl_UNISTD_MODULE_INDICATOR([close]) + gl_MODULE_INDICATOR([close]) gl_AF_ALG AC_REQUIRE([AC_C_RESTRICT]) gl_SHA256 @@ -320,8 +477,11 @@ AC_DEFUN([gl_INIT], gl_FLOAT_H gl_CONDITIONAL_HEADER([float.h]) AC_PROG_MKDIR_P - gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) + gl_CONDITIONAL([GL_COND_OBJ_FLOAT], + [test $REPLACE_FLOAT_LDBL = 1 || test $REPLACE_FLOAT_SNAN = 1]) gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) + dnl Prerequisites of lib/float.c. + AC_REQUIRE([gl_BIGENDIAN]) gl_FUNC_FLOORF gl_CONDITIONAL([GL_COND_OBJ_FLOORF], [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) @@ -360,6 +520,8 @@ AC_DEFUN([gl_INIT], gl_PREREQ_FSEEKO ]) gl_STDIO_MODULE_INDICATOR([fseeko]) + gl_FUNC_FSETERR + gl_CONDITIONAL([GL_COND_OBJ_FSETERR], [test $ac_cv_func___fseterr = no]) gl_FUNC_FSTAT gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) AM_COND_IF([GL_COND_OBJ_FSTAT], [ @@ -371,6 +533,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_FSTAT ]) gl_SYS_STAT_MODULE_INDICATOR([fstat]) + gl_MODULE_INDICATOR([fstat]) gl_FSUSAGE gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ @@ -412,6 +575,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_GETHOSTNAME ]) gl_UNISTD_MODULE_INDICATOR([gethostname]) + gl_MODULE_INDICATOR([gethostname]) gl_FUNC_GETLINE gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) AM_COND_IF([GL_COND_OBJ_GETLINE], [ @@ -441,6 +605,8 @@ AC_DEFUN([gl_INIT], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) ]) gl_UNISTD_MODULE_INDICATOR([getopt-posix]) + gl_MUSL_LIBC + AC_REQUIRE([AC_CANONICAL_HOST]) gl_FUNC_GETPROGNAME gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) @@ -451,6 +617,7 @@ AC_DEFUN([gl_INIT], AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) AC_PROG_MKDIR_P + GNULIB_I18N AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" AC_SUBST([HARD_LOCALE_LIB]) @@ -466,6 +633,13 @@ AC_DEFUN([gl_INIT], gl_PREREQ_INET_NTOP ]) gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) + gl_FUNC_INET_PTON + gl_CONDITIONAL([GL_COND_OBJ_INET_PTON], + [test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1]) + AM_COND_IF([GL_COND_OBJ_INET_PTON], [ + gl_PREREQ_INET_PTON + ]) + gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) gl_INTTYPES_INCOMPLETE gl_INTTYPES_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P @@ -510,11 +684,19 @@ AC_DEFUN([gl_INIT], gl_PREREQ_LOCALECONV ]) gl_LOCALE_MODULE_INDICATOR([localeconv]) + gl_MODULE_INDICATOR([localeconv]) gl_LOCK gl_MODULE_INDICATOR([lock]) gl_FUNC_LSEEK gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) gl_UNISTD_MODULE_INDICATOR([lseek]) + gl_FUNC_LSTAT + gl_CONDITIONAL([GL_COND_OBJ_LSTAT], [test $REPLACE_LSTAT = 1]) + AM_COND_IF([GL_COND_OBJ_LSTAT], [ + gl_PREREQ_LSTAT + ]) + gl_SYS_STAT_MODULE_INDICATOR([lstat]) + gl_MODULE_INDICATOR([lstat]) gl_FUNC_MALLOC_GNU if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then AC_LIBOBJ([malloc]) @@ -529,6 +711,20 @@ AC_DEFUN([gl_INIT], gl_MATH_H gl_MATH_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_MBCHAR + gl_MBITER + gl_FUNC_MBRTOC32 + gl_CONDITIONAL([GL_COND_OBJ_MBRTOC32], + [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1]) + AM_COND_IF([GL_COND_OBJ_MBRTOC32], [ + if test $REPLACE_MBSTATE_T = 1; then + AC_LIBOBJ([lc-charset-dispatch]) + AC_LIBOBJ([mbtowc-lock]) + gl_PREREQ_MBTOWC_LOCK + fi + gl_PREREQ_MBRTOC32 + ]) + gl_UCHAR_MODULE_INDICATOR([mbrtoc32]) gl_FUNC_MBRTOWC gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) @@ -548,6 +744,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_MBSINIT ]) gl_WCHAR_MODULE_INDICATOR([mbsinit]) + gl_STRING_MODULE_INDICATOR([mbsnlen]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN gl_MUSL_LIBC @@ -578,10 +775,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_MKTIME fi gl_MOUNTLIST - gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) - AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [ - gl_PREREQ_MOUNTLIST_EXTRA - ]) + gl_PREREQ_MOUNTLIST_EXTRA AC_REQUIRE([gl_MSVC_INVAL]) gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) @@ -605,6 +799,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_NL_LANGINFO_LOCK fi gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) + gl_ONCE gl_FUNC_OPEN gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) AM_COND_IF([GL_COND_OBJ_OPEN], [ @@ -612,15 +807,17 @@ AC_DEFUN([gl_INIT], ]) gl_FCNTL_MODULE_INDICATOR([open]) gl_PATHMAX - gl_FUNC_REALLOC_GNU - if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then - AC_LIBOBJ([realloc]) - fi - gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) + gl_PTHREAD_H + gl_PTHREAD_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_PTHREAD_ONCE + gl_CONDITIONAL([GL_COND_OBJ_PTHREAD_ONCE], + [test $HAVE_PTHREAD_ONCE = 0 || test $REPLACE_PTHREAD_ONCE = 1]) + gl_PTHREAD_MODULE_INDICATOR([pthread-once]) gl_FUNC_REALLOC_POSIX - if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then - AC_LIBOBJ([realloc]) - fi + gl_FUNC_REALLOC_0_NONNULL + gl_CONDITIONAL([GL_COND_OBJ_REALLOC_POSIX], + [test $REPLACE_REALLOC_FOR_REALLOC_POSIX != 0]) gl_STDLIB_MODULE_INDICATOR([realloc-posix]) gl_FUNC_REALLOCARRAY gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], @@ -635,6 +832,9 @@ AC_DEFUN([gl_INIT], AM_COND_IF([GL_COND_OBJ_REGEX], [ gl_PREREQ_REGEX ]) + gl_SCHED_H + gl_SCHED_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_SERVENT gl_FUNC_SETENV gl_CONDITIONAL([GL_COND_OBJ_SETENV], @@ -666,15 +866,10 @@ AC_DEFUN([gl_INIT], gl_PREREQ_STAT ]) gl_SYS_STAT_MODULE_INDICATOR([stat]) + gl_MODULE_INDICATOR([stat]) gl_STAT_TIME gl_STAT_BIRTHTIME - gl_C_BOOL - AC_CHECK_HEADERS_ONCE([stdckdint.h]) - if test $ac_cv_header_stdckdint_h = yes; then - GL_GENERATE_STDCKDINT_H=false - else - GL_GENERATE_STDCKDINT_H=true - fi + gl_STDCKDINT_H gl_CONDITIONAL_HEADER([stdckdint.h]) AC_PROG_MKDIR_P gl_STDDEF_H @@ -689,6 +884,19 @@ AC_DEFUN([gl_INIT], gl_STDIO_H gl_STDIO_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + USES_MSVCRT=0 + case "$host_os" in + mingw* | windows*) + AC_EGREP_CPP([Special], [ + #ifndef _UCRT + Special + #endif + ], + [USES_MSVCRT=1]) + ;; + esac + gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1]) + AC_CHECK_FUNCS([vasprintf]) gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) dnl No need to create extra modules for these functions. Everyone who uses @@ -717,15 +925,13 @@ AC_DEFUN([gl_INIT], gl_STDLIB_H gl_STDLIB_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - gl_STRCASE - gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0]) + gl_FUNC_STRCASECMP + gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], + [test $HAVE_STRCASECMP = 0 || test $REPLACE_STRCASECMP = 1]) AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ gl_PREREQ_STRCASECMP ]) - gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0]) - AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [ - gl_PREREQ_STRNCASECMP - ]) + gl_STRINGS_MODULE_INDICATOR([strcasecmp]) gl_FUNC_STRCASESTR if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then AC_LIBOBJ([strcasestr]) @@ -754,6 +960,19 @@ AC_DEFUN([gl_INIT], gl_STRINGS_H gl_STRINGS_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_FUNC_STRNCASECMP + gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], + [test $HAVE_STRNCASECMP = 0 || test $REPLACE_STRNCASECMP = 1]) + AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [ + gl_PREREQ_STRNCASECMP + ]) + gl_STRINGS_MODULE_INDICATOR([strncasecmp]) + gl_FUNC_STRNCPY + gl_CONDITIONAL([GL_COND_OBJ_STRNCPY], [test $REPLACE_STRNCPY = 1]) + AM_COND_IF([GL_COND_OBJ_STRNCPY], [ + gl_PREREQ_STRNCPY + ]) + gl_STRING_MODULE_INDICATOR([strncpy]) gl_FUNC_STRSEP gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) AM_COND_IF([GL_COND_OBJ_STRSEP], [ @@ -795,9 +1014,55 @@ AC_DEFUN([gl_INIT], gl_PREREQ_TIMEGM ]) gl_TIME_MODULE_INDICATOR([timegm]) + gl_UCHAR_H + gl_UCHAR_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_LIBUNISTRING_LIBHEADER([1.2], [unicase.h]) + gl_UNICASE_H + gl_UNICASE_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([1.3], [unicase/tolower]) + gl_LIBUNISTRING_LIBHEADER([1.3], [unictype.h]) + gl_UNICTYPE_H + gl_UNICTYPE_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alnum]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alpha]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-blank]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-cntrl]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-digit]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-graph]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-lower]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-print]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-punct]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-space]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-upper]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-xdigit]) + gl_LIBUNISTRING_LIBHEADER([1.2], [uninorm.h]) + gl_UNINORM_H + gl_UNINORM_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_UNISTD_H gl_UNISTD_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h]) + AC_PROG_MKDIR_P + gl_UNITYPES_H + gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h]) + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([1.3], [uniwidth/width]) gl_FUNC_GLIBC_UNLOCKED_IO gl_FUNC_UNSETENV gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], @@ -816,6 +1081,7 @@ AC_DEFUN([gl_INIT], AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) gl_FUNC_VSNPRINTF gl_STDIO_MODULE_INDICATOR([vsnprintf]) + gl_STDIO_MODULE_INDICATOR([vsnzprintf]) gl_WCHAR_H gl_WCHAR_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P @@ -832,6 +1098,13 @@ AC_DEFUN([gl_INIT], gl_WCTYPE_H gl_WCTYPE_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_FUNC_WCWIDTH + gl_CONDITIONAL([GL_COND_OBJ_WCWIDTH], + [test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1]) + AM_COND_IF([GL_COND_OBJ_WCWIDTH], [ + gl_PREREQ_WCWIDTH + ]) + gl_WCHAR_MODULE_INDICATOR([wcwidth]) AC_REQUIRE([AC_CANONICAL_HOST]) gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) @@ -871,27 +1144,35 @@ AC_DEFUN([gl_INIT], gl_libobjs= gl_ltlibobjs= gl_libobjdeps= + gl_libgnu_libobjs= + gl_libgnu_ltlibobjs= + gl_libgnu_libobjdeps= if test -n "$gl_LIBOBJS"; then # Remove the extension. changequote(,)dnl sed_drop_objext='s/\.o$//;s/\.obj$//' sed_dirname1='s,//*,/,g' sed_dirname2='s,\(.\)/$,\1,' - sed_dirname3='s,^[^/]*$,.,' - sed_dirname4='s,\(.\)/[^/]*$,\1,' + sed_dirname3='s,[^/]*$,,' sed_basename1='s,.*/,,' changequote([, ])dnl for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" - i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` + i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"` i_base=`echo "$i" | sed -e "$sed_basename1"` - gl_libobjdeps="$gl_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" + gl_libgnu_libobjs="$gl_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext" + gl_libgnu_ltlibobjs="$gl_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo" + gl_libobjdeps="$gl_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po" + gl_libgnu_libobjdeps="$gl_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po" done fi AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) + AC_SUBST([gl_libgnu_LIBOBJS], [$gl_libgnu_libobjs]) + AC_SUBST([gl_libgnu_LTLIBOBJS], [$gl_libgnu_ltlibobjs]) + AC_SUBST([gl_libgnu_LIBOBJDEPS], [$gl_libgnu_libobjdeps]) ]) gltests_libdeps= gltests_ltlibdeps= @@ -934,27 +1215,35 @@ changequote([, ])dnl gltests_libobjs= gltests_ltlibobjs= gltests_libobjdeps= + gltests_libgnu_libobjs= + gltests_libgnu_ltlibobjs= + gltests_libgnu_libobjdeps= if test -n "$gltests_LIBOBJS"; then # Remove the extension. changequote(,)dnl sed_drop_objext='s/\.o$//;s/\.obj$//' sed_dirname1='s,//*,/,g' sed_dirname2='s,\(.\)/$,\1,' - sed_dirname3='s,^[^/]*$,.,' - sed_dirname4='s,\(.\)/[^/]*$,\1,' + sed_dirname3='s,[^/]*$,,' sed_basename1='s,.*/,,' changequote([, ])dnl for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" - i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` + i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"` i_base=`echo "$i" | sed -e "$sed_basename1"` - gltests_libobjdeps="$gltests_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" + gltests_libgnu_libobjs="$gltests_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext" + gltests_libgnu_ltlibobjs="$gltests_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo" + gltests_libobjdeps="$gltests_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po" + gltests_libgnu_libobjdeps="$gltests_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po" done fi AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) + AC_SUBST([gltests_libgnu_LIBOBJS], [$gltests_libgnu_libobjs]) + AC_SUBST([gltests_libgnu_LTLIBOBJS], [$gltests_libgnu_ltlibobjs]) + AC_SUBST([gltests_libgnu_LIBOBJDEPS], [$gltests_libgnu_libobjdeps]) ]) AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) LIBGNU_LIBDEPS="$gl_libdeps" @@ -1025,6 +1314,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/af_alg.h lib/alloca.in.h lib/arg-nonnull.h + lib/arpa_inet.c lib/arpa_inet.in.h lib/asnprintf.c lib/asprintf.c @@ -1036,8 +1326,27 @@ AC_DEFUN([gl_FILE_LIST], [ lib/basename-lgpl.h lib/basename.c lib/btowc.c + lib/byteswap.c lib/byteswap.in.h lib/c++defs.h + lib/c-ctype.c + lib/c-ctype.h + lib/c32is-impl.h + lib/c32isalnum.c + lib/c32isalpha.c + lib/c32isblank.c + lib/c32iscntrl.c + lib/c32isdigit.c + lib/c32isgraph.c + lib/c32islower.c + lib/c32isprint.c + lib/c32ispunct.c + lib/c32isspace.c + lib/c32isupper.c + lib/c32isxdigit.c + lib/c32to-impl.h + lib/c32tolower.c + lib/c32width.c lib/calloc.c lib/cdefs.h lib/cloexec.c @@ -1071,6 +1380,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/free.c lib/fseek.c lib/fseeko.c + lib/fseterr.c + lib/fseterr.h lib/fstat.c lib/fsusage.c lib/fsusage.h @@ -1098,6 +1409,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/gl_openssl.h lib/glthread/lock.c lib/glthread/lock.h + lib/glthread/once.c + lib/glthread/once.h lib/glthread/threadlib.c lib/hard-locale.c lib/hard-locale.h @@ -1107,6 +1420,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/idpriv.h lib/idx.h lib/inet_ntop.c + lib/inet_pton.c lib/intprops-internal.h lib/intprops.h lib/inttypes.in.h @@ -1127,6 +1441,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/locale.in.h lib/localeconv.c lib/lseek.c + lib/lstat.c lib/malloc.c lib/malloc/dynarray-skeleton.c lib/malloc/dynarray.h @@ -1139,10 +1454,16 @@ AC_DEFUN([gl_FILE_LIST], [ lib/malloca.h lib/math.c lib/math.in.h + lib/mbchar.c + lib/mbchar.h + lib/mbiterf.c + lib/mbiterf.h + lib/mbrtoc32.c lib/mbrtowc-impl-utf8.h lib/mbrtowc-impl.h lib/mbrtowc.c lib/mbsinit.c + lib/mbsnlen.c lib/mbszero.c lib/mbtowc-impl.h lib/mbtowc-lock.c @@ -1169,6 +1490,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/printf-args.h lib/printf-parse.c lib/printf-parse.h + lib/pthread-once.c + lib/pthread.in.h lib/realloc.c lib/reallocarray.c lib/regcomp.c @@ -1177,6 +1500,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/regex_internal.c lib/regex_internal.h lib/regexec.c + lib/sched.in.h lib/setenv.c lib/setlocale-lock.c lib/setlocale_null-unlocked.c @@ -1197,10 +1521,12 @@ AC_DEFUN([gl_FILE_LIST], [ lib/stdckdint.in.h lib/stddef.in.h lib/stdint.in.h + lib/stdio-consolesafe.c lib/stdio-impl.h lib/stdio-read.c lib/stdio-write.c lib/stdio.in.h + lib/stdlib.c lib/stdlib.in.h lib/str-two-way.h lib/strcasecmp.c @@ -1213,6 +1539,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/strings.in.h lib/stripslash.c lib/strncasecmp.c + lib/strncpy.c lib/strsep.c lib/strstr.c lib/sys-limits.h @@ -1224,8 +1551,46 @@ AC_DEFUN([gl_FILE_LIST], [ lib/time.in.h lib/time_r.c lib/timegm.c + lib/uchar.in.h + lib/unicase.in.h + lib/unicase/simple-mapping.h + lib/unicase/tolower.c + lib/unicase/tolower.h + lib/unictype.in.h + lib/unictype/bitmap.h + lib/unictype/ctype_alnum.c + lib/unictype/ctype_alnum.h + lib/unictype/ctype_alpha.c + lib/unictype/ctype_alpha.h + lib/unictype/ctype_blank.c + lib/unictype/ctype_blank.h + lib/unictype/ctype_cntrl.c + lib/unictype/ctype_cntrl.h + lib/unictype/ctype_digit.c + lib/unictype/ctype_digit.h + lib/unictype/ctype_graph.c + lib/unictype/ctype_graph.h + lib/unictype/ctype_lower.c + lib/unictype/ctype_lower.h + lib/unictype/ctype_print.c + lib/unictype/ctype_print.h + lib/unictype/ctype_punct.c + lib/unictype/ctype_punct.h + lib/unictype/ctype_space.c + lib/unictype/ctype_space.h + lib/unictype/ctype_upper.c + lib/unictype/ctype_upper.h + lib/unictype/ctype_xdigit.c + lib/unictype/ctype_xdigit.h + lib/uninorm.in.h lib/unistd.c lib/unistd.in.h + lib/unitypes.in.h + lib/uniwidth.in.h + lib/uniwidth/cjk.h + lib/uniwidth/width.c + lib/uniwidth/width0.h + lib/uniwidth/width2.h lib/unlocked-io.h lib/unsetenv.c lib/vasnprintf.c @@ -1233,6 +1598,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/vasprintf.c lib/verify.h lib/vsnprintf.c + lib/vsnzprintf.c lib/w32sock.h lib/warn-on-use.h lib/wchar.in.h @@ -1241,6 +1607,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/wctype-impl.h lib/wctype.c lib/wctype.in.h + lib/wcwidth.c lib/windows-initguard.h lib/windows-mutex.c lib/windows-mutex.h @@ -1265,20 +1632,22 @@ AC_DEFUN([gl_FILE_LIST], [ m4/assert_h.m4 m4/base64.m4 m4/btowc.m4 + m4/build-to-host.m4 m4/builtin-expect.m4 m4/byteswap.m4 m4/c-bool.m4 + m4/c32rtomb.m4 m4/calloc.m4 m4/close.m4 m4/codeset.m4 m4/double-slash-root.m4 m4/dup2.m4 - m4/eealloc.m4 m4/environ.m4 m4/errno_h.m4 m4/error.m4 m4/error_h.m4 m4/exponentd.m4 + m4/extensions-aix.m4 m4/extensions.m4 m4/extern-inline.m4 m4/fclose.m4 @@ -1294,6 +1663,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/free.m4 m4/fseek.m4 m4/fseeko.m4 + m4/fseterr.m4 m4/fstat.m4 m4/fstypename.m4 m4/fsusage.m4 @@ -1309,10 +1679,12 @@ AC_DEFUN([gl_FILE_LIST], [ m4/getprogname.m4 m4/gl-openssl.m4 m4/gnulib-common.m4 + m4/gnulib-i18n.m4 m4/hostent.m4 m4/idpriv.m4 m4/include_next.m4 m4/inet_ntop.m4 + m4/inet_pton.m4 m4/intmax_t.m4 m4/inttypes.m4 m4/inttypes_h.m4 @@ -1323,8 +1695,10 @@ AC_DEFUN([gl_FILE_LIST], [ m4/iswxdigit.m4 m4/langinfo_h.m4 m4/largefile.m4 + m4/libunistring-base.m4 m4/limits-h.m4 m4/localcharset.m4 + m4/locale-en.m4 m4/locale-fr.m4 m4/locale-ja.m4 m4/locale-zh.m4 @@ -1332,9 +1706,13 @@ AC_DEFUN([gl_FILE_LIST], [ m4/localeconv.m4 m4/lock.m4 m4/lseek.m4 + m4/lstat.m4 m4/malloc.m4 m4/malloca.m4 m4/math_h.m4 + m4/mbchar.m4 + m4/mbiter.m4 + m4/mbrtoc32.m4 m4/mbrtowc.m4 m4/mbsinit.m4 m4/mbstate_t.m4 @@ -1353,17 +1731,23 @@ AC_DEFUN([gl_FILE_LIST], [ m4/netinet_in_h.m4 m4/nl_langinfo.m4 m4/nocrash.m4 + m4/off64_t.m4 m4/off_t.m4 + m4/once.m4 m4/open-cloexec.m4 m4/open-slash.m4 m4/open.m4 m4/pathmax.m4 m4/pid_t.m4 m4/printf.m4 + m4/pthread-once.m4 + m4/pthread-spin.m4 + m4/pthread_h.m4 m4/pthread_rwlock_rdlock.m4 m4/realloc.m4 m4/reallocarray.m4 m4/regex.m4 + m4/sched_h.m4 m4/servent.m4 m4/setenv.m4 m4/setlocale_null.m4 @@ -1379,18 +1763,22 @@ AC_DEFUN([gl_FILE_LIST], [ m4/stat.m4 m4/std-gnu11.m4 m4/stdalign.m4 + m4/stdckdint_h.m4 m4/stddef_h.m4 m4/stdint.m4 m4/stdint_h.m4 m4/stdio_h.m4 m4/stdlib_h.m4 - m4/strcase.m4 + m4/strcasecmp.m4 m4/strcasestr.m4 m4/strerror.m4 m4/string_h.m4 m4/strings_h.m4 + m4/strncasecmp.m4 + m4/strncpy.m4 m4/strsep.m4 m4/strstr.m4 + m4/sys_cdefs_h.m4 m4/sys_socket_h.m4 m4/sys_stat_h.m4 m4/sys_types_h.m4 @@ -1399,8 +1787,13 @@ AC_DEFUN([gl_FILE_LIST], [ m4/time_h.m4 m4/time_r.m4 m4/timegm.m4 + m4/uchar_h.m4 m4/ungetc.m4 + m4/unicase_h.m4 + m4/unictype_h.m4 + m4/uninorm_h.m4 m4/unistd_h.m4 + m4/unitypes_h.m4 m4/unlocked-io.m4 m4/vararrays.m4 m4/vasnprintf.m4 @@ -1409,10 +1802,10 @@ AC_DEFUN([gl_FILE_LIST], [ m4/vsnprintf.m4 m4/warn-on-use.m4 m4/wchar_h.m4 - m4/wchar_t.m4 m4/wcrtomb.m4 m4/wctype.m4 m4/wctype_h.m4 + m4/wcwidth.m4 m4/wint_t.m4 m4/xalloc.m4 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 @@ +# gnulib-i18n.m4 +# serial 1 +dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. + +dnl Support for internationalization of Gnulib code. + +dnl GNULIB_I18N +dnl Sets GNULIB_LOCALEDIR to indicate where to find the gnulib.mo files. +dnl Also it defines GNULIB_LOCALEDIR as macro in config.h, that expands to +dnl the corresponding C string. +AC_DEFUN([GNULIB_I18N], +[ + dnl It is best to not test "$USE_NLS" here, because: It would be empty + dnl in case the package is internationalized but this macro is used before + dnl AM_GNU_GETTEXT. We would need to warn about this situation. But since + dnl this module is used as a dependency of many packages, such a warning is + dnl not welcome. + + dnl Determine gnulib's localedir. + dnl Generally, accept an option --with-gnulib-prefix=PREFIX to indicate + dnl where to find gnulib's runtime data. + dnl Usually ${prefix}/share/locale, but can be influenced by the configure + dnl options --datarootdir and --localedir. + GNULIB_LOCALEDIR="${localedir}" + AC_ARG_WITH([gnulib-prefix], + [[ --with-gnulib-prefix=DIR search for gnulib's runtime data in DIR/share]], + [if test "X$withval" != "X" && test "X$withval" != "Xno"; then + GNULIB_LOCALEDIR="$withval/share/locale" + fi + ]) + AC_SUBST([GNULIB_LOCALEDIR]) + + dnl Define GNULIB_LOCALEDIR_c and GNULIB_LOCALEDIR_c_make. + dnl Find the final value of GNULIB_LOCALEDIR. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_localedir="${localedir}" + gl_saved_gnuliblocaledir="${GNULIB_LOCALEDIR}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval localedir="$localedir" + eval GNULIB_LOCALEDIR="$GNULIB_LOCALEDIR" + gl_BUILD_TO_HOST([GNULIB_LOCALEDIR]) + GNULIB_LOCALEDIR="${gl_saved_gnuliblocaledir}" + localedir="${gl_saved_localedir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" + + AC_DEFINE_UNQUOTED([GNULIB_LOCALEDIR], [${GNULIB_LOCALEDIR_c}], + [Define to the directory where to find the localizations of the translation domain 'gnulib', as a C string.]) +]) 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 @@ # gnulib-tool.m4 -# serial 4 -dnl Copyright (C) 2004-2005, 2009-2024 Free Software Foundation, Inc. +# serial 5 +dnl Copyright (C) 2004-2005, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl The following macros need not be invoked explicitly. dnl Invoking them does nothing except to declare default arguments @@ -42,6 +43,9 @@ AC_DEFUN([gl_LIB], []) dnl Usage: gl_LGPL or gl_LGPL([VERSION]) AC_DEFUN([gl_LGPL], []) +dnl Usage: gl_GPL([VERSION]) +AC_DEFUN([gl_GPL], []) + dnl Usage: gl_MAKEFILE_NAME([FILENAME]) AC_DEFUN([gl_MAKEFILE_NAME], []) 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 @@ # hostent.m4 # serial 5 -dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_HOSTENT], [ 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 @@ # idpriv.m4 # serial 1 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_IDPRIV], [ 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 @@ # include_next.m4 # serial 27 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert and Derek Price. 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 @@ # inet_ntop.m4 # serial 22 -dnl Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_INET_NTOP], [ 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 @@ +# inet_pton.m4 +# serial 20 +dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_INET_PTON], +[ + AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) + + dnl Persuade Solaris to declare inet_pton. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([AC_C_RESTRICT]) + + dnl Most platforms that provide inet_pton define it in libc. + dnl Solaris 8..10 provide inet_pton in libnsl instead. + dnl Solaris 2.6..7 provide inet_pton in libresolv instead. + dnl Haiku provides it in -lnetwork. + dnl Native Windows provides it in -lws2_32 instead, with a declaration in + dnl , and it uses stdcall calling convention, not cdecl + dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). + HAVE_INET_PTON=1 + INET_PTON_LIB= + gl_PREREQ_SYS_H_WINSOCK2 + if test $HAVE_WINSOCK2_H = 1; then + dnl It needs to be overridden, because the stdcall calling convention + dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid + dnl a name conflict at the linker level, even though the header file + dnl declares inet_pton only if _WIN32_WINNT >= 0x0600. + REPLACE_INET_PTON=1 + AC_CHECK_DECLS([inet_pton],,, [[#include ]]) + if test $ac_cv_have_decl_inet_pton = yes; then + INET_PTON_LIB="-lws2_32" + else + HAVE_DECL_INET_PTON=0 + fi + else + gl_saved_LIBS=$LIBS + AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [], + [AC_CHECK_FUNCS([inet_pton]) + if test $ac_cv_func_inet_pton = no; then + HAVE_INET_PTON=0 + fi + ]) + LIBS=$gl_saved_LIBS + + if test "$ac_cv_search_inet_pton" != "no" \ + && test "$ac_cv_search_inet_pton" != "none required"; then + INET_PTON_LIB="$ac_cv_search_inet_pton" + fi + + AC_CHECK_HEADERS_ONCE([netdb.h]) + AC_CHECK_DECLS([inet_pton],,, + [[#include + #if HAVE_NETDB_H + # include + #endif + ]]) + if test $ac_cv_have_decl_inet_pton = no; then + HAVE_DECL_INET_PTON=0 + fi + fi + AC_SUBST([INET_PTON_LIB]) +]) + +# Prerequisites of lib/inet_pton.c. +AC_DEFUN([gl_PREREQ_INET_PTON], [ + AC_REQUIRE([gl_SOCKET_FAMILIES]) +]) 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 @@ # intmax_t.m4 # serial 9 -dnl Copyright (C) 1997-2004, 2006-2007, 2009-2024 Free Software Foundation, +dnl Copyright (C) 1997-2004, 2006-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert. 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 @@ # inttypes.m4 # serial 37 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Derek Price, Bruno Haible. dnl Test whether 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 @@ # inttypes_h.m4 # serial 10 -dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert. 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 @@ # iswblank.m4 # serial 7 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWBLANK], [ 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 @@ # iswctype.m4 # serial 3 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWCTYPE], [ 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 @@ # iswdigit.m4 -# serial 7 -dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. +# serial 9 +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWDIGIT], [ @@ -11,7 +12,7 @@ AC_DEFUN([gl_FUNC_ISWDIGIT], AC_REQUIRE([gl_WCTYPE_H]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([gt_LOCALE_JA]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) @@ -26,14 +27,14 @@ AC_DEFUN([gl_FUNC_ISWDIGIT], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on FreeBSD, NetBSD, Solaris, native Windows. - freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) + # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android. + freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*) gl_cv_func_iswdigit_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_iswdigit_works="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then + if test $LOCALE_FR != none || test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -83,15 +84,15 @@ main (int argc, char *argv[]) if (!(is == 0)) result |= 2; } - if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 - && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { - /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ + /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\331\243", 2); if (!(is == 0)) result |= 4; - /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ + /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\357\274\221", 3); 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 @@ # iswpunct.m4 # serial 2 -dnl Copyright (C) 2023-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWPUNCT], [ 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 @@ # iswxdigit.m4 -# serial 7 -dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. +# serial 9 +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWXDIGIT], [ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([gl_WCTYPE_H]) AC_REQUIRE([gt_LOCALE_JA]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) @@ -25,14 +26,14 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on FreeBSD, NetBSD, Solaris, native Windows. - freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) + # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android. + freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*) gl_cv_func_iswxdigit_works="guessing no" ;; # Guess yes otherwise. *) gl_cv_func_iswxdigit_works="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then + if test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -73,15 +74,15 @@ main (int argc, char *argv[]) if (!(is == 0)) result |= 1; } - if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 - && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { - /* This fails on FreeBSD 13.0. */ + /* This fails on FreeBSD 13.0, Haiku, Android. */ /* U+0663 ARABIC-INDIC DIGIT THREE */ is = for_character ("\331\243", 2); if (!(is == 0)) result |= 2; - /* This fails on NetBSD 10.0, MSVC 14. */ + /* This fails on NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\357\274\241", 3); 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 @@ # langinfo_h.m4 -# serial 12 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +# serial 13 +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_LANGINFO_H], [ @@ -19,6 +20,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H], HAVE_LANGINFO_CODESET=0 HAVE_LANGINFO_T_FMT_AMPM=0 HAVE_LANGINFO_ALTMON=0 + HAVE_LANGINFO_ABALTMON=0 HAVE_LANGINFO_ERA=0 HAVE_LANGINFO_YESEXPR=0 AC_CHECK_HEADERS_ONCE([langinfo.h]) @@ -29,6 +31,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H], dnl ERA etc. are missing on OpenBSD 6.7. dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. dnl ALTMON_* are missing on glibc 2.26 and many other systems. + dnl ABALTMON_* are missing on glibc 2.41 and many other systems. AC_CACHE_CHECK([whether langinfo.h defines CODESET], [gl_cv_header_langinfo_codeset], [AC_COMPILE_IFELSE( @@ -65,6 +68,18 @@ int a = ALTMON_1; if test $gl_cv_header_langinfo_altmon = yes; then HAVE_LANGINFO_ALTMON=1 fi + AC_CACHE_CHECK([whether langinfo.h defines ABALTMON_1], + [gl_cv_header_langinfo_abaltmon], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include +int a = ABALTMON_1; +]])], + [gl_cv_header_langinfo_abaltmon=yes], + [gl_cv_header_langinfo_abaltmon=no]) + ]) + if test $gl_cv_header_langinfo_abaltmon = yes; then + HAVE_LANGINFO_ABALTMON=1 + fi AC_CACHE_CHECK([whether langinfo.h defines ERA], [gl_cv_header_langinfo_era], [AC_COMPILE_IFELSE( @@ -96,6 +111,7 @@ int a = YESEXPR; AC_SUBST([HAVE_LANGINFO_CODESET]) AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) AC_SUBST([HAVE_LANGINFO_ALTMON]) + AC_SUBST([HAVE_LANGINFO_ABALTMON]) AC_SUBST([HAVE_LANGINFO_ERA]) AC_SUBST([HAVE_LANGINFO_YESEXPR]) 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 @@ # largefile.m4 -# serial 1 -dnl Copyright 1992-1996, 1998-2024 Free Software Foundation, Inc. +# serial 2 +dnl Copyright 1992-1996, 1998-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Enable large files on systems where this is not the default. # 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( # If you change this macro you may also need to change # _AC_SYS_YEAR2038_OPTIONS. AC_DEFUN([_AC_SYS_YEAR2038_PROBE], -[AC_CACHE_CHECK([for $CPPFLAGS option for timestamps after 2038], +[AC_CACHE_CHECK([for $CC option to support timestamps after 2038], [ac_cv_sys_year2038_opts], [ac_save_CPPFLAGS="$CPPFLAGS" ac_opt_found=no @@ -234,7 +235,7 @@ m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( # If you change this macro you may also need to change # _AC_SYS_LARGEFILE_OPTIONS. AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], -[AC_CACHE_CHECK([for $CPPFLAGS option for large files], +[AC_CACHE_CHECK([for $CC option to support large files], [ac_cv_sys_largefile_opts], [ac_save_CPPFLAGS=$CPPFLAGS ac_opt_found=no @@ -294,7 +295,7 @@ AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])]) # By default, many hosts won't let programs access large files; # one must use special compiler options to get large-file access to work. # For more details about this brain damage please see: -# http://www.unix.org/version2/whatsnew/lfs20mar.html +# https://www.unix.org/version2/whatsnew/lfs20mar.html # Additionally, on Linux file systems with 64-bit inodes a file that happens # to have a 64-bit inode number cannot be accessed by 32-bit applications on # 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 @@ +# libunistring-base.m4 +# serial 10 +dnl Copyright (C) 2010-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Paolo Bonzini and Bruno Haible. + +dnl gl_LIBUNISTRING_MODULE([VERSION], [Module]) +dnl Declares that the source files of Module should be compiled, unless we +dnl are linking with libunistring and its version is >= the given VERSION. +dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is +dnl true if the source files of Module should be compiled. +dnl This macro is to be used for public libunistring API, not for +dnl undocumented API. +dnl +dnl You have to bump the VERSION argument to the next projected version +dnl number each time you make a change that affects the behaviour of the +dnl functions defined in Module (even if the sources of Module itself do not +dnl change). +dnl +dnl This macro invocation must not occur in macros that are AC_REQUIREd. + +AC_DEFUN([gl_LIBUNISTRING_MODULE], +[ + AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) + dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from + dnl gl_LIBUNISTRING_CORE if that macro has been run. + gl_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]), + [gl_LIBUNISTRING_VERSION_CMP([$1])]) +]) + +dnl gl_LIBUNISTRING_MODULE_WITH_VARIABLE([VERSION], [Module]) +dnl is like gl_LIBUNISTRING_MODULE([VERSION], [Module]), except that it also +dnl defines an AC_SUBSTed autoconf variable GNULIB_$MODULE_DLL_VARIABLE. +dnl What's the expansion of this autoconf variable? +dnl - When building libunistring, it expands to LIBUNISTRING_DLL_VARIABLE. +dnl (This is necessary because this token must be present in the .h files +dnl when the .h files get installed.) +dnl - When building gnulib or application code it expands to +dnl - LIBUNISTRING_DLL_VARIABLE by default, +dnl - if the automake conditional LIBUNISTRING_COMPILE_$MODULE evaluates +dnl to true: the value of +dnl ${module_indicator_prefix}_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME +dnl (which usually is empty, unless explicitly set in configure.ac). +dnl (This is necessary because when the conditional evaluates to false, +dnl the application code expects to use the declared variable from the +dnl installed libunistring; it's in this case that the +dnl LIBUNISTRING_DLL_VARIABLE macro from the installed +dnl must be used.) +dnl +dnl This macro invocation must not occur in macros that are AC_REQUIREd. + +AC_DEFUN([gl_LIBUNISTRING_MODULE_WITH_VARIABLE], +[ + gl_LIBUNISTRING_MODULE([$1], [$2]) + m4_ifndef([gl_IN_LIBUNISTRING], + [if test -z "${AS_TR_CPP([LIBUNISTRING_COMPILE_$2])_TRUE}"; then + GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=$GL_MODULE_INDICATOR_PREFIX[]_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME + fi + ]) +]) + +dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile]) +dnl Declares that HeaderFile should be created, unless we are linking +dnl with libunistring and its version is >= the given VERSION. +dnl HeaderFile should be relative to the lib directory and end in '.h'. +dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty). +dnl +dnl When we are linking with the already installed libunistring and its version +dnl is < VERSION, we create HeaderFile here, because we may compile functions +dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed +dnl version. +dnl When we are linking with the already installed libunistring and its version +dnl is > VERSION, we don't create HeaderFile here: it could cause compilation +dnl errors in other libunistring header files if some types are missing. +dnl +dnl You have to bump the VERSION argument to the next projected version +dnl number each time you make a non-comment change to the HeaderFile. + +AC_DEFUN([gl_LIBUNISTRING_LIBHEADER], +[ + AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) + dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from + dnl gl_LIBUNISTRING_CORE if that macro has been run. + if gl_LIBUNISTRING_VERSION_CMP([$1]); then + dnl It is OK to use a .h file in lib/ from within tests/, but not vice + dnl versa. + if test -z "$LIBUNISTRING_[]AS_TR_CPP([$2])"; then + LIBUNISTRING_[]AS_TR_CPP([$2])="${gl_source_base_prefix}$2" + fi + else + LIBUNISTRING_[]AS_TR_CPP([$2])= + fi + AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2])) +]) + +dnl Miscellaneous preparations/initializations. + +AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE], +[ + dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point. + m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])]) + + AC_REQUIRE([AC_PROG_AWK]) + +dnl Sed expressions to extract the parts of a version number. +changequote(,) +gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +changequote([,]) + + if test "$HAVE_LIBUNISTRING" = yes; then + LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"` + LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"` + LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"` + fi + + dnl Determine whether from an installed libunistring + dnl is available. + m4_ifdef([gl_IN_LIBUNISTRING], + [dnl In libunistring, all .h files that declare variables need to + dnl #include . This references the file + dnl unistring/woe32dll.h in libunistring. + HAVE_UNISTRING_WOE32DLL_H=1 + ], + [dnl In gnulib or in applications, we need a #include + dnl if and only if an installed libunistring is available. + if test "$HAVE_LIBUNISTRING" = yes; then + AC_CHECK_HEADERS([unistring/woe32dll.h], + [HAVE_UNISTRING_WOE32DLL_H=1], + [HAVE_UNISTRING_WOE32DLL_H=0]) + else + HAVE_UNISTRING_WOE32DLL_H=0 + fi + ]) + AC_SUBST([HAVE_UNISTRING_WOE32DLL_H]) +]) + +dnl gl_LIBUNISTRING_VERSION_CMP([VERSION]) +dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION +dnl is less than the VERSION argument. +AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP], +[dnl VERSION = 999.9 means to evaluates to true always, i.e. to ignore +dnl the installed libunistring regardless of its version. +m4_if([$1], [999.9], +[true], +[ { test "$HAVE_LIBUNISTRING" != yes \ + || { + dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least. + AS_LITERAL_IF([$1], + [dnl This is the optimized variant, that assumes the argument is a literal: + m4_pushdef([requested_version_major], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])]) + m4_pushdef([requested_version_minor], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) + m4_pushdef([requested_version_subminor], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) + test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \ + && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \ + || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor + } + } + } + m4_popdef([requested_version_subminor]) + m4_popdef([requested_version_minor]) + m4_popdef([requested_version_major]) + ], + [dnl This is the unoptimized variant: + requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"` + requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"` + requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"` + test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \ + && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \ + || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor + } + } + } + ]) + } + }])]) + +dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the +dnl same as ORIG, otherwise to 0. +m4_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 @@ # limits-h.m4 # serial 1 -dnl Copyright 2016-2024 Free Software Foundation, Inc. +dnl Copyright 2016-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Check whether limits.h has needed features. 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 @@ # localcharset.m4 # serial 8 -dnl Copyright (C) 2002, 2004, 2006, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004, 2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_LOCALCHARSET], [ 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 @@ +# locale-en.m4 +# serial 1 +dnl Copyright (C) 2003-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. + +dnl Determine the name of an English (or American English) locale with +dnl UTF-8 encoding. +AC_DEFUN_ONCE([gt_LOCALE_EN_UTF8], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AM_LANGINFO_CODESET]) + AC_CACHE_CHECK([for an english Unicode locale], [gt_cv_locale_en_utf8], [ + case "$host_os" in + *-musl* | midipix*) + dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without + dnl any locale file on disk. But they are effectively equivalent to the + dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES) + dnl for which localizations (.mo files) have been installed. + gt_cv_locale_en_utf8=en_US.UTF-8 + ;; + *) + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include +#include +struct tm t; +char buf[16]; +int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if !(defined __BEOS__ || defined __HAIKU__) + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is "UTF-8" or equivalent. */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (!(strcmp (cs, "UTF-8") == 0 || strcmp (cs, "UTF8") == 0 + || strcmp (cs, "utf-8") == 0 || strcmp (cs, "utf8") == 0)) + return 1; + } +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check the third month name. */ + t.tm_year = 1975 - 1900; t.tm_mon = 3 - 1; t.tm_mday = 24; + if (strftime (buf, sizeof (buf), "%B", &t) < 5 || strcmp (buf, "March") != 0) + return 1; +#endif +#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ + /* Check whether the decimal separator is a dot. */ + if (localeconv () ->decimal_point[0] != '.') return 1; +#endif + return 0; +} + ]])]) + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw* | windows*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL='English_United States.65001' LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8='English_United States.65001' + else + # None found. + gt_cv_locale_en_utf8=none + fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the locale name with explicit encoding suffix first + # (this is necessary on Haiku). + if (LC_ALL=en_US.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en_US.UTF-8 + else + # Test for the locale name without encoding suffix. + if (LC_ALL=en_US LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en_US + else + # Test for the Solaris 10 locale name. + if (LC_ALL=en.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en.UTF-8 + else + # None found. + gt_cv_locale_en_utf8=none + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + ;; + esac + ]) + LOCALE_EN_UTF8="$gt_cv_locale_en_utf8" + case "$LOCALE_EN_UTF8" in #( + '' | *[[\"\$\'*@<:@]]*) + dnl The empty value occurs when the conftest.c program above could not + dnl be compiled. The other values might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_EN_UTF8"; assuming "none"]) + LOCALE_EN_UTF8=none;; + esac + AC_SUBST([LOCALE_EN_UTF8]) +]) 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 @@ # locale-fr.m4 -# serial 23 -dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. +# serial 24 +dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. @@ -71,8 +72,9 @@ int main () { if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. - On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point - are nl_langinfo(RADIXCHAR) are both ".". */ + On NetBSD 3.0 in the fr_FR.ISO8859-1 locale + and on Haiku in the fr_FR.UTF-8 locale, + localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; @@ -82,10 +84,11 @@ int main () { if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", # and similar. mingw* | windows*) # Test for the native Windows locale name. @@ -214,8 +217,9 @@ int main () { #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. - On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point - are nl_langinfo(RADIXCHAR) are both ".". */ + On NetBSD 3.0 in the fr_FR.ISO8859-1 locale + and on Haiku in the fr_FR.UTF-8 locale, + localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; @@ -224,10 +228,11 @@ int main () { if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", # and similar. mingw* | windows*) # 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 @@ # locale-ja.m4 -# serial 18 -dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. +# serial 19 +dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. @@ -86,10 +87,11 @@ int main () if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", # and similar. mingw* | windows*) # 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 @@ # locale-zh.m4 -# serial 18 -dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. +# serial 20 +dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. @@ -22,6 +23,7 @@ AC_DEFUN_ONCE([gt_LOCALE_ZH_CN], #endif #include #include +#include struct tm t; char buf[16]; int main () @@ -80,6 +82,19 @@ int main () single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; + /* Check whether mbrtowc accept this character one byte at a time. + This excludes NetBSD 10.0. */ + if (sizeof (wchar_t) > 2) + { + wchar_t wc; + mbstate_t state; + memset (&state, 0, sizeof (state)); + if (!(mbrtowc (&wc, "\203", 1, &state) == (size_t)(-2) + && mbrtowc (&wc, "\062", 1, &state) == (size_t)(-2) + && mbrtowc (&wc, "\332", 1, &state) == (size_t)(-2) + && mbrtowc (&wc, "\066", 1, &state) == 1)) + return 1; + } return 0; #endif } @@ -87,10 +102,11 @@ int main () if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", # and similar. mingw* | windows*) # 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 @@ # locale_h.m4 -# serial 31 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 37 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_LOCALE_H], [ @@ -19,6 +20,26 @@ AC_DEFUN_ONCE([gl_LOCALE_H], AC_REQUIRE([gl_STDDEF_H]) AC_REQUIRE([gl_LOCALE_T]) + dnl On native Windows, there is a type '_locale_t' that can be used to + dnl define locale_t. + AC_CACHE_CHECK([whether locale.h defines _locale_t], + [gl_cv_header_locale_has_windows_locale_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + _locale_t x;]], + [[]])], + [gl_cv_header_locale_has_windows_locale_t=yes], + [gl_cv_header_locale_has_windows_locale_t=no]) + ]) + if test $gl_cv_header_locale_has_windows_locale_t = yes; then + HAVE_WINDOWS_LOCALE_T=1 + AC_DEFINE([HAVE_WINDOWS_LOCALE_T], [1], + [Define to 1 if defines the _locale_t type.]) + else + HAVE_WINDOWS_LOCALE_T=0 + fi + AC_SUBST([HAVE_WINDOWS_LOCALE_T]) dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' dnl only if _LCONV_C99 is defined. @@ -86,7 +107,7 @@ AC_DEFUN_ONCE([gl_LOCALE_H], # include #endif ]], - [setlocale newlocale duplocale freelocale]) + [setlocale newlocale duplocale freelocale getlocalename_l]) ]) dnl Checks to determine whether the system has the locale_t type, @@ -130,6 +151,7 @@ AC_DEFUN([gl_LOCALE_T], fi fi AC_SUBST([HAVE_XLOCALE_H]) + AC_SUBST([HAVE_LOCALE_T]) ]) # gl_LOCALE_MODULE_INDICATOR([modulename]) @@ -154,7 +176,11 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NEWLOCALE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREELOCALE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L_UNSAFE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) @@ -164,14 +190,16 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], AC_DEFUN([gl_LOCALE_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) - HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) - HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) - REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) - REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) - REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) - REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) - REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) - REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) + HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) + HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) + HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) + HAVE_GETLOCALENAME_L=1; AC_SUBST([HAVE_GETLOCALENAME_L]) + REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) + REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) + REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) + REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) + REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) + REPLACE_GETLOCALENAME_L=0; AC_SUBST([REPLACE_GETLOCALENAME_L]) + REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) ]) 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 @@ # localeconv.m4 # serial 3 -dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2012-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_LOCALECONV], [ 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 @@ # lock.m4 # serial 14 -dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. 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 @@ # lseek.m4 # serial 15 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_LSEEK], [ 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 @@ +# lstat.m4 +# serial 36 +dnl Copyright (C) 1997-2001, 2003-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Jim Meyering. + +AC_DEFUN([gl_FUNC_LSTAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + dnl If lstat does not exist, the replacement does + dnl "#define lstat stat", and lstat.c is a no-op. + AC_CHECK_FUNCS_ONCE([lstat]) + if test $ac_cv_func_lstat = yes; then + AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) + case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in + darwin* | solaris* | *no) + REPLACE_LSTAT=1 + ;; + esac + else + HAVE_LSTAT=0 + fi +]) + +# Prerequisites of lib/lstat.c. +AC_DEFUN([gl_PREREQ_LSTAT], [:]) + +AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], +[ + dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it + dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ. + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether lstat correctly handles trailing slash], + [gl_cv_func_lstat_dereferences_slashed_symlink], + [rm -f conftest.sym conftest.file + echo >conftest.file + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[struct stat sbuf; + if (symlink ("conftest.file", "conftest.sym") != 0) + return 1; + /* Linux will dereference the symlink and fail, as required by + POSIX. That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; + ]])], + [gl_cv_func_lstat_dereferences_slashed_symlink=yes], + [gl_cv_func_lstat_dereferences_slashed_symlink=no], + [case "$host_os" in + linux-* | linux) + # Guess yes on Linux systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + midipix*) + # Guess yes on systems that emulate the Linux system calls. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + *-gnu* | gnu*) + # Guess yes on glibc systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + mingw* | windows*) + # Guess no on native Windows. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + *) + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; + esac + ]) + rm -f conftest.sym conftest.file + ]) + case "$gl_cv_func_lstat_dereferences_slashed_symlink" in + *yes) + AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1], + [Define to 1 if 'lstat' dereferences a symlink specified + with a trailing slash.]) + ;; + esac +]) 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 @@ # malloc.m4 -# serial 31 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 43.1 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. -# This is adapted with modifications from upstream Autoconf here: -# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 +m4_version_prereq([2.73], [], [ +# Modules that use this macro directly or indirectly should depend +# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined +# before this macro gets invoked. This helps on AIX 7.2 and earlier +# if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise. +# +# This is copied from upstream Autoconf here: +# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=1f38316f6af7bf63e5e7dd187ff6456e07ad743e#n971 +# _AC_FUNC_MALLOC_IF(IF-WORKS, IF-NOT[, UNKNOWN-ASSUME]) +# ------------------------------------------------------ +# If 'malloc (0)' returns nonnull, run IF-WORKS, otherwise, IF-NOT. +# If it is not known whether it works, assume the shell word UNKNOWN-ASSUME, +# which should end in "yes" or in something else (the latter is the default). AC_DEFUN([_AC_FUNC_MALLOC_IF], [ AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles @@ -15,56 +27,81 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include - ]], - [[void *p = malloc (0); - void * volatile vp = p; - int result = !vp; + /* Use pmalloc to test; 'volatile' prevents the compiler + from optimizing the malloc call away. */ + void *(*volatile pmalloc) (size_t) = malloc;]], + [[void *p = pmalloc (0); + int result = !p; free (p); - return result;]]) - ], + return result;]])], [ac_cv_func_malloc_0_nonnull=yes], [ac_cv_func_malloc_0_nonnull=no], - [case "$host_os" in - # Guess yes on platforms where we know the result. - *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ - | gnu* | *-musl* | midipix* | midnightbsd* \ - | hpux* | solaris* | cygwin* | mingw* | windows* | msys* ) - ac_cv_func_malloc_0_nonnull="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; - esac - ]) - ]) + [AS_CASE([$host_os], + [# Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midipix* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | windows* | msys*], + [ac_cv_func_malloc_0_nonnull="guessing yes"], + [# Guess as follows if we don't know. + ac_cv_func_malloc_0_nonnull=m4_default([$3], ["guessing no"])])])]) AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) ])# _AC_FUNC_MALLOC_IF +]) + +# gl_FUNC_MALLOC_0_NONNULL +# ------------------------ +# If 'malloc (0)' returns nonnull define HAVE_MALLOC_0_NONNULL. +# Also, set ac_cv_func_malloc_0_nonnull to a string that ends in +# "yes", otherwise set it to something else. If unknown whether +# malloc (0) works, guess as normal for cross-builds. +AC_DEFUN([gl_FUNC_MALLOC_0_NONNULL], +[ + _AC_FUNC_MALLOC_IF( + [AC_DEFINE([HAVE_MALLOC_0_NONNULL], [1], + [Define to 1 if malloc (0) returns nonnull.])], + [], + ["$gl_cross_guess_normal"]) +]) # gl_FUNC_MALLOC_GNU # ------------------ -# Replace malloc if it is not compatible with GNU libc. +# Test whether malloc (0) is compatible with GNU libc. +# Replace malloc if not. +# Define HAVE_MALLOC_0_NONNULL if malloc (0) returns nonnull (except upon +# out-of-memory). +# Define HAVE_MALLOC_PTRDIFF if malloc (N) reliably fails when N exceeds +# PTRDIFF_MAX. AC_DEFUN([gl_FUNC_MALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) - REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" - if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then - _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) - fi + AC_REQUIRE([gl_FUNC_MALLOC_0_NONNULL]) + + AS_CASE([$ac_cv_func_malloc_0_nonnull], + [*yes], + [REPLACE_MALLOC_FOR_MALLOC_GNU=$REPLACE_MALLOC_FOR_MALLOC_POSIX], + [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) ]) # gl_FUNC_MALLOC_PTRDIFF # ---------------------- -# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, -# and replace malloc otherwise. +# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX. +# Define HAVE_MALLOC_PTRDIFF if yes. +# Replace malloc if not. AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) - test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1 + AS_IF([test "$gl_cv_malloc_ptrdiff" = yes], + [AC_DEFINE([HAVE_MALLOC_PTRDIFF], 1, + [Define to 1 if malloc-like functions do not allocate objects + larger than PTRDIFF_MAX bytes.])], + [REPLACE_MALLOC_FOR_MALLOC_POSIX=1]) ]) -# Test whether malloc, realloc, calloc refuse to create objects +# Test whether malloc, calloc refuse to create objects # larger than what can be expressed in ptrdiff_t. -# Set gl_cv_func_malloc_gnu to yes or no accordingly. +# Set gl_cv_func_malloc_gnu. AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], [ AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], @@ -108,30 +145,48 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX], AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test "$gl_cv_func_malloc_posix" = yes; then - AC_DEFINE([HAVE_MALLOC_POSIX], [1], - [Define if malloc, realloc, and calloc set errno on allocation failure.]) - else - REPLACE_MALLOC_FOR_MALLOC_POSIX=1 - fi + case "$gl_cv_func_malloc_posix" in + *yes) + AC_DEFINE([HAVE_MALLOC_POSIX], [1], + [Define if malloc and calloc set errno on allocation failure.]) + ;; + *) + REPLACE_MALLOC_FOR_MALLOC_POSIX=1 + ;; + esac ]) -# Test whether malloc, realloc, calloc set errno to ENOMEM on failure. -# Set gl_cv_func_malloc_posix to yes or no accordingly. +# Test whether malloc, calloc set errno to ENOMEM on failure. +# Set gl_cv_func_malloc_posix to *yes or *no accordingly. AC_DEFUN([gl_CHECK_MALLOC_POSIX], [ AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], + AC_CACHE_CHECK([whether malloc, calloc set errno on failure], [gl_cv_func_malloc_posix], [ dnl It is too dangerous to try to allocate a large amount of memory: dnl some systems go to their knees when you do that. So assume that dnl all Unix implementations of the function set errno on failure, dnl except on those platforms where we have seen 'test-malloc-gnu', - dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. + dnl 'test-realloc-posix', 'test-calloc-gnu' fail. For platforms + dnl where only 'test-realloc-posix', see realloc.m4. case "$host_os" in mingw* | windows*) - gl_cv_func_malloc_posix=no ;; + dnl Old MSVCRT from 2001 did not set errno=ENOMEM when malloc failed. + dnl More recent MSVCRT from 2019 does so. + dnl UCRT is the successor of MSVCRT. Assume that UCRT does so as well. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #ifndef _UCRT + msvcrt yuck + #endif + ]], + [[]]) + ], + [gl_cv_func_malloc_posix="guessing yes"], + [gl_cv_func_malloc_posix="guessing no"]) + ;; irix* | solaris*) dnl On IRIX 6.5, the three functions return NULL with errno unset 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 @@ # malloca.m4 -# serial 2 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2024 Free Software Foundation, +# serial 3 +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_MALLOCA], [ dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables dnl @ALLOCA@ and @LTALLOCA@. dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. - AC_REQUIRE([gl_EEMALLOC]) + AC_REQUIRE([gl_FUNC_MALLOC_GNU]) ]) 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 @@ # math_h.m4 -# serial 138 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 140.1 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_MATH_H], [ @@ -49,7 +50,7 @@ AC_DEFUN_ONCE([gl_MATH_H], ilogb ilogbf ilogbl ldexpf ldexpl log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l - logb logbf logbl + logb logbf logbl logp1 log1pf logp1l modf modff modfl powf remainder remainderf remainderl rint rintf rintl round roundf roundl @@ -153,6 +154,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) @@ -253,6 +257,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) + HAVE_LOGP1=1; AC_SUBST([HAVE_LOGP1]) + HAVE_LOGP1F=1; AC_SUBST([HAVE_LOGP1F]) + HAVE_LOGP1L=1; AC_SUBST([HAVE_LOGP1L]) HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) HAVE_POWF=1; AC_SUBST([HAVE_POWF]) @@ -392,6 +399,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) + REPLACE_SINL=0; AC_SUBST([REPLACE_SINL]) REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) 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 @@ +# mbchar.m4 +# serial 9 +dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl autoconf tests required for use of mbchar.m4 +dnl From Bruno Haible. + +AC_DEFUN([gl_MBCHAR], +[ + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) +]) 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 @@ +# mbiter.m4 +# serial 7 +dnl Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl autoconf tests required for use of mbiter.h +dnl From Bruno Haible. + +AC_DEFUN([gl_MBITER], +[ + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + : +]) 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 @@ +# mbrtoc32.m4 +# serial 21 +dnl Copyright (C) 2014-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_MBRTOC32], +[ + AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) + + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how our overridden mbrtowc is implemented. + dnl We then implement mbrtoc32 accordingly. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + + AC_REQUIRE([gl_TYPE_CHAR32_T]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + + AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32]) + if test $gl_cv_func_mbrtoc32 = no; then + HAVE_MBRTOC32=0 + else + if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBRTOC32=1 + else + gl_MBRTOC32_EMPTY_INPUT + gl_MBRTOC32_C_LOCALE + gl_MBRTOC32_UTF8_LOCALE + case "$gl_cv_func_mbrtoc32_empty_input" in + *yes) ;; + *) AC_DEFINE([MBRTOC32_EMPTY_INPUT_BUG], [1], + [Define if the mbrtoc32 function does not return (size_t) -2 for empty input.]) + REPLACE_MBRTOC32=1 + ;; + esac + case "$gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ" in + *yes) ;; + *) AC_DEFINE([MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ], [1], + [Define if the mbrtoc32 function may signal encoding errors in the C locale.]) + REPLACE_MBRTOC32=1 + ;; + esac + case "$gl_cv_func_mbrtoc32_utf8_locale_works" in + *yes) ;; + *) AC_DEFINE([MBRTOC32_MULTIBYTE_LOCALE_BUG], [1], + [Define if the mbrtoc32 function does not accept the input bytes one-by-one.]) + REPLACE_MBRTOC32=1 + dnl Our replacement mbrtoc32 can handle UTF-8, but not GB18030. + LOCALE_ZH_CN=none + ;; + esac + fi + if test $HAVE_WORKING_MBRTOC32 = 0; then + REPLACE_MBRTOC32=1 + fi + fi +]) + +AC_DEFUN([gl_CHECK_FUNC_MBRTOC32], +[ + dnl Cf. gl_CHECK_FUNCS_ANDROID + AC_CHECK_DECL([mbrtoc32], , , + [[#ifdef __HAIKU__ + #include + #endif + #include + ]]) + if test $ac_cv_have_decl_mbrtoc32 = yes; then + dnl We can't use AC_CHECK_FUNC here, because mbrtoc32() is defined as a + dnl static inline function on Haiku 2020. + AC_CACHE_CHECK([for mbrtoc32], [gl_cv_func_mbrtoc32], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #ifdef __HAIKU__ + #include + #endif + #include + ]], + [[char32_t c; + return mbrtoc32 (&c, "", 1, NULL) == 0; + ]]) + ], + [gl_cv_func_mbrtoc32=yes], + [gl_cv_func_mbrtoc32=no]) + ]) + else + gl_cv_func_mbrtoc32=no + fi +]) + +dnl Test whether mbrtoc32 returns the correct value on empty input. + +AC_DEFUN([gl_MBRTOC32_EMPTY_INPUT], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether mbrtoc32 works on empty input], + [gl_cv_func_mbrtoc32_empty_input], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #ifdef __HAIKU__ + #include + #endif + #include + static char32_t wc; + static mbstate_t mbs; + int + main (void) + { + return mbrtoc32 (&wc, "", 0, &mbs) != (size_t) -2; + }]])], + [gl_cv_func_mbrtoc32_empty_input=yes], + [gl_cv_func_mbrtoc32_empty_input=no], + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; + # Guess no on Android. + linux*-android*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; + *) gl_cv_func_mbrtoc32_empty_input="guessing yes" ;; + esac + ]) + ]) +]) + +dnl +dnl POSIX:2018 says regarding mbrtowc: "In the POSIX locale an [EILSEQ] error +dnl cannot occur since all byte values are valid characters." It is reasonable +dnl to expect mbrtoc32 to behave in the same way. + +AC_DEFUN([gl_MBRTOC32_C_LOCALE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether the C locale is free of encoding errors], + [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #ifdef __HAIKU__ + #include + #endif + #include + ]], [[ + int i; + char *locale = setlocale (LC_ALL, "C"); + if (! locale) + return 2; + for (i = CHAR_MIN; i <= CHAR_MAX; i++) + { + char c = i; + char32_t wc; + mbstate_t mbs = { 0, }; + size_t ss = mbrtoc32 (&wc, &c, 1, &mbs); + if (1 < ss) + return 3; + } + return 0; + ]])], + [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=yes], + [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=no], + [case "$host_os" in + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="guessing yes" ;; + *) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;; + esac + ]) + ]) +]) + +dnl Test whether mbrtoc32 works when it's fed the bytes one-by-one in an UTF-8 +dnl locale. + +AC_DEFUN([gl_MBRTOC32_UTF8_LOCALE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether mbrtoc32 works in an UTF-8 locale], + [gl_cv_func_mbrtoc32_utf8_locale_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #ifdef __HAIKU__ + #include + #endif + #include + ]], [[ + char *locale = setlocale (LC_ALL, "en_US.UTF-8"); + if (locale) + { + /* This test fails on Cygwin 3.5.3. */ + mbstate_t state = { 0, }; + char32_t uc = 0xDEADBEEF; + /* \360\237\220\203 = U+0001F403 */ + if (mbrtoc32 (&uc, "\360", 1, &state) != (size_t)-2) + return 1; + if (mbrtoc32 (&uc, "\237", 1, &state) != (size_t)-2) + return 2; + if (mbrtoc32 (&uc, "\220", 1, &state) != (size_t)-2) + return 3; + if (mbrtoc32 (&uc, "\203", 1, &state) != 1) + return 4; + if (uc != 0x0001F403) + return 5; + } + return 0; + ]])], + [gl_cv_func_mbrtoc32_utf8_locale_works=yes], + [gl_cv_func_mbrtoc32_utf8_locale_works=no], + [case "$host_os" in + # Guess no on Cygwin. + cygwin*) gl_cv_func_mbrtoc32_utf8_locale_works="guessing no" ;; + *) gl_cv_func_mbrtoc32_utf8_locale_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) +]) + +dnl Test whether mbrtoc32 works not worse than mbrtowc. +dnl Result is HAVE_WORKING_MBRTOC32. + +AC_DEFUN([gl_MBRTOC32_SANITYCHECK], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_TYPE_CHAR32_T]) + AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32]) + AC_REQUIRE([gt_LOCALE_FR]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + AC_REQUIRE([AC_CANONICAL_HOST]) + if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_mbrtoc32 = no; then + HAVE_WORKING_MBRTOC32=0 + else + AC_CACHE_CHECK([whether mbrtoc32 works as well as mbrtowc], + [gl_cv_func_mbrtoc32_sanitycheck], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. +changequote(,)dnl + case "$host_os" in + # Guess no on FreeBSD, Solaris, native Windows. + freebsd* | midnightbsd* | solaris* | mingw* | windows*) + gl_cv_func_mbrtoc32_sanitycheck="guessing no" + ;; + # Guess yes otherwise. + *) + gl_cv_func_mbrtoc32_sanitycheck="guessing yes" + ;; + esac +changequote([,])dnl + if test $LOCALE_FR != none || test $LOCALE_ZH_CN != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +#ifdef __HAIKU__ + #include +#endif +#include +int main () +{ + int result = 0; + /* This fails on native Windows: + mbrtoc32 returns (size_t)-1. + mbrtowc returns 1 (correct). */ + if (strcmp ("$LOCALE_FR", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_FR") != NULL) + { + mbstate_t state; + wchar_t wc = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\374", 1, &state) == 1) + { + char32_t c32 = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtoc32 (&c32, "\374", 1, &state) != 1) + result |= 1; + } + } + /* This fails on FreeBSD 13.0 and Solaris 11.4: + mbrtoc32 returns (size_t)-2 or (size_t)-1. + mbrtowc returns 4 (correct). */ + if (strcmp ("$LOCALE_ZH_CN", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + mbstate_t state; + wchar_t wc = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\224\071\375\067", 4, &state) == 4) + { + char32_t c32 = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtoc32 (&c32, "\224\071\375\067", 4, &state) != 4) + result |= 2; + } + } + return result; +}]])], + [gl_cv_func_mbrtoc32_sanitycheck=yes], + [gl_cv_func_mbrtoc32_sanitycheck=no], + [:]) + fi + ]) + case "$gl_cv_func_mbrtoc32_sanitycheck" in + *yes) + HAVE_WORKING_MBRTOC32=1 + AC_DEFINE([HAVE_WORKING_MBRTOC32], [1], + [Define if the mbrtoc32 function basically works.]) + ;; + *) HAVE_WORKING_MBRTOC32=0 ;; + esac + fi + AC_SUBST([HAVE_WORKING_MBRTOC32]) +]) + +# Prerequisites of lib/mbrtoc32.c and lib/lc-charset-dispatch.c. +AC_DEFUN([gl_PREREQ_MBRTOC32], [ + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + : +]) 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 @@ # mbrtowc.m4 -# serial 44 -*- coding: utf-8 -*- -dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation, +# serial 46 +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_MBRTOWC], [ @@ -160,7 +161,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_JA]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], [gl_cv_func_mbrtowc_incomplete_state], @@ -200,7 +201,7 @@ int main () [gl_cv_func_mbrtowc_incomplete_state=no], [:]) else - if test $LOCALE_FR_UTF8 != none; then + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -208,7 +209,7 @@ int main () #include int main () { - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; @@ -288,7 +289,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg1. AC_DEFUN([gl_MBRTOWC_NULL_ARG1], [ AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], [gl_cv_func_mbrtowc_null_arg1], @@ -303,7 +304,7 @@ changequote(,)dnl *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none; then + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -314,7 +315,7 @@ int main () { int result = 0; - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { char input[] = "\303\237er"; mbstate_t state; @@ -351,7 +352,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg2. AC_DEFUN([gl_MBRTOWC_NULL_ARG2], [ AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], [gl_cv_func_mbrtowc_null_arg2], @@ -366,7 +367,7 @@ changequote(,)dnl *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none; then + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -374,7 +375,7 @@ changequote([,])dnl #include int main () { - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { mbstate_t state; wchar_t wc; @@ -404,7 +405,7 @@ dnl Result is gl_cv_func_mbrtowc_retval. AC_DEFUN([gl_MBRTOWC_RETVAL], [ AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether mbrtowc has a correct return value], @@ -422,7 +423,7 @@ changequote(,)dnl gl_cv_func_mbrtowc_retval="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ + if test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none \ || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ @@ -434,8 +435,8 @@ int main () int result = 0; int found_some_locale = 0; /* This fails on Solaris. */ - if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 - && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; @@ -649,8 +650,8 @@ int main () [:]) ;; *) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) - if test $LOCALE_FR_UTF8 != none; then + AC_REQUIRE([gt_LOCALE_EN_UTF8]) + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -658,7 +659,7 @@ int main () #include int main () { - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; 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 @@ # mbsinit.m4 # serial 10 -dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_MBSINIT], [ 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 @@ # mbstate_t.m4 # serial 14 -dnl Copyright (C) 2000-2002, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # From Paul Eggert. 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 @@ # mbtowc.m4 # serial 5 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_MBTOWC], [ 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 @@ # memchr.m4 -# serial 19 -dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc. +# serial 20 +dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_MEMCHR], [ @@ -49,7 +50,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], if (fd >= 0) # endif { - int pagesize = getpagesize (); + long int pagesize = sysconf (_SC_PAGESIZE); char *two_pages = (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, 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 @@ # minmax.m4 # serial 4 -dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.53]) 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 @@ # mktime.m4 -# serial 39 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. +# serial 42 +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2025 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Jim Meyering. 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 @@ # mmap-anon.m4 # serial 12 -dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Detect how mmap can be used to create anonymous (not file-backed) memory # 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 @@ # mode_t.m4 # serial 2 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # For using mode_t, it's sufficient to use AC_TYPE_MODE_T and # include . 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 @@ # mountlist.m4 -# serial 17 -dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. +# serial 18 +dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Jim Meyering. @@ -318,12 +319,17 @@ int getmntinfo (struct statfs **, int); fi if test -z "$ac_list_mounted_fs"; then - AC_MSG_ERROR([could not determine how to read list of mounted file systems]) - # FIXME -- no need to abort building the whole package - # Can't build mountlist.c or anything that needs its functions + case "$host_os" in + mingw* | windows*) ac_list_mounted_fs=found ;; + esac + fi + + if test -z "$ac_list_mounted_fs"; then + AC_DEFINE([MOUNTED_NOT_PORTED], [1], + [Define if we don't know how to determine the list of mounted file systems.]) fi - if test $ac_list_mounted_fs = found; then + if test "$ac_list_mounted_fs" = found; then gl_cv_list_mounted_fs=yes else 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 @@ # msvc-inval.m4 # serial 1 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_MSVC_INVAL], [ 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 @@ # msvc-nothrow.m4 # serial 1 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_MSVC_NOTHROW], [ 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 @@ # multiarch.m4 # serial 9 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Determine whether the compiler is or may be producing universal binaries. # 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 @@ # musl.m4 # serial 4 -dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Test for musl libc, despite the musl libc authors don't like it # 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 @@ # netdb_h.m4 # serial 15 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_NETDB_H], [ 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 @@ # netinet_in_h.m4 # serial 6 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_HEADER_NETINET_IN], [ 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 @@ # nl_langinfo.m4 -# serial 11 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +# serial 12.1 +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_NL_LANGINFO], [ @@ -40,16 +41,18 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], [$FUNC_NL_LANGINFO_YESEXPR_WORKS], [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) - # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe. + # On macOS 26, Solaris 10, and Solaris 11.3, nl_langinfo is not + # multithread-safe. case "$host_os" in - solaris*) NL_LANGINFO_MTSAFE=0 ;; - *) NL_LANGINFO_MTSAFE=1 ;; + darwin* | solaris*) NL_LANGINFO_MTSAFE=0 ;; + *) NL_LANGINFO_MTSAFE=1 ;; esac AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], [Define to 1 if nl_langinfo is multithread-safe.]) if test $HAVE_LANGINFO_CODESET = 1 \ && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ && test $HAVE_LANGINFO_ALTMON = 1 \ + && test $HAVE_LANGINFO_ABALTMON = 1 \ && test $HAVE_LANGINFO_ERA = 1 \ && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ && 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 @@ # nocrash.m4 # serial 5 -dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. 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 @@ +# off64_t.m4 +# serial 1 +dnl Copyright (C) 2024-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Check whether defines the 'off64_t' type. +dnl Set HAVE_OFF64_T. + +AC_DEFUN([gl_TYPE_OFF64_T], +[ + dnl Persuade glibc , , , , + dnl to define off64_t. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_CACHE_CHECK([for off64_t], [gl_cv_off64_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[int x = sizeof (off64_t *) + sizeof (off64_t); + return !x;]])], + [gl_cv_off64_t=yes], [gl_cv_off64_t=no])]) + + if test $gl_cv_off64_t != no; then + HAVE_OFF64_T=1 + else + HAVE_OFF64_T=0 + fi + AC_SUBST([HAVE_OFF64_T]) +]) 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 @@ # off_t.m4 # serial 1 -dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2012-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Check whether to override the 'off_t' type. dnl 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 @@ +# once.m4 +# serial 1 +dnl Copyright (C) 2024-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. + +AC_DEFUN([gl_ONCE], +[ + AC_REQUIRE([gl_THREADLIB]) +]) 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 @@ # open-cloexec.m4 # serial 1 -dnl Copyright 2017-2024 Free Software Foundation, Inc. +dnl Copyright 2017-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Test whether O_CLOEXEC is defined. 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 @@ # open-slash.m4 # serial 2 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Tests whether open() and creat() recognize a trailing slash. dnl 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 @@ # open.m4 -# serial 16 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 17 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_OPEN], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) + AC_REQUIRE([gl_FCNTL_O_FLAGS]) + AS_CASE([$gl_cv_header_working_fcntl_h], + [*O_DIRECTORY* | *no], [REPLACE_OPEN=1]) case "$host_os" in mingw* | windows* | pw*) 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 @@ # pathmax.m4 # serial 11 -dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_PATHMAX], [ 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 @@ # pid_t.m4 # serial 4 -dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # The following implementation works around a problem in autoconf <= 2.69. m4_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 @@ # printf.m4 -# serial 91 -dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. +# serial 96 +dnl Copyright (C) 2003, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Test whether the *printf family of functions supports the 'j', 'z', 't', dnl 'L' size specifiers. (ISO C99, POSIX:2001) @@ -616,6 +617,7 @@ static double zero = 0.0; int main () { int result = 0; + /* This fails on FreeBSD 5.2.1, Solaris 11.4. */ if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "0x1.922p+1 33") != 0 && strcmp (buf, "0x3.244p+0 33") != 0 @@ -627,27 +629,29 @@ int main () && strcmp (buf, "-0X3.244P+0 33") != 0 && strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0XC.91P-2 33") != 0)) - result |= 2; - /* This catches a FreeBSD 13.0 bug: it doesn't round. */ + result |= 1; + /* This catches a Mac OS X 10.5, FreeBSD 6.4, NetBSD 10.0 bug: + it doesn't round. */ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x1.83p+0 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0 && strcmp (buf, "0x6.0ap-2 33") != 0 && strcmp (buf, "0xc.14p-3 33") != 0)) - result |= 4; - /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ + result |= 2; + /* This catches a macOS 14 (Darwin 23), FreeBSD 14.0, OpenBSD 7.5, AIX 7.3, + Solaris 11.4 bug: it doesn't round. */ if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x2p+0 33") != 0 && strcmp (buf, "0x3p-1 33") != 0 && strcmp (buf, "0x6p-2 33") != 0 && strcmp (buf, "0xcp-3 33") != 0)) result |= 4; - /* This catches a FreeBSD 6.1 bug. See + /* This catches a Mac OS X 10.5, FreeBSD 6.4 bug. See */ if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 || buf[0] == '0') result |= 8; - /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ + /* This catches a Mac OS X 10.3.9 (Darwin 7.9), FreeBSD 6.4 bug. */ if (sprintf (buf, "%.1a", 1.999) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 @@ -655,7 +659,8 @@ int main () && strcmp (buf, "0x8.0p-2") != 0)) result |= 16; /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a - glibc 2.4 bug . */ + glibc 2.4 bug + and a FreeBSD 6.4, NetBSD 10.0 bug. */ if (sprintf (buf, "%.1La", 1.999L) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 @@ -893,9 +898,14 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], [AC_LANG_SOURCE([[ #include #include -#include #include +#if defined _WIN32 && !defined __CYGWIN__ +# include +#else +# include +#endif #ifdef _MSC_VER +#include #include /* See page about "Parameter Validation" on msdn.microsoft.com. @@ -922,6 +932,9 @@ int main () int count = -1; #ifdef _MSC_VER _set_invalid_parameter_handler (invalid_parameter_handler); + /* Also avoid an Abort/Retry/Ignore dialog in debug builds. + */ + _CrtSetReportMode (_CRT_ASSERT, 0); #endif signal (SIGABRT, abort_handler); /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) @@ -1173,6 +1186,112 @@ changequote([,])dnl ]) ]) +dnl Test whether the *printf family of functions supports POSIX/XSI format +dnl strings with the ' flag for grouping of decimal digits on integers, +dnl together with a precision. +dnl Result is gl_cv_func_printf_flag_grouping_int_precision. + +AC_DEFUN([gl_PRINTF_FLAG_GROUPING_INT_PRECISION], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether printf supports grouping on integers with a precision], + [gl_cv_func_printf_flag_grouping_int_precision], + [ + dnl Prepare a guess, used when cross-compiling or when specific locales + dnl are not available. + case "$host_os" in + # Guess no on FreeBSD, NetBSD, Solaris, Cygwin, Haiku. + freebsd* | dragonfly* | netbsd* | solaris* | cygwin* | haiku*) + gl_cv_func_printf_flag_grouping_int_precision="guessing no";; + *) + gl_cv_func_printf_flag_grouping_int_precision="guessing yes";; + esac + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +static char buf[100]; +int main () +{ + if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL + || setlocale (LC_ALL, "fr_FR") != NULL + || setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL + || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL) + { + if (sprintf (buf, "%'.10d", 1000) < 0) + return 1; + if (strlen (buf) == 10 && strcmp (buf, "0000001000") != 0) + /* The sprintf implementation has produced fewer than 10 digits. */ + return 2; + else + return 0; + } + return 3; +}]])], + [gl_cv_func_printf_flag_grouping_int_precision=yes], + [if test $? = 2; then + gl_cv_func_printf_flag_grouping_int_precision=no + fi + ], + [:]) + ]) +]) + +dnl Test whether the *printf family of functions supports POSIX/XSI format +dnl strings with the ' flag for grouping of decimal digits, when the thousands +dnl separator is a multibyte character (such as U+00A0 or U+202F in a UTF-8 +dnl locale). +dnl Result is gl_cv_func_printf_flag_grouping_multibyte. + +AC_DEFUN([gl_PRINTF_FLAG_GROUPING_MULTIBYTE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether printf supports grouping with a multibyte separator], + [gl_cv_func_printf_flag_grouping_multibyte], + [ + dnl Prepare a guess, used when cross-compiling or when specific locales + dnl are not available. + case "$host_os" in + # Guess no on NetBSD and Solaris 11 OpenIndiana. + netbsd* | solaris*) + gl_cv_func_printf_flag_grouping_multibyte="guessing no";; + *) + gl_cv_func_printf_flag_grouping_multibyte="guessing yes";; + esac + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +static char buf[100]; +int main () +{ + if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) + return 0; + if (sprintf (buf, "%'.0f", 1000.0) < 0) + return 1; + if (strlen (localeconv ()->thousands_sep) > 1) + { + if (strlen (buf) <= 4 + 1) + return 2; + else + return 3; + } + return 0; +}]])], + [:], + [case $? in + 2) gl_cv_func_printf_flag_grouping_multibyte=no ;; + 3) gl_cv_func_printf_flag_grouping_multibyte=yes ;; + esac + ], + [:]) + ]) +]) + dnl Test whether the *printf family of functions supports the - flag correctly. dnl (ISO C99.) See dnl @@ -1709,6 +1828,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], #include #include #include +#if defined _WIN32 && !defined __CYGWIN__ +# include +#else +# include +#endif #if HAVE_SNPRINTF # define my_snprintf snprintf #else @@ -2143,20 +2267,22 @@ dnl 11 = gl_PRINTF_DIRECTIVE_LS dnl 12 = gl_PRINTF_DIRECTIVE_LC dnl 13 = gl_PRINTF_POSITIONS dnl 14 = gl_PRINTF_FLAG_GROUPING -dnl 15 = gl_PRINTF_FLAG_LEFTADJUST -dnl 16 = gl_PRINTF_FLAG_ZERO -dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO -dnl 18 = gl_PRINTF_PRECISION -dnl 19 = gl_PRINTF_ENOMEM -dnl 20 = gl_SNPRINTF_PRESENCE -dnl 21 = gl_SNPRINTF_TRUNCATION_C99 -dnl 22 = gl_SNPRINTF_RETVAL_C99 -dnl 23 = gl_SNPRINTF_DIRECTIVE_N -dnl 24 = gl_SNPRINTF_SIZE1 -dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99 -dnl 26 = gl_SWPRINTF_WORKS -dnl 27 = gl_SWPRINTF_DIRECTIVE_LA -dnl 28 = gl_SWPRINTF_DIRECTIVE_LC +dnl 15 = gl_PRINTF_FLAG_GROUPING_INT_PRECISION +dnl 16 = gl_PRINTF_FLAG_GROUPING_MULTIBYTE +dnl 17 = gl_PRINTF_FLAG_LEFTADJUST +dnl 18 = gl_PRINTF_FLAG_ZERO +dnl 19 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO +dnl 20 = gl_PRINTF_PRECISION +dnl 21 = gl_PRINTF_ENOMEM +dnl 22 = gl_SNPRINTF_PRESENCE +dnl 23 = gl_SNPRINTF_TRUNCATION_C99 +dnl 24 = gl_SNPRINTF_RETVAL_C99 +dnl 25 = gl_SNPRINTF_DIRECTIVE_N +dnl 26 = gl_SNPRINTF_SIZE1 +dnl 27 = gl_VSNPRINTF_ZEROSIZE_C99 +dnl 28 = gl_SWPRINTF_WORKS +dnl 29 = gl_SWPRINTF_DIRECTIVE_LA +dnl 30 = gl_SWPRINTF_DIRECTIVE_LC dnl dnl 1 = checking whether printf supports size specifiers as in C99... dnl 2 = checking whether printf supports size specifiers as in C23... @@ -2172,62 +2298,64 @@ dnl 11 = checking whether printf supports the 'ls' directive... dnl 12 = checking whether printf supports the 'lc' directive correctly... dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... dnl 14 = checking whether printf supports the grouping flag... -dnl 15 = checking whether printf supports the left-adjust flag correctly... -dnl 16 = checking whether printf supports the zero flag correctly... -dnl 17 = checking whether printf supports the alternative flag with a zero precision... -dnl 18 = checking whether printf supports large precisions... -dnl 19 = checking whether printf survives out-of-memory conditions... -dnl 20 = checking for snprintf... -dnl 21 = checking whether snprintf truncates the result as in C99... -dnl 22 = checking whether snprintf returns a byte count as in C99... -dnl 23 = checking whether snprintf fully supports the 'n' directive... -dnl 24 = checking whether snprintf respects a size of 1... -dnl 25 = checking whether vsnprintf respects a zero size as in C99... -dnl 26 = checking whether swprintf works... -dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives... -dnl 28 = checking whether swprintf supports the 'lc' directive... +dnl 15 = checking whether printf supports grouping on integers with a precision... +dnl 16 = checking whether printf supports grouping with a multibyte separator... +dnl 17 = checking whether printf supports the left-adjust flag correctly... +dnl 18 = checking whether printf supports the zero flag correctly... +dnl 19 = checking whether printf supports the alternative flag with a zero precision... +dnl 20 = checking whether printf supports large precisions... +dnl 21 = checking whether printf survives out-of-memory conditions... +dnl 22 = checking for snprintf... +dnl 23 = checking whether snprintf truncates the result as in C99... +dnl 24 = checking whether snprintf returns a byte count as in C99... +dnl 25 = checking whether snprintf fully supports the 'n' directive... +dnl 26 = checking whether snprintf respects a size of 1... +dnl 27 = checking whether vsnprintf respects a zero size as in C99... +dnl 28 = checking whether swprintf works... +dnl 29 = checking whether swprintf supports the 'La' and 'LA' directives... +dnl 30 = checking whether swprintf supports the 'lc' directive... dnl dnl . = yes, # = no. dnl -dnl 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 -dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . ? . . . . . . . . # . # -dnl glibc 2.35 . # . . . . . . . . . . . . . . . . . . . . . . . . . . -dnl glibc 2.5 . # . . . . # # . . . . . . . . . . . . . . . . . . # . -dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . # . -dnl FreeBSD 14.0 . . . . . # . . . . . . . . . . . . # . . . . . . # . # -dnl FreeBSD 13.0 . # . . . # # # . . . . . . . . . . # . . . . . . # . # -dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . # ? . # . . . . . . # ? ? -dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . . . . . . . . . # . . # ? ? -dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . . # # . . . . . . . . # ? ? -dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . . # # . # . . . . . . # ? ? -dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . # . . . . . . # . # -dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # . # ? . # . . . . . . # ? ? -dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . ? . ? . . . . . . ? ? ? -dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . ? . # . . . . . . ? ? ? -dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # ? # # . . . . . . ? ? ? -dnl Solaris 11.4 . # . # # # # # . . # . . . . # . . . . . . . . . . # . -dnl Solaris 11.3 . # . . . # # # . . # . . . . . . . . . . . . . . . # . -dnl Solaris 11.0 . # . # # # # # . . # . . . . # . . . . . . . . . ? ? ? -dnl Solaris 10 . # . # # # # # . . # . . . . # . # . . . . . . . . # . -dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . . # ? # . . . # . . . ? ? ? -dnl Solaris 2.5.1 # # . # # # # # # . # . . . . # ? . . # # # # # # ? ? ? -dnl AIX 7.1 . # . # # # # # . . . . . . . # . # . . . . . . . # . . -dnl AIX 5.2 . # . # # # # # . . . . . . . # ? . . . . . . . . # ? ? -dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . . # ? . . . . # . . . # ? ? -dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # ? . . . . # # . . ? ? ? -dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # ? . . . . # # . # ? ? ? -dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # ? . . . . # # ? # ? ? ? -dnl IRIX 6.5 # # . # # # # # # . # . . . . # ? . . . . # . . . # ? ? -dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # ? . . . . # . . # ? ? ? -dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # ? . . # # # # # # ? ? ? -dnl NetBSD 9.0 . # . . . # # # . . . . . . . . . . . . . . . . . # . # -dnl NetBSD 5.0 . # . . # # # # . . . . . . . # ? . # . . . . . . # ? ? -dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? . . . ? ? ? # ? ? -dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? # ? . # . . . . . . # ? ? -dnl Haiku . # . . # # # # # . # ? . . . . ? . ? . . ? . . . . # . -dnl BeOS # # # . # # # # # . ? ? # . ? . ? # ? . . ? . . . ? ? ? -dnl Android 4.3 . # . # # # # # # # # ? . # . # ? . # . . . # . . ? ? ? -dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? -dnl MSVC 9 # # # # # # # # # # . ? # # . # ? # ? # # # # . . # ? ? -dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . ? . ? . . . . . . # ? ? -dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? +dnl 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 +dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . . . . . . . . . . . . # . # +dnl glibc 2.35 . # . . . . . . . . . . . . # . . . . . . . . . . . . . . . +dnl glibc 2.5 . # . . . . # # . . . . . . # . . . . . . . . . . . . . # . +dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . . . # . +dnl FreeBSD 14.0 . . . . . # . . . . . . . . # . . . . . # . . . . . . # . # +dnl FreeBSD 13.0 . # . . . # # # . . . . . . # . . . . . # . . . . . . # . # +dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . . . # ? . # . . . . . . # ? ? +dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . ? ? . . . . . . . . # . . # ? ? +dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . ? ? . # # . . . . . . . . # ? ? +dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . ? ? . # # . # . . . . . . # ? ? +dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . . . # . . . . . . # . # +dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # ? ? . # ? . # . . . . . . # ? ? +dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . ? ? . . ? . ? . . . . . . ? ? ? +dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . ? ? . . ? . # . . . . . . ? ? ? +dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # ? ? . # ? # # . . . . . . ? ? ? +dnl Solaris 11.4 . # . # # # # # . . # . . . # # . # . . . . . . . . . . # . +dnl Solaris 11.3 . # . . . # # # . . # . . . ? ? . . . . . . . . . . . . # . +dnl Solaris 11.0 . # . # # # # # . . # . . . ? ? . # . . . . . . . . . ? ? ? +dnl Solaris 10 . # . # # # # # . . # . . . # # . # . # . . . . . . . . # . +dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . ? ? . # ? # . . . # . . . ? ? ? +dnl Solaris 2.5.1 # # . # # # # # # . # . . . ? ? . # ? . . # # # # # # ? ? ? +dnl AIX 7.1 . # . # # # # # . . . . . . . . . # . # . . . . . . . # . . +dnl AIX 5.2 . # . # # # # # . . . . . . ? ? . # ? . . . . . . . . # ? ? +dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . ? ? . # ? . . . . # . . . # ? ? +dnl HP-UX 11.31 . # . . . # # # . . . ? . . ? ? . # ? . . . . # # . . ? ? ? +dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . ? ? . # ? . . . . # # . # ? ? ? +dnl HP-UX 10.20 # # . # . # # # # . ? ? . . ? ? # # ? . . . . # # ? # ? ? ? +dnl IRIX 6.5 # # . # # # # # # . # . . . ? ? . # ? . . . . # . . . # ? ? +dnl OSF/1 5.1 # # . # # # # # # . . ? . . ? ? . # ? . . . . # . . # ? ? ? +dnl OSF/1 4.0d # # . # # # # # # . . ? . . ? ? . # ? . . # # # # # # ? ? ? +dnl NetBSD 9.0 . # . . . # # # . . . . . . # # . . . . . . . . . . . # . # +dnl NetBSD 5.0 . # . . # # # # . . . . . . ? ? . # ? . # . . . . . . # ? ? +dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? ? ? . . . ? ? ? # ? ? +dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? ? ? # ? . # . . . . . . # ? ? +dnl Haiku . # . . # # # # # . # ? . . # . . . ? . ? . . ? . . . . # . +dnl BeOS # # # . # # # # # . ? ? # . ? ? ? . ? # ? . . ? . . . ? ? ? +dnl Android 4.3 . # . # # # # # # # # ? . # ? ? . # ? . # . . . # . . ? ? ? +dnl old mingw / msvcrt # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ? +dnl MSVC 9 # # # # # # # # # # . ? # # ? ? . # ? # ? # # # # . . # ? ? +dnl mingw 2009-2011 . # # . # . # # . . . ? # # ? ? . . ? . ? . . . . . . # ? ? +dnl 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 @@ +# pthread-once.m4 +# serial 6 +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_PTHREAD_ONCE], +[ + AC_REQUIRE([gl_PTHREAD_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PTHREADLIB]) + + if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + dnl Choose function names that don't conflict with the mingw-w64 winpthreads + dnl library. + REPLACE_PTHREAD_ONCE=1 + PTHREAD_ONCE_LIB= + else + if test $HAVE_PTHREAD_H = 0; then + HAVE_PTHREAD_ONCE=0 + PTHREAD_ONCE_LIB= + else + dnl Work around Cygwin 3.5.3 bug. + AC_CACHE_CHECK([whether pthread_once works], + [gl_cv_func_pthread_once_works], + [case "$host_os" in + cygwin*) gl_cv_func_pthread_once_works="guessing no" ;; + *) gl_cv_func_pthread_once_works="yes" ;; + esac + ]) + case "$gl_cv_func_pthread_once_works" in + *yes) ;; + *) REPLACE_PTHREAD_ONCE=1 ;; + esac + dnl Determine whether linking requires $(LIBPMULTITHREAD) or only + dnl $(LIBPTHREAD). + if test -z "$LIBPTHREAD" && test -n "$LIBPMULTITHREAD"; then + AC_CACHE_CHECK([whether pthread_once can be used without linking with libpthread], + [gl_cv_func_pthread_once_no_lib], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + static pthread_once_t a_once = PTHREAD_ONCE_INIT; + static int a; + static void a_init (void) { a = 8647; } + ]], + [[if (pthread_once (&a_once, a_init)) return 1; + if (a != 8647) return 2; + return 0; + ]])], + [gl_cv_func_pthread_once_no_lib=yes], + [gl_cv_func_pthread_once_no_lib=no], + [case "$host_os" in + # Guess no on glibc. + *-gnu* | gnu*) + gl_cv_func_pthread_once_no_lib="guessing no" ;; + # Guess no on FreeBSD. + freebsd* | dragonfly* | midnightbsd*) + gl_cv_func_pthread_once_no_lib="guessing no" ;; + # Guess yes otherwise. + *) + gl_cv_func_pthread_once_no_lib="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_pthread_once_no_lib" in + *yes) PTHREAD_ONCE_LIB="$LIBPTHREAD" ;; + *) PTHREAD_ONCE_LIB="$LIBPMULTITHREAD" ;; + esac + dnl Expected result: + dnl PTHREAD_ONCE_LIB is $(LIBPMULTITHREAD) on glibc < 2.34, FreeBSD. + dnl PTHREAD_ONCE_LIB is $(LIBPTHREAD) in particular on + dnl musl libc, macOS, NetBSD, Solaris, Cygwin, Haiku, Android. + else + PTHREAD_ONCE_LIB="$LIBPTHREAD" + fi + fi + fi + AC_SUBST([PTHREAD_ONCE_LIB]) +]) 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 @@ +# pthread-spin.m4 +# serial 8 +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_PTHREAD_SPIN], +[ + AC_REQUIRE([gl_PTHREAD_H_PART1]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + dnl Choose function names that don't conflict with the mingw-w64 winpthreads + dnl library. + REPLACE_PTHREAD_SPIN_INIT=1 + REPLACE_PTHREAD_SPIN_LOCK=1 + REPLACE_PTHREAD_SPIN_TRYLOCK=1 + REPLACE_PTHREAD_SPIN_UNLOCK=1 + REPLACE_PTHREAD_SPIN_DESTROY=1 + else + if test $HAVE_PTHREAD_H = 0 || test $HAVE_PTHREAD_SPINLOCK_T = 0; then + HAVE_PTHREAD_SPIN_INIT=0 + HAVE_PTHREAD_SPIN_LOCK=0 + HAVE_PTHREAD_SPIN_TRYLOCK=0 + HAVE_PTHREAD_SPIN_UNLOCK=0 + HAVE_PTHREAD_SPIN_DESTROY=0 + else + dnl Test whether the gnulib module 'threadlib' is in use. + dnl Some packages like Emacs use --avoid=threadlib. + dnl Write the symbol in such a way that it does not cause 'aclocal' to pick + dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. + m4_ifdef([gl_][THREADLIB], [ + AC_REQUIRE([gl_][THREADLIB]) + dnl Test whether the functions actually exist. + dnl FreeBSD 5.2.1 declares them but does not define them. + AC_CACHE_CHECK([for pthread_spin_init], + [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD], + [gl_saved_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[pthread_spinlock_t lock; + return pthread_spin_init (&lock, 0); + ]]) + ], + [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=yes], + [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=no]) + LIBS="$gl_saved_LIBS" + ]) + if test $gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD != yes; then + HAVE_PTHREAD_SPIN_INIT=0 + REPLACE_PTHREAD_SPIN_INIT=1 + HAVE_PTHREAD_SPIN_LOCK=0 + REPLACE_PTHREAD_SPIN_LOCK=1 + HAVE_PTHREAD_SPIN_TRYLOCK=0 + REPLACE_PTHREAD_SPIN_TRYLOCK=1 + HAVE_PTHREAD_SPIN_UNLOCK=0 + REPLACE_PTHREAD_SPIN_UNLOCK=1 + HAVE_PTHREAD_SPIN_DESTROY=0 + REPLACE_PTHREAD_SPIN_DESTROY=1 + fi + ], [ + : + ]) + fi + fi +]) 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 @@ +# pthread_h.m4 +# serial 11 +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_PTHREAD_H_PART1], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) + + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PTHREADLIB]) + + gl_CHECK_NEXT_HEADERS([pthread.h]) + if test $ac_cv_header_pthread_h = yes; then + HAVE_PTHREAD_H=1 + dnl On mingw, if --enable-threads=windows or gl_AVOID_WINPTHREAD is used, + dnl ignore the from the mingw-w64 winpthreads library. + m4_ifdef([gl_][THREADLIB], [ + AC_REQUIRE([gl_][THREADLIB]) + if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + HAVE_PTHREAD_H=0 + fi + ]) + else + HAVE_PTHREAD_H=0 + fi + AC_SUBST([HAVE_PTHREAD_H]) + + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [], + [AC_INCLUDES_DEFAULT[ + #if HAVE_PTHREAD_H + #include + #endif]]) + if test $ac_cv_type_pthread_t != yes; then + HAVE_PTHREAD_T=0 + fi + if test $ac_cv_type_pthread_spinlock_t != yes; then + HAVE_PTHREAD_SPINLOCK_T=0 + fi +]) + +AC_DEFUN([gl_PTHREAD_H], +[ + AC_REQUIRE([gl_PTHREAD_H_PART1]) + + dnl Set HAVE_PTHREAD_SPIN_INIT, REPLACE_PTHREAD_SPIN_INIT. + gl_PTHREAD_SPIN + + dnl Constants may be defined as C preprocessor macros or as enum items. + + AC_CACHE_CHECK([for PTHREAD_CREATE_DETACHED], + [gl_cv_const_PTHREAD_CREATE_DETACHED], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = PTHREAD_CREATE_DETACHED; + ]], + [[]])], + [gl_cv_const_PTHREAD_CREATE_DETACHED=yes], + [gl_cv_const_PTHREAD_CREATE_DETACHED=no]) + ]) + if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then + HAVE_PTHREAD_CREATE_DETACHED=0 + fi + + AC_CACHE_CHECK([for PTHREAD_MUTEX_RECURSIVE], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = PTHREAD_MUTEX_RECURSIVE; + ]], + [[]])], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no]) + ]) + if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then + HAVE_PTHREAD_MUTEX_RECURSIVE=0 + fi + + AC_CACHE_CHECK([for PTHREAD_MUTEX_ROBUST], + [gl_cv_const_PTHREAD_MUTEX_ROBUST], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = PTHREAD_MUTEX_ROBUST; + ]], + [[]])], + [gl_cv_const_PTHREAD_MUTEX_ROBUST=yes], + [gl_cv_const_PTHREAD_MUTEX_ROBUST=no]) + ]) + if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then + HAVE_PTHREAD_MUTEX_ROBUST=0 + fi + + AC_CACHE_CHECK([for PTHREAD_PROCESS_SHARED], + [gl_cv_const_PTHREAD_PROCESS_SHARED], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = PTHREAD_PROCESS_SHARED; + ]], + [[]])], + [gl_cv_const_PTHREAD_PROCESS_SHARED=yes], + [gl_cv_const_PTHREAD_PROCESS_SHARED=no]) + ]) + if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then + HAVE_PTHREAD_PROCESS_SHARED=0 + fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include + ]], [ + pthread_create pthread_attr_init pthread_attr_getdetachstate + pthread_attr_setdetachstate pthread_attr_destroy pthread_self pthread_equal + pthread_detach pthread_join pthread_exit + pthread_once + pthread_mutex_init pthread_mutexattr_init pthread_mutexattr_gettype + pthread_mutexattr_settype pthread_mutexattr_getrobust + pthread_mutexattr_setrobust pthread_mutexattr_destroy pthread_mutex_lock + pthread_mutex_trylock pthread_mutex_timedlock pthread_mutex_unlock + pthread_mutex_destroy + pthread_rwlock_init pthread_rwlockattr_init pthread_rwlockattr_destroy + pthread_rwlock_rdlock pthread_rwlock_wrlock pthread_rwlock_tryrdlock + pthread_rwlock_trywrlock pthread_rwlock_timedrdlock + pthread_rwlock_timedwrlock pthread_rwlock_unlock pthread_rwlock_destroy + pthread_cond_init pthread_condattr_init pthread_condattr_destroy + pthread_cond_wait pthread_cond_timedwait pthread_cond_signal + pthread_cond_broadcast pthread_cond_destroy + pthread_key_create pthread_setspecific pthread_getspecific + pthread_key_delete + pthread_spin_init pthread_spin_lock pthread_spin_trylock pthread_spin_unlock + pthread_spin_destroy]) + + AC_REQUIRE([AC_C_RESTRICT]) + + dnl For backward compatibility with gnulib versions <= 2019-07. + LIB_PTHREAD="$LIBPMULTITHREAD" + AC_SUBST([LIB_PTHREAD]) +]) + +# gl_PTHREAD_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_PTHREAD_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_PTHREAD_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_PTHREAD_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_THREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_ONCE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_RWLOCK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_COND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_TSS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SPIN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX_TIMEDLOCK]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) +]) + +AC_DEFUN([gl_PTHREAD_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T]) + HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T]) + HAVE_PTHREAD_CREATE_DETACHED=1; AC_SUBST([HAVE_PTHREAD_CREATE_DETACHED]) + HAVE_PTHREAD_MUTEX_RECURSIVE=1; AC_SUBST([HAVE_PTHREAD_MUTEX_RECURSIVE]) + HAVE_PTHREAD_MUTEX_ROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEX_ROBUST]) + HAVE_PTHREAD_PROCESS_SHARED=1; AC_SUBST([HAVE_PTHREAD_PROCESS_SHARED]) + HAVE_PTHREAD_CREATE=1; AC_SUBST([HAVE_PTHREAD_CREATE]) + HAVE_PTHREAD_ATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_ATTR_INIT]) + HAVE_PTHREAD_ATTR_GETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_GETDETACHSTATE]) + HAVE_PTHREAD_ATTR_SETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_SETDETACHSTATE]) + HAVE_PTHREAD_ATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_ATTR_DESTROY]) + HAVE_PTHREAD_SELF=1; AC_SUBST([HAVE_PTHREAD_SELF]) + HAVE_PTHREAD_EQUAL=1; AC_SUBST([HAVE_PTHREAD_EQUAL]) + HAVE_PTHREAD_DETACH=1; AC_SUBST([HAVE_PTHREAD_DETACH]) + HAVE_PTHREAD_JOIN=1; AC_SUBST([HAVE_PTHREAD_JOIN]) + HAVE_PTHREAD_EXIT=1; AC_SUBST([HAVE_PTHREAD_EXIT]) + HAVE_PTHREAD_ONCE=1; AC_SUBST([HAVE_PTHREAD_ONCE]) + HAVE_PTHREAD_MUTEX_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEX_INIT]) + HAVE_PTHREAD_MUTEXATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_INIT]) + HAVE_PTHREAD_MUTEXATTR_GETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETTYPE]) + HAVE_PTHREAD_MUTEXATTR_SETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETTYPE]) + HAVE_PTHREAD_MUTEXATTR_GETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETROBUST]) + HAVE_PTHREAD_MUTEXATTR_SETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETROBUST]) + HAVE_PTHREAD_MUTEXATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_DESTROY]) + HAVE_PTHREAD_MUTEX_LOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_LOCK]) + HAVE_PTHREAD_MUTEX_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TRYLOCK]) + HAVE_PTHREAD_MUTEX_TIMEDLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TIMEDLOCK]) + HAVE_PTHREAD_MUTEX_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_UNLOCK]) + HAVE_PTHREAD_MUTEX_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEX_DESTROY]) + HAVE_PTHREAD_RWLOCK_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_INIT]) + HAVE_PTHREAD_RWLOCKATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_INIT]) + HAVE_PTHREAD_RWLOCKATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_DESTROY]) + HAVE_PTHREAD_RWLOCK_RDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_RDLOCK]) + HAVE_PTHREAD_RWLOCK_WRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_WRLOCK]) + HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYRDLOCK]) + HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYWRLOCK]) + HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK]) + HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK]) + HAVE_PTHREAD_RWLOCK_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_UNLOCK]) + HAVE_PTHREAD_RWLOCK_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_DESTROY]) + HAVE_PTHREAD_COND_INIT=1; AC_SUBST([HAVE_PTHREAD_COND_INIT]) + HAVE_PTHREAD_CONDATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_INIT]) + HAVE_PTHREAD_CONDATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_DESTROY]) + HAVE_PTHREAD_COND_WAIT=1; AC_SUBST([HAVE_PTHREAD_COND_WAIT]) + HAVE_PTHREAD_COND_TIMEDWAIT=1; AC_SUBST([HAVE_PTHREAD_COND_TIMEDWAIT]) + HAVE_PTHREAD_COND_SIGNAL=1; AC_SUBST([HAVE_PTHREAD_COND_SIGNAL]) + HAVE_PTHREAD_COND_BROADCAST=1; AC_SUBST([HAVE_PTHREAD_COND_BROADCAST]) + HAVE_PTHREAD_COND_DESTROY=1; AC_SUBST([HAVE_PTHREAD_COND_DESTROY]) + HAVE_PTHREAD_KEY_CREATE=1; AC_SUBST([HAVE_PTHREAD_KEY_CREATE]) + HAVE_PTHREAD_SETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_SETSPECIFIC]) + HAVE_PTHREAD_GETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_GETSPECIFIC]) + HAVE_PTHREAD_KEY_DELETE=1; AC_SUBST([HAVE_PTHREAD_KEY_DELETE]) + HAVE_PTHREAD_SPIN_INIT=1; AC_SUBST([HAVE_PTHREAD_SPIN_INIT]) + HAVE_PTHREAD_SPIN_LOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_LOCK]) + HAVE_PTHREAD_SPIN_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_TRYLOCK]) + HAVE_PTHREAD_SPIN_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_UNLOCK]) + HAVE_PTHREAD_SPIN_DESTROY=1; AC_SUBST([HAVE_PTHREAD_SPIN_DESTROY]) + REPLACE_PTHREAD_CREATE=0; AC_SUBST([REPLACE_PTHREAD_CREATE]) + REPLACE_PTHREAD_ATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_ATTR_INIT]) + REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_GETDETACHSTATE]) + REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_SETDETACHSTATE]) + REPLACE_PTHREAD_ATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_ATTR_DESTROY]) + REPLACE_PTHREAD_SELF=0; AC_SUBST([REPLACE_PTHREAD_SELF]) + REPLACE_PTHREAD_EQUAL=0; AC_SUBST([REPLACE_PTHREAD_EQUAL]) + REPLACE_PTHREAD_DETACH=0; AC_SUBST([REPLACE_PTHREAD_DETACH]) + REPLACE_PTHREAD_JOIN=0; AC_SUBST([REPLACE_PTHREAD_JOIN]) + REPLACE_PTHREAD_EXIT=0; AC_SUBST([REPLACE_PTHREAD_EXIT]) + REPLACE_PTHREAD_ONCE=0; AC_SUBST([REPLACE_PTHREAD_ONCE]) + REPLACE_PTHREAD_MUTEX_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_INIT]) + REPLACE_PTHREAD_MUTEXATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_INIT]) + REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETTYPE]) + REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETTYPE]) + REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETROBUST]) + REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETROBUST]) + REPLACE_PTHREAD_MUTEXATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_DESTROY]) + REPLACE_PTHREAD_MUTEX_LOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_LOCK]) + REPLACE_PTHREAD_MUTEX_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TRYLOCK]) + REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TIMEDLOCK]) + REPLACE_PTHREAD_MUTEX_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_UNLOCK]) + REPLACE_PTHREAD_MUTEX_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_DESTROY]) + REPLACE_PTHREAD_RWLOCK_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_INIT]) + REPLACE_PTHREAD_RWLOCKATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_INIT]) + REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_DESTROY]) + REPLACE_PTHREAD_RWLOCK_RDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_RDLOCK]) + REPLACE_PTHREAD_RWLOCK_WRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_WRLOCK]) + REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYRDLOCK]) + REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYWRLOCK]) + REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK]) + REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK]) + REPLACE_PTHREAD_RWLOCK_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_UNLOCK]) + REPLACE_PTHREAD_RWLOCK_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_DESTROY]) + REPLACE_PTHREAD_COND_INIT=0; AC_SUBST([REPLACE_PTHREAD_COND_INIT]) + REPLACE_PTHREAD_CONDATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_INIT]) + REPLACE_PTHREAD_CONDATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_DESTROY]) + REPLACE_PTHREAD_COND_WAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_WAIT]) + REPLACE_PTHREAD_COND_TIMEDWAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_TIMEDWAIT]) + REPLACE_PTHREAD_COND_SIGNAL=0; AC_SUBST([REPLACE_PTHREAD_COND_SIGNAL]) + REPLACE_PTHREAD_COND_BROADCAST=0; AC_SUBST([REPLACE_PTHREAD_COND_BROADCAST]) + REPLACE_PTHREAD_COND_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_COND_DESTROY]) + REPLACE_PTHREAD_KEY_CREATE=0; AC_SUBST([REPLACE_PTHREAD_KEY_CREATE]) + REPLACE_PTHREAD_SETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_SETSPECIFIC]) + REPLACE_PTHREAD_GETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_GETSPECIFIC]) + REPLACE_PTHREAD_KEY_DELETE=0; AC_SUBST([REPLACE_PTHREAD_KEY_DELETE]) + REPLACE_PTHREAD_SPIN_INIT=0; AC_SUBST([REPLACE_PTHREAD_SPIN_INIT]) + REPLACE_PTHREAD_SPIN_LOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_LOCK]) + REPLACE_PTHREAD_SPIN_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_TRYLOCK]) + REPLACE_PTHREAD_SPIN_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_UNLOCK]) + REPLACE_PTHREAD_SPIN_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_SPIN_DESTROY]) +]) 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 @@ # pthread_rwlock_rdlock.m4 # serial 8 -dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2017-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. dnl 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 @@ # realloc.m4 -# serial 29 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 39.1 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. -# This is adapted with modifications from upstream Autoconf here: -# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 -AC_DEFUN([_AC_FUNC_REALLOC_IF], +# An an experimental option, the user can request a sanitized realloc() +# implementation, i.e. one that aborts upon undefined behaviour, +# by setting +# gl_cv_func_realloc_sanitize=yes +# at configure time. +AC_DEFUN([gl_FUNC_REALLOC_SANITIZED], [ - AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles - AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], - [ac_cv_func_realloc_0_nonnull], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], - [[void *p = realloc (0, 0); - void * volatile vp = p; - int result = !vp; - free (p); - return result;]]) - ], - [ac_cv_func_realloc_0_nonnull=yes], - [ac_cv_func_realloc_0_nonnull=no], - [case "$host_os" in - # Guess yes on platforms where we know the result. - *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ - | gnu* | *-musl* | midipix* | midnightbsd* \ - | hpux* | solaris* | cygwin* | mingw* | windows* | msys* ) - ac_cv_func_realloc_0_nonnull="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; - esac - ]) - ]) - AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2]) -])# AC_FUNC_REALLOC - -# gl_FUNC_REALLOC_GNU -# ------------------- -# Replace realloc if it is not compatible with GNU libc. -AC_DEFUN([gl_FUNC_REALLOC_GNU], -[ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) - if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then - _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1]) - fi -])# gl_FUNC_REALLOC_GNU + AC_CACHE_CHECK([whether realloc should abort upon undefined behaviour], + [gl_cv_func_realloc_sanitize], + [test -n "$gl_cv_func_realloc_sanitize" || gl_cv_func_realloc_sanitize=no]) +]) # gl_FUNC_REALLOC_POSIX # --------------------- @@ -59,7 +27,100 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) - if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether realloc sets errno on failure], + [gl_cv_func_realloc_posix], + [ + dnl FreeBSD 15.0 realloc() does not set errno when asked for more than + dnl 0x7000000000000000 bytes. + case "$host_os" in + darwin* | freebsd* | dragonfly* | midnightbsd* | netbsd* | openbsd*) + AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include + #include + int main (int argc, char **argv) + { + void *p; + errno = 1729; + p = realloc (malloc (1), (size_t)(-1) / 100 * 49); + return (!p && errno == 1729); + } + ]]) + ], + [gl_cv_func_realloc_posix=yes], + [gl_cv_func_realloc_posix=no], + [case "$host_os" in + freebsd*) gl_cv_func_realloc_posix="guessing no" ;; + *) gl_cv_func_realloc_posix="guessing yes" ;; + esac + ]) + ;; + *) + gl_cv_func_realloc_posix="$gl_cv_func_malloc_posix" + ;; + esac + ]) + case "$gl_cv_func_realloc_posix" in + *yes) + AC_DEFINE([HAVE_REALLOC_POSIX], [1], + [Define if realloc sets errno on allocation failure.]) + ;; + *) + REPLACE_REALLOC_FOR_REALLOC_POSIX=1 + ;; + esac + AC_REQUIRE([gl_FUNC_REALLOC_SANITIZED]) + if test "$gl_cv_func_realloc_sanitize" != no; then REPLACE_REALLOC_FOR_REALLOC_POSIX=1 + AC_DEFINE([NEED_SANITIZED_REALLOC], [1], + [Define to 1 if realloc should abort upon undefined behaviour.]) fi ]) + +# gl_FUNC_REALLOC_0_NONNULL +# ------------------------- +# Replace realloc if realloc (..., 0) returns null. +# Modules that use this macro directly or indirectly should depend +# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined +# before this macro gets invoked. This helps if !(__VEC__ || __AIXVEC), +# and doesn't hurt otherwise. +AC_DEFUN([gl_FUNC_REALLOC_0_NONNULL], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles + AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) + AC_CACHE_CHECK([whether realloc (..., 0) returns nonnull], + [gl_cv_func_realloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + /* Use prealloc to test; "volatile" prevents the compiler + from optimizing the realloc call away. */ + void *(*volatile prealloc) (void *, size_t) = realloc;]], + [[void *p = prealloc (0, 0); + int result = !p; + p = prealloc (p, 0); + result |= !p; + free (p); + return result;]])], + [gl_cv_func_realloc_0_nonnull=yes], + [gl_cv_func_realloc_0_nonnull=no], + [AS_CASE([$host_os], + [# Guess yes on platforms where we know the result. + freebsd* | netbsd* | openbsd* | darwin* | bitrig* \ + | *-musl* | midipix* | midnightbsd* \ + | hpux* | solaris* | cygwin*], + [gl_cv_func_realloc_0_nonnull="guessing yes"], + [# Guess as follows if we don't know. + gl_cv_func_realloc_0_nonnull=$gl_cross_guess_normal])])]) + AS_CASE([$gl_cv_func_realloc_0_nonnull], + [*yes], + [AC_DEFINE([HAVE_REALLOC_0_NONNULL], [1], + [Define to 1 if realloc (..., 0) returns nonnull.])], + [AS_CASE([$gl_cv_func_realloc_sanitize,$gl_cv_malloc_ptrdiff,$gl_cv_func_malloc_posix,$host], + [yes,*,*,* | *,no,*,* | *,*,*no,* | *,*,*,aarch64c-*-freebsd*], + [REPLACE_REALLOC_FOR_REALLOC_POSIX=1], + [# Optimize for common case of glibc 2.1.1+ and compatibles. + REPLACE_REALLOC_FOR_REALLOC_POSIX=2])]) +]) 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 @@ # reallocarray.m4 -# serial 5 -dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. +# serial 7 +dnl Copyright (C) 2017-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_REALLOCARRAY], [ @@ -12,14 +13,21 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY], AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) + AC_REQUIRE([gl_FUNC_REALLOC_0_NONNULL]) gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include ]]) if test "$ac_cv_func_reallocarray" = no; then HAVE_REALLOCARRAY=0 case "$gl_cv_onwards_func_reallocarray" in future*) REPLACE_REALLOCARRAY=1 ;; esac - elif test "$gl_cv_malloc_ptrdiff" = no; then - REPLACE_REALLOCARRAY=1 + else + if test "$gl_cv_malloc_ptrdiff" = no; then + REPLACE_REALLOCARRAY=1 + fi + case "$gl_cv_func_realloc_0_nonnull" in + *yes) ;; + *) REPLACE_REALLOCARRAY=1 ;; + esac fi ]) 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 @@ # regex.m4 -# serial 75 -dnl Copyright (C) 1996-2001, 2003-2024 Free Software Foundation, Inc. +# serial 81 +dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Initially derived from code in GNU grep. dnl Mostly written by Jim Meyering. @@ -39,19 +40,24 @@ AC_DEFUN([gl_REGEX], #include #include - #if defined M_CHECK_ACTION || HAVE_DECL_ALARM - # include - # include + #if HAVE_MALLOC_H + # include /* defines M_CHECK_ACTION on glibc */ #endif - #if HAVE_MALLOC_H - # include + #if defined __HAIKU__ || defined M_CHECK_ACTION || HAVE_DECL_ALARM + # include + # include #endif - #ifdef M_CHECK_ACTION + #if defined __HAIKU__ || defined M_CHECK_ACTION /* Exit with distinguishable exit code. */ static void sigabrt_no_core (int sig) { raise (SIGTERM); } #endif + + /* There is no need to check whether RE_SYNTAX_EMACS is + (RE_CHAR_CLASSES | RE_INTERVALS), corresponding to + Emacs 21 (2001) and later, because Gnulib's lib/regex.h + is always used and has this value. */ ]], [[int result = 0; static struct re_pattern_buffer regex; @@ -67,6 +73,9 @@ AC_DEFUN([gl_REGEX], signal (SIGALRM, SIG_DFL); alarm (2); #endif +#ifdef __HAIKU__ + signal (SIGABRT, sigabrt_no_core); +#endif #ifdef M_CHECK_ACTION signal (SIGABRT, sigabrt_no_core); mallopt (M_CHECK_ACTION, 2); @@ -388,7 +397,6 @@ AC_DEFUN([gl_PREREQ_REGEX], AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) - AC_REQUIRE([gl_EEMALLOC]) AC_CHECK_HEADERS([libintl.h]) AC_CHECK_FUNCS_ONCE([isblank iswctype]) AC_CHECK_DECLS([isblank], [], [], [[#include ]]) 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 @@ +# sched_h.m4 +# serial 16 +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Bruno Haible. + +AC_DEFUN_ONCE([gl_SCHED_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_SCHED_H_DEFAULTS]) + + AC_REQUIRE([AC_CANONICAL_HOST]) + + AC_REQUIRE([gl_CHECK_HEADER_SYS_CDEFS_H]) + + AC_CHECK_HEADERS([sched.h], [], [], + [[#if HAVE_SYS_CDEFS_H + #include + #endif + ]]) + gl_NEXT_HEADERS([sched.h]) + + if test "$ac_cv_header_sched_h" = yes; then + HAVE_SCHED_H=1 + else + HAVE_SCHED_H=0 + fi + AC_SUBST([HAVE_SCHED_H]) + + if test "$HAVE_SCHED_H" = 1; then + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0], + [[#if HAVE_SYS_CDEFS_H + #include + #endif + #include + ]]) + else + HAVE_STRUCT_SCHED_PARAM=0 + case "$host_os" in + os2*) + dnl On OS/2 kLIBC, struct sched_param is in spawn.h. + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [], + [#include ]) + ;; + vms) + dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h. + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [], + [#include ]) + ;; + esac + fi + AC_SUBST([HAVE_STRUCT_SCHED_PARAM]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include + ]], [sched_yield]) +]) + +# gl_SCHED_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SCHED_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SCHED_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SCHED_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SCHED_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD]) + REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD]) +]) 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 @@ # servent.m4 # serial 5 -dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_SERVENT], [ 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 @@ # setenv.m4 -# serial 33 -dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. +# serial 35 +dnl Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_SETENV], [ @@ -155,6 +156,7 @@ AC_DEFUN([gl_PREREQ_SETENV], AC_REQUIRE([gl_ENVIRON]) AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_HEADERS([search.h]) + AC_CHECK_DECLS_ONCE([_putenv]) gl_CHECK_FUNCS_ANDROID([tsearch], [[#include ]]) ]) @@ -163,4 +165,5 @@ AC_DEFUN([gl_PREREQ_UNSETENV], [ AC_REQUIRE([gl_ENVIRON]) AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CHECK_DECLS_ONCE([_putenv]) ]) 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 @@ # setlocale_null.m4 -# serial 9 -dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. +# serial 10 +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. -AC_DEFUN([gl_FUNC_SETLOCALE_NULL], +AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL], [ AC_REQUIRE([AC_CANONICAL_HOST]) 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 @@ # sha256.m4 # serial 8 -dnl Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_SHA256], [ 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 @@ # size_max.m4 # serial 12 -dnl Copyright (C) 2003, 2005-2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. 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 @@ # snprintf.m4 # serial 7 -dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Libintl 0.17 will replace snprintf only if it does not support %1$s, dnl 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 @@ # socketlib.m4 # serial 4 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl gl_SOCKETLIB dnl 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 @@ # sockets.m4 # serial 7 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_SOCKETS], [ 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 @@ # socklen.m4 # serial 11 -dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Albert Chin, Windows fixes from Simon Josefsson. 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 @@ # sockpfaf.m4 -# serial 10 -dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. +# serial 11 +dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) dnl and some common address families (AF_INET, AF_INET6, ...). @@ -64,6 +65,13 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], AC_REQUIRE([gl_SYS_SOCKET_H]) AC_CHECK_HEADERS_ONCE([sys/un.h]) + dnl Windows versions released after 2017 may have support for AF_UNIX. + dnl Including it requires types from to be defined. + dnl . + if test "$ac_cv_header_winsock2_h" = yes; then + AC_CHECK_HEADERS([afunix.h], [], [], [#include ]) + fi + AC_CACHE_CHECK([for UNIX domain sockets], [gl_cv_socket_unix], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include @@ -75,6 +83,9 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], #endif #ifdef HAVE_WINSOCK2_H #include +#endif +#ifdef HAVE_AFUNIX_H +#include #endif]], [[int x = AF_UNIX; struct sockaddr_un y; 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 @@ # ssize_t.m4 # serial 6 -dnl Copyright (C) 2001-2003, 2006, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2003, 2006, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. dnl 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 @@ # stat-time.m4 # serial 1 -dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2025 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Checks for stat-related time functions. 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 @@ # stat.m4 # serial 21 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_STAT], [ 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 @@ # std-gnu11.m4 -# serial 1 +# serial 3 # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- +# The std-gnu23 module, which defines _AC_C_C23_OPTIONS, supersedes us. +m4_ifndef([_AC_C_C23_OPTIONS], [ + # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 # commit 017d5ddd82854911f0119691d91ea8a1438824d6 # dated Sun Apr 3 13:57:17 2016 -0700 +# with minor changes to commentary. # This implementation will be obsolete once we can assume Autoconf 2.70 # or later is installed everywhere a Gnulib program might be developed. m4_version_prereq([2.70], [], [ -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2025 Free Software Foundation, Inc. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or +# This file is part of Autoconf. This program is free +# software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -24,8 +29,15 @@ m4_version_prereq([2.70], [], [ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # +# Under Section 7 of GPL version 3, you are granted additional +# permissions described in the Autoconf Configure Script Exception, +# version 3.0, as published by the Free Software Foundation. +# # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# and a copy of the Autoconf Configure Script Exception along with +# this program; see the files COPYINGv3 and COPYING.EXCEPTION +# respectively. If not, see and +# . # Written by David MacKenzie, with help from # Akim Demaille, Paul Eggert, @@ -38,7 +50,7 @@ m4_version_prereq([2.70], [], [ # COMPILER ... is a space separated list of C compilers to search for. # This just gives the user an opportunity to specify an alternative # search list for the C compiler. -AC_DEFUN_ONCE([AC_PROG_CC], +AC_DEFUN([AC_PROG_CC], [AC_LANG_PUSH(C)dnl AC_ARG_VAR([CC], [C compiler command])dnl AC_ARG_VAR([CFLAGS], [C compiler flags])dnl @@ -830,3 +842,4 @@ dnl with extended modes being tried first. ])# m4_version_prereq +])# !_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 @@ # stdalign.m4 -# serial 1 -dnl Copyright 2011-2024 Free Software Foundation, Inc. +# serial 3 +dnl Copyright 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for alignas and alignof that conform to C23. @@ -81,10 +82,10 @@ AC_DEFUN([gl_ALIGNASOF], References: ISO C23 (latest free draft - ) + ) sections 6.5.3.4, 6.7.5, 7.15. C++11 (latest free draft - ) + ) section 18.10. */ /* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment @@ -103,11 +104,13 @@ AC_DEFUN([gl_ALIGNASOF], /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 . - clang versions < 8.0.0 have the same bug. */ + clang versions < 8.0.0 have the same bug. + IBM XL C V16.1.0 cc (non-clang) has the same bug. */ # if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ && !defined __clang__) \ - || (defined __clang__ && __clang_major__ < 8)) + || (defined __clang__ && __clang_major__ < 8) \ + || defined __xlC__) # undef/**/_Alignof # ifdef __cplusplus # if (201103 <= __cplusplus || defined _MSC_VER) @@ -178,7 +181,8 @@ AC_DEFUN([gl_ALIGNASOF], # if ((defined _Alignas \ && !(defined __cplusplus \ && (201103 <= __cplusplus || defined _MSC_VER))) \ - || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__ \ + && !defined __xlC__)) # define alignas _Alignas # endif # 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 @@ +# stdckdint_h.m4 +# serial 1 +dnl Copyright 2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Collin Funk. + +AC_DEFUN_ONCE([gl_STDCKDINT_H], +[ + gl_CHECK_NEXT_HEADERS([stdckdint.h]) + if test $ac_cv_header_stdckdint_h = yes; then + HAVE_STDCKDINT_H=1 + else + HAVE_STDCKDINT_H=0 + fi + AC_SUBST([HAVE_STDCKDINT_H]) + + if test $HAVE_STDCKDINT_H = 1; then + AC_CACHE_CHECK([whether stdckdint.h can be included in C], + [gl_cv_header_c_stdckdint_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]])], + [gl_cv_header_c_stdckdint_h=yes], + [gl_cv_header_c_stdckdint_h=no])]) + if test $gl_cv_header_c_stdckdint_h = yes; then + HAVE_C_STDCKDINT_H=1 + AC_CACHE_CHECK([checking for an ISO C23 compliant stdckdint.h in C], + [gl_cv_header_c_stdckdint_h_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[int r; + int a = 1; + int b = 1; + return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) + || ckd_mul (&r, a, b)); + ]])], + [gl_cv_header_c_stdckdint_h_works=yes], + [gl_cv_header_c_stdckdint_h_works=no])]) + if test $gl_cv_header_c_stdckdint_h_works = yes; then + HAVE_WORKING_C_STDCKDINT_H=1 + else + HAVE_WORKING_C_STDCKDINT_H=0 + fi + else + HAVE_C_STDCKDINT_H=0 + HAVE_WORKING_C_STDCKDINT_H=0 + fi + if test "$CXX" != no; then + AC_CACHE_CHECK([whether stdckdint.h can be included in C++], + [gl_cv_header_cxx_stdckdint_h], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_header_cxx_stdckdint_h=yes + else + gl_cv_header_cxx_stdckdint_h=no + fi + rm -fr conftest* + ]) + if test $gl_cv_header_cxx_stdckdint_h = yes; then + HAVE_CXX_STDCKDINT_H=1 + AC_CACHE_CHECK([checking for an ISO C++26 compliant stdckdint.h in C++], + [gl_cv_header_cxx_stdckdint_h_works], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +int +main (void) +{ + int r; + int a = 1; + int b = 1; + return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) || ckd_mul (&r, a, b)); +} +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_header_cxx_stdckdint_h_works=yes + else + gl_cv_header_cxx_stdckdint_h_works=no + fi + rm -fr conftest* + ]) + if test $gl_cv_header_cxx_stdckdint_h_works = yes; then + HAVE_WORKING_CXX_STDCKDINT_H=1 + else + HAVE_WORKING_CXX_STDCKDINT_H=0 + fi + else + HAVE_CXX_STDCKDINT_H=0 + HAVE_WORKING_CXX_STDCKDINT_H=0 + fi + fi + else + HAVE_C_STDCKDINT_H=0 + HAVE_WORKING_C_STDCKDINT_H=0 + HAVE_CXX_STDCKDINT_H=0 + HAVE_WORKING_CXX_STDCKDINT_H=0 + fi + AC_SUBST([HAVE_C_STDCKDINT_H]) + AC_SUBST([HAVE_WORKING_C_STDCKDINT_H]) + AC_SUBST([HAVE_CXX_STDCKDINT_H]) + AC_SUBST([HAVE_WORKING_CXX_STDCKDINT_H]) + + if test "$CXX" != no; then + dnl We might need the header for C or C++. + if test $HAVE_C_STDCKDINT_H = 1 \ + && test $HAVE_WORKING_C_STDCKDINT_H = 1 \ + && test $HAVE_CXX_STDCKDINT_H = 1 \ + && test $HAVE_WORKING_CXX_STDCKDINT_H = 1; then + GL_GENERATE_STDCKDINT_H=false + else + GL_GENERATE_STDCKDINT_H=true + fi + else + dnl We don't care about C++ here. + if test $HAVE_C_STDCKDINT_H = 1 \ + && test $HAVE_WORKING_C_STDCKDINT_H = 1; then + GL_GENERATE_STDCKDINT_H=false + else + GL_GENERATE_STDCKDINT_H=true + fi + fi +]) 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 @@ # stddef_h.m4 -# serial 14 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +# serial 23 +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl A placeholder for , for platforms that have issues. AC_DEFUN_ONCE([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) dnl Persuade OpenBSD to declare max_align_t. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -52,11 +52,6 @@ AC_DEFUN_ONCE([gl_STDDEF_H], GL_GENERATE_STDDEF_H=true fi - if test $gt_cv_c_wchar_t = no; then - HAVE_WCHAR_T=0 - GL_GENERATE_STDDEF_H=true - fi - AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], [gl_cv_decl_null_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include @@ -69,21 +64,60 @@ AC_DEFUN_ONCE([gl_STDDEF_H], GL_GENERATE_STDDEF_H=true fi - AC_CACHE_CHECK([for unreachable], - [gl_cv_func_unreachable], + AC_CACHE_CHECK([for unreachable in C], + [gl_cv_c_func_unreachable], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[unreachable (); ]])], - [gl_cv_func_unreachable=yes], - [gl_cv_func_unreachable=no]) + [gl_cv_c_func_unreachable=yes], + [gl_cv_c_func_unreachable=no]) ]) - if test $gl_cv_func_unreachable = no; then + if test $gl_cv_c_func_unreachable = no; then + GL_GENERATE_STDDEF_H=true + HAVE_C_UNREACHABLE=0 + else + HAVE_C_UNREACHABLE=1 + fi + AC_SUBST([HAVE_C_UNREACHABLE]) + dnl Provide gl_unreachable() unconditionally. + GL_GENERATE_STDDEF_H=true + + dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114869 + AC_CACHE_CHECK([whether nullptr_t needs ], + [gl_cv_nullptr_t_needs_stddef], + [AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[nullptr_t x;]], + [gl_cv_nullptr_t_needs_stddef=no], + [gl_cv_nullptr_t_needs_stddef=yes])]) + if test "$gl_cv_nullptr_t_needs_stddef" = no; then + NULLPTR_T_NEEDS_STDDEF=0 GL_GENERATE_STDDEF_H=true fi + dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870 + dnl affects GCC 13.3 and 14.2. + AC_CACHE_CHECK([whether is idempotent], + [gl_cv_stddef_idempotent], + [AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [[ + #if \ + ((__GNUC__ == 13 && __GNUC_MINOR__ <= 3) \ + || (__GNUC__ == 14 && __GNUC_MINOR__ <= 2)) + #error "bug 114870 is present" + #endif + ]])], + [gl_cv_stddef_idempotent="guessing yes"], + [gl_cv_stddef_idempotent="guessing no"]) + ]) + case "$gl_cv_stddef_idempotent" in + *yes) ;; + *) STDDEF_NOT_IDEMPOTENT=1 + GL_GENERATE_STDDEF_H=true + ;; + esac + if $GL_GENERATE_STDDEF_H; then gl_NEXT_HEADERS([stddef.h]) fi @@ -114,7 +148,8 @@ AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], AC_DEFUN([gl_STDDEF_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. + NULLPTR_T_NEEDS_STDDEF=1; AC_SUBST([NULLPTR_T_NEEDS_STDDEF]) + STDDEF_NOT_IDEMPOTENT=0; AC_SUBST([STDDEF_NOT_IDEMPOTENT]) REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) - HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) ]) 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 @@ # stdint.m4 -# serial 63 -dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. +# serial 64 +dnl Copyright (C) 2001-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert and Bruno Haible. dnl Test whether is supported or must be substituted. @@ -157,7 +158,7 @@ uintmax_t j = UINTMAX_MAX; || defined __clang__) int k = _Generic (SIZE_MAX, size_t: 0); #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ - || (0x5110 <= __SUNPRO_C && !__STDC__)) + || (0x5110 <= __SUNPRO_C && !__STDC__) || 1939 <= _MSC_VER) extern size_t k; extern __typeof__ (SIZE_MAX) k; #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 @@ # stdint_h.m4 # serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert. 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 @@ # stdio_h.m4 -# serial 63 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 75 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_STDIO_H_EARLY], [ @@ -133,6 +134,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) @@ -153,12 +155,14 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_ZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) @@ -172,20 +176,29 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSZPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VZPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ZPRINTF]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) 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 @@ # stdlib_h.m4 -# serial 77 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 84 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_STDLIB_H], [ @@ -37,44 +38,51 @@ AC_DEFUN_ONCE([gl_STDLIB_H], dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4. dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5. AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_CACHE_CHECK([whether MB_CUR_MAX is correct], [gl_cv_macro_MB_CUR_MAX_good], - [ - dnl Initial guess, used when cross-compiling or when no suitable locale - dnl is present. -changequote(,)dnl - case "$host_os" in - # Guess no on Solaris. - solaris*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;; - esac -changequote([,])dnl - if test $LOCALE_FR_UTF8 != none; then - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include + ]], + [[return !!MB_CUR_MAX;]]) + ], + [dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. + # Guess no on Solaris and Haiku, yes otherwise. + AS_CASE([$host_os], + [solaris* | haiku*], + [gl_cv_macro_MB_CUR_MAX_good="guessing no"], + [gl_cv_macro_MB_CUR_MAX_good="guessing yes"]) + if test "$LOCALE_EN_UTF8" != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #include int main () { int result = 0; - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { if (MB_CUR_MAX < 4) result |= 1; } return result; }]])], - [gl_cv_macro_MB_CUR_MAX_good=yes], - [gl_cv_macro_MB_CUR_MAX_good=no], - [:]) - fi + [gl_cv_macro_MB_CUR_MAX_good=yes], + [gl_cv_macro_MB_CUR_MAX_good=no], + [:]) + fi + ], + [gl_cv_macro_MB_CUR_MAX_good="link failed - so no"]) ]) - case "$gl_cv_macro_MB_CUR_MAX_good" in - *yes) ;; - *) REPLACE_MB_CUR_MAX=1 ;; - esac + AS_CASE([$gl_cv_macro_MB_CUR_MAX_good], + [*yes], + [], + ["link failed - so no"], + [# 4 suffices as a workaround in Android NDK 16, + # the only known platform with the bug. + REPLACE_MB_CUR_MAX=4], + [REPLACE_MB_CUR_MAX="(-1)"]) AC_CHECK_DECLS_ONCE([ecvt]) if test $ac_cv_have_decl_ecvt = no; then @@ -110,6 +118,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ABORT_DEBUG]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU]) @@ -139,12 +148,12 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) - gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STACK_TRACE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) @@ -218,6 +227,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT]) + REPLACE_ABORT=0; AC_SUBST([REPLACE_ABORT]) REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) @@ -244,7 +254,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_RAND=0; AC_SUBST([REPLACE_RAND]) REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) - REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU]) REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX]) REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) @@ -259,4 +268,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) + CAN_PRINT_STACK_TRACE=0; AC_SUBST([CAN_PRINT_STACK_TRACE]) ]) diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4 deleted file mode 100644 index 63021733..00000000 --- a/gl/m4/strcase.m4 +++ /dev/null @@ -1,46 +0,0 @@ -# strcase.m4 -# serial 12 -dnl Copyright (C) 2002, 2005-2024 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_STRCASE], -[ - gl_FUNC_STRCASECMP - gl_FUNC_STRNCASECMP -]) - -AC_DEFUN([gl_FUNC_STRCASECMP], -[ - AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) - AC_CHECK_FUNCS([strcasecmp]) - if test $ac_cv_func_strcasecmp = no; then - HAVE_STRCASECMP=0 - fi -]) - -AC_DEFUN([gl_FUNC_STRNCASECMP], -[ - AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) - AC_CHECK_FUNCS([strncasecmp]) - if test $ac_cv_func_strncasecmp = yes; then - HAVE_STRNCASECMP=1 - else - HAVE_STRNCASECMP=0 - fi - AC_CHECK_DECLS([strncasecmp]) - if test $ac_cv_have_decl_strncasecmp = no; then - HAVE_DECL_STRNCASECMP=0 - fi -]) - -# Prerequisites of lib/strcasecmp.c. -AC_DEFUN([gl_PREREQ_STRCASECMP], [ - : -]) - -# Prerequisites of lib/strncasecmp.c. -AC_DEFUN([gl_PREREQ_STRNCASECMP], [ - : -]) 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 @@ +# strcasecmp.m4 +# serial 3 +dnl Copyright (C) 2002-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_STRCASECMP], +[ + AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) + AC_CHECK_FUNCS([strcasecmp]) + if test $ac_cv_func_strcasecmp = yes; then + gl_STRCASECMP_WORKS + case "$gl_cv_func_strcasecmp_works" in + *yes) ;; + *) REPLACE_STRCASECMP=1 ;; + esac + else + HAVE_STRCASECMP=0 + fi +]) + +AC_DEFUN([gl_STRCASECMP_WORKS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether strcasecmp works], + [gl_cv_func_strcasecmp_works], + [dnl Prepare a guess, used when cross-compiling or when specific locales + dnl are not available. + case "$host_os" in + solaris* | cygwin*) + gl_cv_func_strcasecmp_works="guessing no" ;; + *) + gl_cv_func_strcasecmp_works="guessing yes" ;; + esac + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL + || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL) + { + int c1 = (unsigned char) '\311'; + int c2 = (unsigned char) '\351'; + if (tolower (c1) == c2 && toupper (c2) == c1) + return strcasecmp ("Fej\311r", "Fej\351r") != 0; + } + return 2; +}]])], + [gl_cv_func_strcasecmp_works=yes], + [if test $? = 1; then + gl_cv_func_strcasecmp_works=no + fi + ], + [:]) + ]) +]) + +# Prerequisites of lib/strcasecmp.c. +AC_DEFUN([gl_PREREQ_STRCASECMP], [ + : +]) 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 @@ # strcasestr.m4 -# serial 28 -dnl Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc. +# serial 29 +dnl Copyright (C) 2005, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Check that strcasestr is present and works. AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], @@ -98,7 +99,7 @@ static void quit (int sig) { _exit (sig + 128); } char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also lack strcasestr. */ + since all such platforms (mingw, MSVC) also lack strcasestr. */ signal (SIGALRM, quit); alarm (5); /* 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 @@ # strerror.m4 # serial 25 -dnl Copyright (C) 2002, 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_STRERROR], [ 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 @@ # string_h.m4 -# serial 39 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 44.1 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Configure a GNU-like replacement for . @@ -23,8 +24,9 @@ AC_DEFUN_ONCE([gl_STRING_H], ]], [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit rawmemchr stpcpy stpncpy strchrnul - strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r - strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) + strdup strncat strncpy strndup strnlen strpbrk strsep strcasestr strtok_r + strerror_l strerror_r strerrorname_np + sigabbrev_np sigdescr_np strsignal strverscmp]) AC_REQUIRE([AC_C_RESTRICT]) ]) @@ -62,6 +64,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) @@ -69,6 +72,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_STARTSWITH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_ENDSWITH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) @@ -83,8 +88,11 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) @@ -123,6 +131,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) + HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L]) HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) @@ -138,6 +147,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) + REPLACE_STRNCPY=0; AC_SUBST([REPLACE_STRNCPY]) REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) @@ -145,6 +155,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) + REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L]) REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) 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 @@ # strings_h.m4 -# serial 9 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 14 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Configure a replacement for . @@ -28,7 +29,7 @@ AC_DEFUN_ONCE([gl_STRINGS_H], . */ #include #include - ]], [ffs strcasecmp strncasecmp]) + ]], [ffs strcasecmp strcasecmp_l strncasecmp strncasecmp_l]) ]) # gl_STRINGS_MODULE_INDICATOR([modulename]) @@ -49,6 +50,10 @@ AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP_L]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP_L]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) @@ -59,5 +64,12 @@ AC_DEFUN([gl_STRINGS_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FFS=1; AC_SUBST([HAVE_FFS]) HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) + HAVE_STRCASECMP_L=1; AC_SUBST([HAVE_STRCASECMP_L]) + HAVE_STRNCASECMP=1; AC_SUBST([HAVE_STRNCASECMP]) + HAVE_STRNCASECMP_L=1; AC_SUBST([HAVE_STRNCASECMP_L]) HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) + REPLACE_STRCASECMP=0; AC_SUBST([REPLACE_STRCASECMP]) + REPLACE_STRCASECMP_L=0; AC_SUBST([REPLACE_STRCASECMP_L]) + REPLACE_STRNCASECMP=0; AC_SUBST([REPLACE_STRNCASECMP]) + REPLACE_STRNCASECMP_L=0; AC_SUBST([REPLACE_STRNCASECMP_L]) ]) diff --git a/gl/m4/strncasecmp.m4 b/gl/m4/strncasecmp.m4 new file mode 100644 index 00000000..c7c8b240 --- /dev/null +++ b/gl/m4/strncasecmp.m4 @@ -0,0 +1,32 @@ +# strncasecmp.m4 +# serial 2 +dnl Copyright (C) 2002-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_STRNCASECMP], +[ + AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) + AC_CHECK_FUNCS([strncasecmp]) + if test $ac_cv_func_strncasecmp = yes; then + dnl Assume that strncasecmp and strcasecmp share the same bugs. + gl_STRCASECMP_WORKS + case "$gl_cv_func_strcasecmp_works" in + *yes) ;; + *) REPLACE_STRNCASECMP=1 ;; + esac + else + HAVE_STRNCASECMP=0 + fi + AC_CHECK_DECLS([strncasecmp]) + if test $ac_cv_have_decl_strncasecmp = no; then + HAVE_DECL_STRNCASECMP=0 + fi +]) + +# Prerequisites of lib/strncasecmp.c. +AC_DEFUN([gl_PREREQ_STRNCASECMP], [ + : +]) 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 @@ +# strncpy.m4 +# serial 1 +dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_FUNC_STRNCPY], +[ + AC_REQUIRE([gl_STRING_H_DEFAULTS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Check for prerequisites for memory fence checks. + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + + dnl Detect bug in FreeBSD 15.0 on x86_64: + dnl strncpy should not dereference more than n bytes, but always dereferences + dnl n+1 bytes if the first n bytes don't contain a NUL byte. + dnl Assume that strncpy works on platforms that lack mprotect. + AC_CACHE_CHECK([whether strncpy works], [gl_cv_func_strncpy_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +#if HAVE_SYS_MMAN_H +# include +# include +# include +# include +#endif +]GL_MDA_DEFINES], +[[ + char *fence = NULL; +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT + { + long int pagesize = sysconf (_SC_PAGESIZE); + char *two_pages = + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + if (two_pages != (char *)(-1) + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; + } +#endif + if (fence) + { + char dest[8]; + + dest[0] = 'a'; + dest[1] = 'b'; + dest[2] = 'c'; + dest[3] = 'd'; + dest[4] = 'e'; + dest[5] = 'f'; + dest[6] = 'g'; + + *(fence - 3) = '7'; + *(fence - 2) = '2'; + *(fence - 1) = '9'; + + if (strncpy (dest + 1, fence - 3, 3) != dest + 1) + return 1; + if (dest[0] != 'a') + return 2; + if (dest[1] != '7' || dest[2] != '2' || dest[3] != '9') + return 3; + if (dest[4] != 'e') + return 4; + } + return 0; +]])], [gl_cv_func_strncpy_works=yes], [gl_cv_func_strncpy_works=no], + [ + case "$host_os" in + # Guess no on FreeBSD. + freebsd* | dragonfly*) gl_cv_func_strncpy_works="guessing no" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_strncpy_works="guessing yes" ;; + # Guess yes otherwise. + *) gl_cv_func_strncpy_works="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_strncpy_works" in + *yes) ;; + *) REPLACE_STRNCPY=1 ;; + esac +]) + +# Prerequisites of lib/strncpy.c. +AC_DEFUN([gl_PREREQ_STRNCPY], [ + : +]) 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 @@ # strsep.m4 # serial 11 -dnl Copyright (C) 2002-2004, 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_STRSEP], [ 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 @@ # strstr.m4 -# serial 24 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +# serial 25 +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Check that strstr works. AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], @@ -95,7 +96,7 @@ static void quit (int sig) { _exit (sig + 128); } char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also have quadratic strstr. */ + since all such platforms (mingw, MSVC) also have quadratic strstr. */ signal (SIGALRM, quit); alarm (5); /* 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 @@ +# sys_cdefs_h.m4 - Is compatible enough with glibc? +# serial 2 +dnl Copyright 2024-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Paul Eggert. + +AC_DEFUN_ONCE([gl_CHECK_HEADER_SYS_CDEFS_H], + [AC_CACHE_CHECK([for glibc-compatible sys/cdefs.h], + [gl_cv_header_sys_cdefs_h], + [AC_COMPILE_IFELSE( + [AC_LANG_DEFINES_PROVIDED + [#include + enum { foo = __GNUC_PREREQ (14, 1) } bar; + ]], + [gl_cv_header_sys_cdefs_h=yes], + [gl_cv_header_sys_cdefs_h=no])]) + if test "$gl_cv_header_sys_cdefs_h" = yes; then + HAVE_SYS_CDEFS_H=1 + else + HAVE_SYS_CDEFS_H=0 + fi + 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 @@ # sys_socket_h.m4 -# serial 29 -dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. +# serial 31 +dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Simon Josefsson. @@ -52,24 +53,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H], fi # We need to check for ws2tcpip.h now. gl_PREREQ_SYS_H_SOCKET - AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ - /* sys/types.h is not needed according to POSIX, but the - sys/socket.h in i386-unknown-freebsd4.10 and - powerpc-apple-darwin5.5 required it. */ -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif -]) + gl_PREREQ_SYS_SA_FAMILY if test $ac_cv_type_struct_sockaddr_storage = no; then HAVE_STRUCT_SOCKADDR_STORAGE=0 fi - if test $ac_cv_type_sa_family_t = no; then - HAVE_SA_FAMILY_T=0 - fi if test $ac_cv_type_struct_sockaddr_storage != no; then AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], [], @@ -158,6 +145,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], AC_SUBST([HAVE_WS2TCPIP_H]) ]) +# Common prerequisites of the replacement and of the +# replacement. +# Sets and substitutes HAVE_SA_FAMILY_T. +AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY], +[ + AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) + AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ + /* sys/types.h is not needed according to POSIX, but the + sys/socket.h in i386-unknown-freebsd4.10 and + powerpc-apple-darwin5.5 required it. */ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +]) + if test $ac_cv_type_sa_family_t = yes; then + HAVE_SA_FAMILY_T=1 + else + HAVE_SA_FAMILY_T=0 + fi + AC_SUBST([HAVE_SA_FAMILY_T]) +]) + # gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. @@ -202,6 +215,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) - HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) ]) 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 @@ # sys_stat_h.m4 # serial 42 -*- Autoconf -*- -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Eric Blake. dnl Provide a GNU-like . 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 @@ # sys_types_h.m4 -# serial 13 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +# serial 15 +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_SYS_TYPES_H], [ @@ -23,6 +24,9 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], dnl Whether to override the 'off_t' type. AC_REQUIRE([gl_TYPE_OFF_T]) + dnl Whether to define the 'off64_t' type. + AC_REQUIRE([gl_TYPE_OFF64_T]) + dnl Whether to override the 'dev_t' and 'ino_t' types. m4_ifdef([gl_WINDOWS_STAT_INODES], [ AC_REQUIRE([gl_WINDOWS_STAT_INODES]) @@ -30,6 +34,14 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], WINDOWS_STAT_INODES=0 ]) AC_SUBST([WINDOWS_STAT_INODES]) + + dnl Test whether the 'blksize_t' type is defined. + AC_CHECK_TYPE([blksize_t], [HAVE_BLKSIZE_T=1], [HAVE_BLKSIZE_T=0]) + AC_SUBST([HAVE_BLKSIZE_T]) + + dnl Test whether the 'blkcnt_t' type is defined. + AC_CHECK_TYPE([blkcnt_t], [HAVE_BLKCNT_T=1], [HAVE_BLKCNT_T=0]) + AC_SUBST([HAVE_BLKCNT_T]) ]) # 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 @@ # sys_uio_h.m4 # serial 3 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_SYS_UIO_H], [ 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 @@ # threadlib.m4 -# serial 42 -dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. +# serial 45.1 +dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. @@ -56,24 +57,22 @@ AC_DEFUN([gl_ANYTHREADLIB_EARLY], [ AC_REQUIRE([AC_CANONICAL_HOST]) if test -z "$gl_anythreadlib_early_done"; then - case "$host_os" in - osf*) - # On OSF/1, the compiler needs the flag -D_REENTRANT so that it + AS_CASE([$host_os], + [osf*], + [# On OSF/1, the compiler needs the flag -D_REENTRANT so that it # groks . cc also understands the flag -pthread, but - # we don't use it because 1. gcc-2.95 doesn't understand -pthread, + # we do not use it because 1. gcc-2.95 does not understand -pthread, # 2. putting a flag into CPPFLAGS that has an effect on the linker # causes the AC_LINK_IFELSE test below to succeed unexpectedly, # leading to wrong values of LIBTHREAD and LTLIBTHREAD. CPPFLAGS="$CPPFLAGS -D_REENTRANT" - ;; - esac + ]) # Some systems optimize for single-threaded programs by default, and # need special flags to disable these optimizations. For example, the - # definition of 'errno' in . - case "$host_os" in - aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; - solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; - esac + # definition of errno in . + AS_CASE([$host_os], + [aix* | freebsd*], [CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"], + [hpux* | solaris*], [CPPFLAGS="$CPPFLAGS -D_REENTRANT"]) gl_anythreadlib_early_done=done fi ]) @@ -85,24 +84,26 @@ AC_DEFUN([gl_WEAK_SYMBOLS], AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether imported symbols can be declared weak], [gl_cv_have_weak], - [case "$host_os" in - cygwin* | mingw* | windows*) + [AS_CASE([$host_os], + [cygwin* | mingw* | windows*], + [ dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with dnl gcc 11.3, the test below would succeed, but programs that use dnl pthread_in_use() with weak symbol references crash miserably at dnl runtime. gl_cv_have_weak="guessing no" - ;; - *) + ], + [ gl_cv_have_weak=no dnl First, test whether the compiler accepts it syntactically. AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[extern void xyzzy (); -#pragma weak xyzzy]], +#pragma weak xyzzy + ]], [[xyzzy();]])], [gl_cv_have_weak=maybe]) - if test $gl_cv_have_weak = maybe; then + AS_IF([test $gl_cv_have_weak = maybe], [ dnl Second, test whether it actually works. On Cygwin 1.7.2, with dnl gcc 4.3, symbols declared weak always evaluate to the address 0. AC_RUN_IFELSE( @@ -125,20 +126,19 @@ int main () [gl_cv_have_weak="guessing yes"], [gl_cv_have_weak="guessing no"]) ]) - fi - ;; - esac - dnl But when linking statically, weak symbols don't work. - case " $LDFLAGS " in - *" -static "*) gl_cv_have_weak=no ;; - esac + ]) + ]) + dnl But when linking statically, weak symbols do not work. + AS_CASE([" $LDFLAGS "], + [*" -static "*], [gl_cv_have_weak=no]) dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak dnl symbol and linking against a shared library that has a dependency on dnl the shared library that defines the symbol. - case "$gl_cv_have_weak" in - *yes) - case "$host_os" in - freebsd* | dragonfly* | midnightbsd*) + AS_CASE([$gl_cv_have_weak], + [*yes], + [AS_CASE([$host_os], + [freebsd* | dragonfly* | midnightbsd*], + [ : > conftest1.c $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 cat < conftest2.c @@ -152,17 +152,15 @@ EOF $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest - ;; - esac - ;; - esac + ]) + ]) ]) - case "$gl_cv_have_weak" in - *yes) + AS_CASE([$gl_cv_have_weak], + [*yes], + [ AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [Define to 1 if the compiler and linker support weak declarations of symbols.]) - ;; - esac + ]) ]) dnl ============================================================================ @@ -188,15 +186,15 @@ dnl The guts of gl_PTHREADLIB. Needs to be expanded only once. AC_DEFUN([gl_PTHREADLIB_BODY], [ AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) - if test -z "$gl_pthreadlib_body_done"; then + AS_IF([test -z "$gl_pthreadlib_body_done"], [ gl_pthread_api=no LIBPTHREAD= LIBPMULTITHREAD= # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + # it groks . It is added above, in gl_ANYTHREADLIB_EARLY. AC_CHECK_HEADER([pthread.h], [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) - if test "$gl_have_pthread_h" = yes; then + AS_IF([test "$gl_have_pthread_h" = yes], [ # Other possible tests: # -lpthreads (FSU threads, PCthreads) # -lgthreads @@ -208,7 +206,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY], # needs -pthread for some reason. See: # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html saved_LIBS="$LIBS" - for gl_pthread in '' '-pthread'; do + for gl_pthread in "" "-pthread"; do LIBS="$LIBS $gl_pthread" AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -230,8 +228,9 @@ AC_DEFUN([gl_PTHREADLIB_BODY], gl_pthread_in_glibc=no # On Linux with glibc >= 2.34, libc contains the fully functional # pthread functions. - case "$host_os" in - linux*) + AS_CASE([$host_os], + [linux*], + [ AC_EGREP_CPP([Lucky user], [#include #ifdef __GNU_LIBRARY__ @@ -242,19 +241,18 @@ AC_DEFUN([gl_PTHREADLIB_BODY], ], [gl_pthread_in_glibc=yes], []) - ;; - esac + ]) echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD # Test for libpthread by looking for pthread_kill. (Not pthread_self, # since it is defined as a macro on OSF/1.) - if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + AS_IF([test $gl_pthread_api = yes && test -z "$LIBPTHREAD"], [ # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. AC_CHECK_LIB([pthread], [pthread_kill], - [if test $gl_pthread_in_glibc = yes; then + [AS_IF([test $gl_pthread_in_glibc = yes], [ LIBPMULTITHREAD= - else + ], [ LIBPMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a @@ -262,14 +260,13 @@ AC_DEFUN([gl_PTHREADLIB_BODY], # pthread_create will actually create a thread. # On Solaris 10 or newer, this test is no longer needed, because # libc contains the fully functional pthread functions. - case "$host_os" in -changequote(,)dnl - solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) -changequote([,])dnl - AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], - [Define if the pthread_in_use() detection is hard.]) - esac - fi + AS_CASE([$host_os], + [[solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*]], + [ + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + ]) + ]) ], [dnl This is needed on FreeBSD 5.2.1. AC_CHECK_LIB([thr], [pthread_kill], @@ -280,35 +277,36 @@ changequote([,])dnl fi ]) ]) - elif test $gl_pthread_api != yes; then + ], [test $gl_pthread_api != yes], [ # Some library is needed. Try libpthread and libc_r. AC_CHECK_LIB([pthread], [pthread_kill], [gl_pthread_api=yes LIBPTHREAD=-lpthread LIBPMULTITHREAD=-lpthread]) - if test $gl_pthread_api != yes; then + AS_IF([test $gl_pthread_api != yes], [ # For FreeBSD 4. AC_CHECK_LIB([c_r], [pthread_kill], [gl_pthread_api=yes LIBPTHREAD=-lc_r LIBPMULTITHREAD=-lc_r]) - fi - fi + ]) + ]) echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD - fi + ]) AC_MSG_CHECKING([whether POSIX threads API is available]) AC_MSG_RESULT([$gl_pthread_api]) AC_SUBST([LIBPTHREAD]) AC_SUBST([LIBPMULTITHREAD]) - if test $gl_pthread_api = yes; then + AS_IF([test $gl_pthread_api = yes], [ AC_DEFINE([HAVE_PTHREAD_API], [1], [Define if you have the header and the POSIX threads API.]) - fi + ]) dnl On some systems, sched_yield is in librt, rather than in libpthread. AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[#include ]], + [[#include + ]], [[sched_yield ();]])], [SCHED_YIELD_LIB= ], @@ -323,7 +321,7 @@ changequote([,])dnl AC_SUBST([LIB_SCHED_YIELD]) gl_pthreadlib_body_done=done - fi + ]) ]) AC_DEFUN([gl_PTHREADLIB], @@ -350,44 +348,45 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], [ AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) AC_REQUIRE([AC_CANONICAL_HOST]) - if test -z "$gl_stdthreadlib_body_done"; then + AS_IF([test -z "$gl_stdthreadlib_body_done"], [ AC_CHECK_HEADERS_ONCE([threads.h]) - case "$host_os" in - mingw* | windows*) + AS_CASE([$host_os], + [mingw* | windows*], + [ LIBSTDTHREAD= - ;; - *) + ], + [ gl_PTHREADLIB_BODY - if test $ac_cv_header_threads_h = yes; then + AS_IF([test $ac_cv_header_threads_h = yes], [ dnl glibc >= 2.29 has thrd_create in libpthread. dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends - dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). + dnl on libpthread (for the symbol pthread_mutexattr_gettype). dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in dnl libc. - gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include ]]) - if test $ac_cv_func_thrd_create = yes; then + gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include + ]]) + AS_IF([test $ac_cv_func_thrd_create = yes], [ LIBSTDTHREAD= - else + ], [ AC_CHECK_LIB([stdthreads], [thrd_create], [ - LIBSTDTHREAD='-lstdthreads -lpthread' + LIBSTDTHREAD="-lstdthreads -lpthread" ], [ dnl Guess that thrd_create is in libpthread. LIBSTDTHREAD="$LIBPMULTITHREAD" ]) - fi - else + ]) + ], [ dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" - fi - ;; - esac + ]) + ]) AC_SUBST([LIBSTDTHREAD]) AC_MSG_CHECKING([whether ISO C threads API is available]) AC_MSG_RESULT([$ac_cv_header_threads_h]) gl_stdthreadlib_body_done=done - fi + ]) ]) AC_DEFUN([gl_STDTHREADLIB], @@ -404,7 +403,7 @@ dnl ------------ dnl Tests for a multithreading library to be used. dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the -dnl default is 'no', otherwise it is system dependent. In both cases, the user +dnl default is "no", otherwise it is system dependent. In both cases, the user dnl can change the choice through the options --enable-threads=choice or dnl --disable-threads. dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, @@ -449,7 +448,7 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY], m4_ifdef([gl_THREADLIB_DEFAULT_NO], [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) - dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like + dnl gl_use_winpthreads_default defaults to "no", because in mingw 10, like dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash. m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no]) AC_ARG_ENABLE([threads], @@ -459,41 +458,35 @@ AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]), [if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" else -changequote(,)dnl - case "$host_os" in + AS_CASE([$host_os], dnl Disable multithreading by default on OSF/1, because it interferes dnl with fork()/exec(): When msgexec is linked with -lpthread, its dnl child process gets an endless segmentation fault inside execvp(). - osf*) gl_use_threads=no ;; + [osf*], [gl_use_threads=no], dnl Disable multithreading by default on Cygwin 1.5.x, because it has dnl bugs that lead to endless loops or crashes. See dnl . - cygwin*) - case `uname -r` in - 1.[0-5].*) gl_use_threads=no ;; - *) gl_use_threads=yes ;; - esac - ;; + [cygwin*], + [AS_CASE([$(uname -r)], + [[1.[0-5].*]], [gl_use_threads=no], + [gl_use_threads=yes]) + ], dnl Obey gl_AVOID_WINPTHREAD on mingw. - mingw* | windows*) - case "$gl_use_winpthreads_default" in - yes) gl_use_threads=posix ;; - no) gl_use_threads=windows ;; - *) gl_use_threads=yes ;; - esac - ;; - *) gl_use_threads=yes ;; - esac -changequote([,])dnl + [mingw* | windows*], + [AS_CASE([$gl_use_winpthreads_default], + [yes], [gl_use_threads=posix], + [no], [gl_use_threads=windows], + [gl_use_threads=yes]) + ], + [gl_use_threads=yes]) fi ]) - if test "$gl_use_threads" = yes \ - || test "$gl_use_threads" = isoc \ - || test "$gl_use_threads" = posix \ - || test "$gl_use_threads" = isoc+posix; then - # For using or : - gl_ANYTHREADLIB_EARLY - fi + AS_CASE([$gl_use_threads], + [yes | isoc | posix | isoc+posix], + [ + # For using or : + gl_ANYTHREADLIB_EARLY + ]) ]) dnl The guts of gl_THREADLIB. Needs to be expanded only once. @@ -506,90 +499,95 @@ AC_DEFUN([gl_THREADLIB_BODY], LTLIBTHREAD= LIBMULTITHREAD= LTLIBMULTITHREAD= - if test "$gl_use_threads" != no; then + AS_IF([test "$gl_use_threads" = no], + [AC_DEFINE([AVOID_ANY_THREADS], [1], + [Define if no multithread safety and no multithreading is desired.])], + [ dnl Check whether the compiler and linker support weak declarations. gl_WEAK_SYMBOLS - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - dnl If we use weak symbols to implement pthread_in_use / pth_in_use / - dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create - dnl facility is in use. - AC_CHECK_HEADERS_ONCE([threads.h]) - : - fi - if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then - AC_CHECK_HEADERS_ONCE([threads.h]) - gl_have_isoc_threads="$ac_cv_header_threads_h" - fi - if test "$gl_use_threads" = yes \ - || test "$gl_use_threads" = posix \ - || test "$gl_use_threads" = isoc+posix; then - gl_PTHREADLIB_BODY - LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD - LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD - if test $gl_pthread_api = yes; then - if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then - gl_threads_api='isoc+posix' - AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], - [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) - LIBTHREAD= LTLIBTHREAD= - else - gl_threads_api=posix - AC_DEFINE([USE_POSIX_THREADS], [1], - [Define if the POSIX multithreading library can be used.]) - if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then - AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], - [Define if references to the POSIX multithreading library are satisfied by libc.]) - else - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], - [Define if references to the POSIX multithreading library should be made weak.]) - LIBTHREAD= LTLIBTHREAD= - else - case "$host_os" in - freebsd* | dragonfly* | midnightbsd*) - if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then - dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() - dnl etc. will succeed, we need a runtime test. - AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], - [Define if the pthread_in_use() detection is hard.]) - fi - ;; - esac - fi - fi - fi - fi - fi - if test $gl_threads_api = none; then - if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + AS_CASE([$gl_cv_have_weak], + [*yes], + [ + dnl If we use weak symbols to implement pthread_in_use / pth_in_use / + dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create + dnl facility is in use. + AC_CHECK_HEADERS_ONCE([threads.h]) + : + ]) + AS_CASE([$gl_use_threads], + [isoc | isoc+posix], + [ + AC_CHECK_HEADERS_ONCE([threads.h]) + gl_have_isoc_threads="$ac_cv_header_threads_h" + ]) + AS_CASE([$gl_use_threads], + [yes | posix | isoc+posix], + [ + gl_PTHREADLIB_BODY + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + AS_IF([test $gl_pthread_api = yes], [ + AS_IF([test "$gl_use_threads" = isoc+posix && + test "$gl_have_isoc_threads" = yes], [ + gl_threads_api="isoc+posix" + AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], + [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) + LIBTHREAD= LTLIBTHREAD= + ], [ + gl_threads_api=posix + AC_DEFINE([USE_POSIX_THREADS], [1], + [Define if the POSIX multithreading library can be used.]) + AS_IF([test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"], [ + AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], + [Define if references to the POSIX multithreading library are satisfied by libc.]) + ], [ + AS_CASE([$gl_cv_have_weak], + [*yes], + [ + AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], + [Define if references to the POSIX multithreading library should be made weak.]) + LIBTHREAD= LTLIBTHREAD= + ], + [AS_CASE([$host_os], + [freebsd* | dragonfly* | midnightbsd*], + [ + AS_IF([test "x$LIBTHREAD" != "x$LIBMULTITHREAD"], [ + dnl If weak symbols cannot tell whether + dnl pthread_create(), dnl pthread_key_create() + dnl etc. will succeed, we need a runtime test. + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + ]) + ]) + ]) + ]) + ]) + ]) + ]) + AS_IF([test $gl_threads_api = none], [ + AS_IF([test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes], [ gl_STDTHREADLIB_BODY LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD gl_threads_api=isoc AC_DEFINE([USE_ISOC_THREADS], [1], [Define if the ISO C multithreading library can be used.]) - fi - fi - if test $gl_threads_api = none; then - case "$gl_use_threads" in - yes | windows | win32) # The 'win32' is for backward compatibility. - if { case "$host_os" in - mingw* | windows*) true;; - *) false;; - esac - }; then - gl_threads_api=windows - AC_DEFINE([USE_WINDOWS_THREADS], [1], - [Define if the native Windows multithreading API can be used.]) - fi - ;; - esac - fi - else - dnl "$gl_use_threads" is "no". - AC_DEFINE([AVOID_ANY_THREADS], [1], - [Define if no multithread safety and no multithreading is desired.]) - fi + ]) + ]) + AS_IF([test $gl_threads_api = none], [ + # The "win32" is for backward compatibility. + AS_CASE([$gl_use_threads], + [yes | windows | win32], + [AS_CASE([$host_os], + [mingw* | windows*], + [ + gl_threads_api=windows + AC_DEFINE([USE_WINDOWS_THREADS], [1], + [Define if the native Windows multithreading API can be used.]) + ]) + ]) + ]) + ]) AC_MSG_CHECKING([for multithread API to use]) AC_MSG_RESULT([$gl_threads_api]) AC_SUBST([LIBTHREAD]) @@ -609,7 +607,7 @@ dnl gl_DISABLE_THREADS dnl ------------------ dnl Sets the gl_THREADLIB default so that threads are not used by default. dnl The user can still override it at installation time, by using the -dnl configure option '--enable-threads'. +dnl configure option "--enable-threads". AC_DEFUN([gl_DISABLE_THREADS], [ m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) @@ -621,7 +619,7 @@ dnl ------------------- dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. dnl The user can still override it at installation time, by using the -dnl configure option '--enable-threads=posix'. +dnl configure option "--enable-threads=posix". dnl As of 2023, this is now the default. AC_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 @@ # time_h.m4 -# serial 25 -dnl Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc. +# serial 27 +dnl Copyright (C) 2000-2001, 2003-2007, 2009-2025 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Configure a more-standard replacement for . @@ -145,6 +147,7 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) @@ -162,13 +165,16 @@ AC_DEFUN([gl_TIME_H_DEFAULTS], HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) - dnl Even GNU libc does not have timezone_t yet. + dnl Even GNU libc does not have timezone_t and tzalloc() yet. HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) + HAVE_TZALLOC=0; AC_SUBST([HAVE_TZALLOC]) REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME]) REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R]) + REPLACE_LOCALTIME_RZ=0; AC_SUBST([REPLACE_LOCALTIME_RZ]) REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) + REPLACE_MKTIME_Z=0; AC_SUBST([REPLACE_MKTIME_Z]) REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) 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 @@ # time_r.m4 # serial 1 -dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Reentrant time functions: localtime_r, gmtime_r. 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 @@ # timegm.m4 # serial 16 -dnl Copyright (C) 2003, 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_TIMEGM], [ 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 @@ +# uchar_h.m4 +# serial 32 +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. +dnl Prepare the overridden . + +AC_DEFUN_ONCE([gl_UCHAR_H], +[ + AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) + + gl_CHECK_NEXT_HEADERS([uchar.h]) + if test $ac_cv_header_uchar_h = yes; then + HAVE_UCHAR_H=1 + else + HAVE_UCHAR_H=0 + fi + AC_SUBST([HAVE_UCHAR_H]) + + dnl On macOS 15, in C mode, does not exist. But in C++ mode, + dnl it exists, and we need to #include_next it, otherwise we get an error + dnl " tried including but didn't find libc++'s + dnl header." + m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) + CXX_HAVE_UCHAR_H=0 + if test "$CXX" != no; then + AC_CACHE_CHECK([whether the C++ compiler has ], + [gl_cv_cxx_have_uchar_h], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_cxx_have_uchar_h=yes + else + gl_cv_cxx_have_uchar_h=no + fi + rm -fr conftest* + ]) + if test $gl_cv_cxx_have_uchar_h = yes; then + CXX_HAVE_UCHAR_H=1 + fi + fi + AC_SUBST([CXX_HAVE_UCHAR_H]) + + gl_TYPE_CHAR8_T + gl_TYPE_CHAR16_T + gl_TYPE_CHAR32_T + + dnl In C++ mode, clang defines 'char16_t' and 'char32_t' as built-in types + dnl on some platforms (e.g. OpenBSD 6.7), and as types defined by many + dnl header files (, , , , + dnl and others) on some platforms (e.g. Mac OS X 10.13). + dnl The same thing may also happen for 'char8_t'; so, be prepared for it. + m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) + CXX_HAS_UCHAR_TYPES=0 + if test $HAVE_UCHAR_H = 0; then + if test "$CXX" != no; then + AC_CACHE_CHECK([whether the C++ compiler predefines the types], + [gl_cv_cxx_has_uchar_types], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +char16_t a; +char32_t b; +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_cxx_has_uchar_types=yes + else + gl_cv_cxx_has_uchar_types=no + fi + rm -fr conftest* + ]) + if test $gl_cv_cxx_has_uchar_types = yes; then + CXX_HAS_UCHAR_TYPES=1 + fi + fi + fi + AC_SUBST([CXX_HAS_UCHAR_TYPES]) + CXX_HAS_CHAR8_TYPE=0 + if test $HAVE_UCHAR_H = 0; then + if test "$CXX" != no; then + AC_CACHE_CHECK([whether the C++ compiler predefines the char8_t type], + [gl_cv_cxx_has_char8_type], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +char8_t a; +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_cxx_has_char8_type=yes + else + gl_cv_cxx_has_char8_type=no + fi + rm -fr conftest* + ]) + if test $gl_cv_cxx_has_char8_type = yes; then + CXX_HAS_CHAR8_TYPE=1 + fi + fi + fi + AC_SUBST([CXX_HAS_CHAR8_TYPE]) + + dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'. + gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES]) + if test $BITSIZEOF_WCHAR_T -lt 32; then + SMALL_WCHAR_T=1 + else + SMALL_WCHAR_T=0 + fi + dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native Windows. + AC_SUBST([SMALL_WCHAR_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C11. + gl_WARN_ON_USE_PREPARE([[ + #ifdef __HAIKU__ + #include + #endif + #include + ]], [c32rtomb mbrtoc16 mbrtoc32]) +]) + +AC_DEFUN_ONCE([gl_TYPE_CHAR8_T], +[ + dnl Determine whether gnulib's would, if present, override char8_t. + AC_CACHE_CHECK([whether char8_t is correctly defined], + [gl_cv_type_char8_t_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif + #include + int verify[(char8_t)(-1) >= 0 && sizeof (char8_t) == sizeof (unsigned char) ? 1 : -1]; + ]]) + ], + [gl_cv_type_char8_t_works=yes], + [gl_cv_type_char8_t_works=no]) + ]) + if test $gl_cv_type_char8_t_works = no; then + GNULIBHEADERS_OVERRIDE_CHAR8_T=1 + else + GNULIBHEADERS_OVERRIDE_CHAR8_T=0 + fi + AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR8_T]) +]) + +dnl On Haiku 2020, char16_t and char32_t are incorrectly defined. +dnl See . +AC_DEFUN_ONCE([gl_TYPE_CHAR16_T], +[ + dnl Determine whether gnulib's would, if present, override char16_t. + AC_CACHE_CHECK([whether char16_t is correctly defined], + [gl_cv_type_char16_t_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif + #include + /* For simplicity, assume that uint16_least_t is equivalent to + 'unsigned short'. */ + int verify[(char16_t)(-1) >= 0 && sizeof (char16_t) == sizeof (unsigned short) ? 1 : -1]; + ]]) + ], + [gl_cv_type_char16_t_works=yes], + [gl_cv_type_char16_t_works=no]) + ]) + if test $gl_cv_type_char16_t_works = no; then + GNULIBHEADERS_OVERRIDE_CHAR16_T=1 + else + GNULIBHEADERS_OVERRIDE_CHAR16_T=0 + fi + AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR16_T]) +]) +AC_DEFUN_ONCE([gl_TYPE_CHAR32_T], +[ + dnl Determine whether gnulib's would, if present, override char32_t. + AC_CACHE_CHECK([whether char32_t is correctly defined], + [gl_cv_type_char32_t_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif + #include + /* For simplicity, assume that uint32_least_t is equivalent to + 'unsigned int'. */ + int verify[(char32_t)(-1) >= 0 && sizeof (char32_t) == sizeof (unsigned int) ? 1 : -1]; + ]]) + ], + [gl_cv_type_char32_t_works=yes], + [gl_cv_type_char32_t_works=no]) + ]) + if test $gl_cv_type_char32_t_works = no; then + GNULIBHEADERS_OVERRIDE_CHAR32_T=1 + else + GNULIBHEADERS_OVERRIDE_CHAR32_T=0 + fi + AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR32_T]) +]) + +# gl_UCHAR_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UCHAR_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UCHAR_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UCHAR_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOC32]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALNUM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALPHA]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISBLANK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISCNTRL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISDIGIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISGRAPH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISLOWER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPRINT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPUNCT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISSPACE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISUPPER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISXDIGIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOLOWER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOUPPER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32WIDTH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32RTOMB]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SNRTOMBS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SRTOMBS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32STOMBS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SWIDTH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOB]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_MAPPING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_TYPE_TEST]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_MAPPING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_TYPE_TEST]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC16]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC32]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOC32S]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOC32S]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOC32S]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UCHAR_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_C32RTOMB=1; AC_SUBST([HAVE_C32RTOMB]) + HAVE_MBRTOC16=1; AC_SUBST([HAVE_MBRTOC16]) + HAVE_MBRTOC32=1; AC_SUBST([HAVE_MBRTOC32]) + REPLACE_C32RTOMB=0; AC_SUBST([REPLACE_C32RTOMB]) + REPLACE_MBRTOC16=0; AC_SUBST([REPLACE_MBRTOC16]) + REPLACE_MBRTOC32=0; AC_SUBST([REPLACE_MBRTOC32]) +]) 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 @@ # ungetc.m4 # serial 12 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], [ 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 @@ +# unicase_h.m4 +# serial 1 +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_UNICASE_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_UNICASE_H_DEFAULTS]) +]) + +# gl_UNICASE_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UNICASE_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UNICASE_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNICASE_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNICASE_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UNICASE_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. +]) 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 @@ +# unictype_h.m4 +# serial 4 +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_UNICTYPE_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS]) +]) + +# gl_UNICTYPE_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UNICTYPE_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UNICTYPE_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNICTYPE_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UNICTYPE_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. +]) 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 @@ +# uninorm_h.m4 +# serial 1 +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_UNINORM_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_UNINORM_H_DEFAULTS]) +]) + +# gl_UNINORM_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UNINORM_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UNINORM_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNINORM_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNINORM_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UNINORM_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. +]) 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 @@ # unistd_h.m4 -# serial 95 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +# serial 97 +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Simon Josefsson, Bruno Haible. @@ -243,11 +244,13 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) + REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN]) REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU]) + REPLACE_GETUSERSHELL=0; AC_SUBST([REPLACE_GETUSERSHELL]) REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) 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 @@ +# unitypes_h.m4 +# serial 1 +dnl Copyright (C) 2021-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_UNITYPES_H], +[ + AH_VERBATIM([unitypes_restrict], [ +/* This definition is a duplicate of the one in unitypes.h. + It is here so that we can cope with an older version of unitypes.h + that does not contain this definition and that is pre-installed among + the public header files. */ +# if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 +# define _UC_RESTRICT __restrict +# elif 199901L <= __STDC_VERSION__ || defined restrict +# define _UC_RESTRICT restrict +# else +# define _UC_RESTRICT +# endif +]) +]) 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 @@ # unlocked-io.m4 # serial 16 -dnl Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1998-2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Jim Meyering. dnl 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 @@ # vararrays.m4 # serial 6 -dnl Copyright (C) 2001, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2001, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for variable-length arrays. 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 @@ # vasnprintf.m4 -# serial 52 -dnl Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc. +# serial 56 +dnl Copyright (C) 2002-2004, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_VASNPRINTF], [ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([vasnprintf]) - if test $ac_cv_func_vasnprintf = no; then + if test $ac_cv_func_vasnprintf = yes; then + dnl On Cygwin, in directives with a huge width, the width is ignored, and + dnl the function returns a wrong result. + AC_CACHE_CHECK([whether vasnprintf works], + [gl_cv_func_vasnprintf_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include + ]], + [[size_t len; + char *res = vasnprintf (NULL, &len, "x%03000000000dy\n", -17); + /* On Cygwin 3.4.6, res is "x-17y\n" and len == 6: wrong. */ + return (res != NULL && len < 10); + ]]) + ], + [gl_cv_func_vasnprintf_works=yes], + [gl_cv_func_vasnprintf_works=no], + [case "$host_os" in + # Guess no on Cygwin. + cygwin*) gl_cv_func_vasnprintf_works="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_vasnprintf_works="$gl_cross_guess_normal";; + esac + ]) + ]) + fi + if test $ac_cv_func_vasnprintf != yes \ + || case "$gl_cv_func_vasnprintf_works" in + *yes) false;; + *) true;; + esac + then gl_REPLACE_VASNPRINTF fi ]) @@ -42,7 +75,6 @@ AC_DEFUN([gl_FUNC_VASNWPRINTF], # Prerequisites of lib/printf-args.h, lib/printf-args.c. AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ - AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) ]) @@ -51,7 +83,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ AC_REQUIRE([gl_FEATURES_H]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([AC_TYPE_SIZE_T]) AC_CHECK_TYPE([ptrdiff_t], , @@ -185,7 +216,6 @@ int main() AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_CHECK_FUNCS([wcslen]) dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization @@ -327,15 +357,39 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC], # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], [ + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) + AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_INT_PRECISION]) + AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_MULTIBYTE]) + case "$host_os" in + mingw* | windows*) + dnl MSVC does not support the ' flag at all. + dnl mingw does not support it, unless __USE_MINGW_ANSI_STDIO is defined. + dnl mingw also has other bugs regarding the ' flag. AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], [Define if the vasnprintf implementation needs special code for the ' flag.]) ;; + *) + case "$gl_cv_func_printf_flag_grouping,$gl_cv_func_printf_flag_grouping_multibyte" in + *yes,*yes) + case "$gl_cv_func_printf_flag_grouping_int_precision" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_GROUPING_INT], [1], + [Define if the vasnprintf implementation needs special code for the + ' flag, for integer directives only.]) + ;; + esac + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], + [Define if the vasnprintf implementation needs special code for the + ' flag.]) + ;; + esac + ;; esac ]) 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 @@ # vasprintf.m4 # serial 6 -dnl Copyright (C) 2002-2003, 2006-2007, 2009-2024 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2006-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_VASPRINTF], [ 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 @@ # visibility.m4 # serial 9 -dnl Copyright (C) 2005, 2008, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. 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 @@ # vsnprintf.m4 # serial 7 -dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, dnl 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 @@ # warn-on-use.m4 # serial 11 -dnl Copyright (C) 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) # --------------------------------------- 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 @@ # wchar_h.m4 -# serial 64 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 65 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl A placeholder for ISO C99 , for platforms that have issues. @@ -256,6 +257,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP]) + REPLACE_WCSNCAT=0; AC_SUBST([REPLACE_WCSNCAT]) REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP]) REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR]) 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 @@ -# wchar_t.m4 -# serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 2008-2024 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. -dnl Test whether has the 'wchar_t' type. -dnl Prerequisite: AC_PROG_CC - -AC_DEFUN([gt_TYPE_WCHAR_T], -[ - AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - wchar_t foo = (wchar_t)'\0';]], - [[]])], - [gt_cv_c_wchar_t=yes], - [gt_cv_c_wchar_t=no])]) - if test $gt_cv_c_wchar_t = yes; then - AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) - fi -]) 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 @@ # wcrtomb.m4 -# serial 19 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +# serial 21 +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_WCRTOMB], [ @@ -36,7 +37,7 @@ AC_DEFUN([gl_FUNC_WCRTOMB], dnl sometimes returns 0 instead of 1. AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles @@ -90,7 +91,7 @@ changequote(,)dnl gl_cv_func_wcrtomb_retval="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then + if test $LOCALE_FR != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -106,8 +107,8 @@ int main () if (wcrtomb (NULL, 0, NULL) != 1) result |= 1; } - if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 - && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) 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 @@ # wctype.m4 # serial 6 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_WCTYPE], [ 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 @@ dnl A placeholder for ISO C99 , for platforms that lack it. -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Paul Eggert. 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 @@ +# wcwidth.m4 +# serial 38 +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_WCWIDTH], +[ + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade glibc to declare wcwidth(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gt_TYPE_WINT_T]) + + AC_CHECK_HEADERS_ONCE([wchar.h]) + AC_CHECK_FUNCS_ONCE([wcwidth]) + + AC_CHECK_DECLS([wcwidth], [], [], [[ + #include + ]]) + if test $ac_cv_have_decl_wcwidth != yes; then + HAVE_DECL_WCWIDTH=0 + fi + + if test $ac_cv_func_wcwidth != yes; then + AC_CACHE_CHECK([whether wcwidth is a macro], + [gl_cv_func_wcwidth_macro], + [AC_EGREP_CPP([wchar_header_defines_wcwidth], [ +#include +#ifdef wcwidth + wchar_header_defines_wcwidth +#endif], + [gl_cv_func_wcwidth_macro=yes], + [gl_cv_func_wcwidth_macro=no]) + ]) + fi + + if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then + HAVE_WCWIDTH=1 + dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. + dnl On macOS 12.5, NetBSD 9.3, OpenBSD 5.0, MidnightBSD 1.1, + dnl wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1. + dnl On macOS 12.5, NetBSD 9.3, MidnightBSD 1.1, OSF/1 5.1, + dnl wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. + dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0. + dnl This leads to bugs in 'ls' (coreutils). + dnl On Solaris 11.4, wcwidth(0x2202) (PARTIAL DIFFERENTIAL) returns 2, + dnl even in Western locales. + AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales], + [gl_cv_func_wcwidth_works], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#if !HAVE_DECL_WCWIDTH +extern +# ifdef __cplusplus +"C" +# endif +int wcwidth (int); +#endif +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "en_US.UTF-8") != NULL) + { + if (wcwidth (0x0301) > 0) + result |= 1; + if (wcwidth (0x05B0) > 0) + result |= 2; + if (wcwidth (0x200B) > 0) + result |= 4; + if (wcwidth (0xFF1A) == 0) + result |= 8; + if (wcwidth (0x2202) > 1) + result |= 16; + } + return result; +}]])], + [gl_cv_func_wcwidth_works=yes], + [gl_cv_func_wcwidth_works=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_wcwidth_works="guessing yes";; + # Guess yes on AIX 7 systems. + aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; + *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";; + esac +changequote([,])dnl + ]) + ]) + case "$gl_cv_func_wcwidth_works" in + *yes) ;; + *no) REPLACE_WCWIDTH=1 ;; + esac + else + HAVE_WCWIDTH=0 + fi + dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not + dnl have the wcwidth function, then it does not declare it. +]) + +# Prerequisites of lib/wcwidth.c. +AC_DEFUN([gl_PREREQ_WCWIDTH], [ + AC_REQUIRE([AC_C_INLINE]) + : +]) 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 @@ # wint_t.m4 # serial 11 -dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. dnl Test whether 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 @@ # xalloc.m4 # serial 18 -dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_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 @@ # xsize.m4 # serial 5 -dnl Copyright (C) 2003-2004, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2004, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_XSIZE], [ 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 @@ # zzgnulib.m4 # serial 1 -dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl This file must be named something that sorts after all other dnl 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 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997-1998, 2006-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -17,28 +17,33 @@ /* written by Jim Meyering and Bruno Haible */ +/* Ensure that we call the system's malloc() below. */ #define _GL_USE_STDLIB_ALLOC 1 #include #include #include - -#include "xalloc-oversized.h" +#include /* Allocate an N-byte block of memory from the heap, even if N is 0. */ void * rpl_malloc (size_t n) { +#if !HAVE_MALLOC_0_NONNULL if (n == 0) n = 1; +#endif - if (xalloc_oversized (n, 1)) +#if !HAVE_MALLOC_PTRDIFF + ptrdiff_t signed_n; + if (ckd_add (&signed_n, n, 0)) { errno = ENOMEM; return NULL; } +#endif void *result = malloc (n); 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 @@ /* Type-safe arrays which grow dynamically. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Type-safe arrays which grow dynamically. Shared definitions. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Report an dynamic array index out of bounds condition. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Increase the size of a dynamic array in preparation of an emplace operation. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Copy the dynamically-allocated area to an explicitly-sized heap allocation. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Increase the size of a dynamic array. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Increase the size of a dynamic array and clear the new part. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* Safe automatic memory allocation. - Copyright (C) 2003, 2006-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2003, 2018. This file is free software: you can redistribute it and/or modify @@ -93,7 +93,7 @@ mmalloca (size_t n) /* Out of memory. */ return NULL; #else -# if !MALLOC_0_IS_NONNULL +# if !HAVE_MALLOC_0_NONNULL if (n == 0) n = 1; # endif @@ -118,7 +118,7 @@ freea (void *p) char *cp = p; small_t *sp = p; # if defined __CHERI_PURE_CAPABILITY__ - void *mem = sp[-1]; + void *mem = (void *) sp[-1]; # else void *mem = cp - sp[-1]; # 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 @@ /* Safe automatic memory allocation. - Copyright (C) 2003-2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2003. 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 @@ /* Inline functions for . - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#define _GL_MATH_INLINE _GL_EXTERN_INLINE #include -#define _GL_MATH_INLINE _GL_EXTERN_INLINE #include typedef 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 @@ /* A GNU-like . - Copyright (C) 2002-2003, 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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; #endif +/* Ensure that INFINITY is a constant expression, of type 'float'. */ +#if !defined INFINITY || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX || defined __MINGW32__ +# undef INFINITY +# if defined __GNUC__ || defined __clang__ +# define INFINITY (__builtin_inff ()) +# else +# define INFINITY (1.0f / 0.0f) +# endif +#endif + /* POSIX allows platforms that don't support NAN. But all major machines in the past 15 years have supported something close to IEEE NaN, so we define this unconditionally. We also must define it on platforms like Solaris 10, where NAN is present but defined - as a function pointer rather than a floating point constant. */ -#if !defined NAN || @REPLACE_NAN@ + as a function pointer rather than a floating point constant. + Also ensure that it is a constant expression, of type 'float'. */ +#if !defined NAN || @REPLACE_NAN@ || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX || defined __MINGW32__ # if !GNULIB_defined_NAN # undef NAN /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler @@ -178,6 +189,8 @@ _NaN () return zero / zero; } # define NAN (_NaN()) +# elif defined __GNUC__ || defined __clang__ +# define NAN (__builtin_nanf ("")) # else # define NAN (0.0f / 0.0f) # endif @@ -197,46 +210,46 @@ _NaN () #endif /* HUGE_VALF is a 'float' Infinity. */ -#ifndef HUGE_VALF +#if !defined HUGE_VALF || (defined __FreeBSD__ && __FreeBSD__ < 6) +# undef HUGE_VALF # if defined _MSC_VER /* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f. */ # define HUGE_VALF (1e25f * 1e25f) +# elif defined __GNUC__ || defined __clang__ +# define HUGE_VALF (__builtin_inff ()) # else # define HUGE_VALF (1.0f / 0.0f) # endif #endif /* HUGE_VAL is a 'double' Infinity. */ -#ifndef HUGE_VAL +#if !defined HUGE_VAL || (defined __FreeBSD__ && __FreeBSD__ < 6) || defined _AIX +# undef HUGE_VAL # if defined _MSC_VER /* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0. */ # define HUGE_VAL (1e250 * 1e250) +# elif defined __GNUC__ || defined __clang__ +# define HUGE_VAL (__builtin_inf ()) # else # define HUGE_VAL (1.0 / 0.0) # endif #endif /* HUGE_VALL is a 'long double' Infinity. */ -#ifndef HUGE_VALL +#if !defined HUGE_VALL || (defined __FreeBSD__ && __FreeBSD__ < 6) || defined _AIX +# undef HUGE_VALL # if defined _MSC_VER /* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L. */ # define HUGE_VALL (1e250L * 1e250L) +# elif defined __GNUC__ || defined __clang__ +# define HUGE_VALL (__builtin_infl ()) # else # define HUGE_VALL (1.0L / 0.0L) # endif #endif -#if defined FP_ILOGB0 && defined FP_ILOGBNAN - /* Ensure FP_ILOGB0 and FP_ILOGBNAN are correct. */ -# if defined __HAIKU__ - /* Haiku: match what ilogb() does */ -# undef FP_ILOGB0 -# undef FP_ILOGBNAN -# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */ -# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */ -# endif -#else +#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN) /* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */ # if defined __NetBSD__ || defined __sgi /* NetBSD, IRIX 6.5: match what ilogb() does */ @@ -264,12 +277,12 @@ _NaN () # undef acosf # define acosf rpl_acosf # endif -_GL_FUNCDECL_RPL (acosf, float, (float x)); +_GL_FUNCDECL_RPL (acosf, float, (float x), ); _GL_CXXALIAS_RPL (acosf, float, (float x)); # else # if !@HAVE_ACOSF@ # undef acosf -_GL_FUNCDECL_SYS (acosf, float, (float x)); +_GL_FUNCDECL_SYS (acosf, float, (float x), ); # endif _GL_CXXALIAS_SYS (acosf, float, (float x)); # endif @@ -285,7 +298,7 @@ _GL_WARN_ON_USE (acosf, "acosf is unportable - " #if @GNULIB_ACOSL@ # if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@ # undef acosl -_GL_FUNCDECL_SYS (acosl, long double, (long double x)); +_GL_FUNCDECL_SYS (acosl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (acosl, long double, (long double x)); # if __GLIBC__ >= 2 @@ -306,12 +319,12 @@ _GL_WARN_ON_USE (acosl, "acosl is unportable - " # undef asinf # define asinf rpl_asinf # endif -_GL_FUNCDECL_RPL (asinf, float, (float x)); +_GL_FUNCDECL_RPL (asinf, float, (float x), ); _GL_CXXALIAS_RPL (asinf, float, (float x)); # else # if !@HAVE_ASINF@ # undef asinf -_GL_FUNCDECL_SYS (asinf, float, (float x)); +_GL_FUNCDECL_SYS (asinf, float, (float x), ); # endif _GL_CXXALIAS_SYS (asinf, float, (float x)); # endif @@ -327,7 +340,7 @@ _GL_WARN_ON_USE (asinf, "asinf is unportable - " #if @GNULIB_ASINL@ # if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@ # undef asinl -_GL_FUNCDECL_SYS (asinl, long double, (long double x)); +_GL_FUNCDECL_SYS (asinl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (asinl, long double, (long double x)); # if __GLIBC__ >= 2 @@ -348,12 +361,12 @@ _GL_WARN_ON_USE (asinl, "asinl is unportable - " # undef atanf # define atanf rpl_atanf # endif -_GL_FUNCDECL_RPL (atanf, float, (float x)); +_GL_FUNCDECL_RPL (atanf, float, (float x), ); _GL_CXXALIAS_RPL (atanf, float, (float x)); # else # if !@HAVE_ATANF@ # undef atanf -_GL_FUNCDECL_SYS (atanf, float, (float x)); +_GL_FUNCDECL_SYS (atanf, float, (float x), ); # endif _GL_CXXALIAS_SYS (atanf, float, (float x)); # endif @@ -369,7 +382,7 @@ _GL_WARN_ON_USE (atanf, "atanf is unportable - " #if @GNULIB_ATANL@ # if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@ # undef atanl -_GL_FUNCDECL_SYS (atanl, long double, (long double x)); +_GL_FUNCDECL_SYS (atanl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (atanl, long double, (long double x)); # if __GLIBC__ >= 2 @@ -390,12 +403,12 @@ _GL_WARN_ON_USE (atanl, "atanl is unportable - " # undef atan2f # define atan2f rpl_atan2f # endif -_GL_FUNCDECL_RPL (atan2f, float, (float y, float x)); +_GL_FUNCDECL_RPL (atan2f, float, (float y, float x), ); _GL_CXXALIAS_RPL (atan2f, float, (float y, float x)); # else # if !@HAVE_ATAN2F@ # undef atan2f -_GL_FUNCDECL_SYS (atan2f, float, (float y, float x)); +_GL_FUNCDECL_SYS (atan2f, float, (float y, float x), ); # endif _GL_CXXALIAS_SYS (atan2f, float, (float y, float x)); # endif @@ -415,11 +428,11 @@ _GL_WARN_ON_USE (atan2f, "atan2f is unportable - " # undef cbrtf # define cbrtf rpl_cbrtf # endif -_GL_FUNCDECL_RPL (cbrtf, float, (float x)); +_GL_FUNCDECL_RPL (cbrtf, float, (float x), ); _GL_CXXALIAS_RPL (cbrtf, float, (float x)); # else # if !@HAVE_DECL_CBRTF@ -_GL_FUNCDECL_SYS (cbrtf, float, (float x)); +_GL_FUNCDECL_SYS (cbrtf, float, (float x), ); # endif _GL_CXXALIAS_SYS (cbrtf, float, (float x)); # endif @@ -434,7 +447,7 @@ _GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - " #if @GNULIB_CBRT@ # if !@HAVE_CBRT@ -_GL_FUNCDECL_SYS (cbrt, double, (double x)); +_GL_FUNCDECL_SYS (cbrt, double, (double x), ); # endif _GL_CXXALIAS_SYS (cbrt, double, (double x)); # if __GLIBC__ >= 2 @@ -454,11 +467,11 @@ _GL_WARN_ON_USE (cbrt, "cbrt is unportable - " # undef cbrtl # define cbrtl rpl_cbrtl # endif -_GL_FUNCDECL_RPL (cbrtl, long double, (long double x)); +_GL_FUNCDECL_RPL (cbrtl, long double, (long double x), ); _GL_CXXALIAS_RPL (cbrtl, long double, (long double x)); # else # if !@HAVE_DECL_CBRTL@ -_GL_FUNCDECL_SYS (cbrtl, long double, (long double x)); +_GL_FUNCDECL_SYS (cbrtl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (cbrtl, long double, (long double x)); # endif @@ -480,12 +493,12 @@ _GL_WARN_ON_USE (cbrtl, "cbrtl is unportable - " # undef ceilf # define ceilf rpl_ceilf # endif -_GL_FUNCDECL_RPL (ceilf, float, (float x)); +_GL_FUNCDECL_RPL (ceilf, float, (float x), ); _GL_CXXALIAS_RPL (ceilf, float, (float x)); # else # if !@HAVE_DECL_CEILF@ # undef ceilf -_GL_FUNCDECL_SYS (ceilf, float, (float x)); +_GL_FUNCDECL_SYS (ceilf, float, (float x), ); # endif _GL_CXXALIAS_SYS (ceilf, float, (float x)); # endif @@ -504,7 +517,7 @@ _GL_WARN_ON_USE (ceilf, "ceilf is unportable - " # undef ceil # define ceil rpl_ceil # endif -_GL_FUNCDECL_RPL (ceil, double, (double x)); +_GL_FUNCDECL_RPL (ceil, double, (double x), ); _GL_CXXALIAS_RPL (ceil, double, (double x)); # else _GL_CXXALIAS_SYS (ceil, double, (double x)); @@ -520,12 +533,12 @@ _GL_CXXALIASWARN1 (ceil, double, (double x)); # undef ceill # define ceill rpl_ceill # endif -_GL_FUNCDECL_RPL (ceill, long double, (long double x)); +_GL_FUNCDECL_RPL (ceill, long double, (long double x), ); _GL_CXXALIAS_RPL (ceill, long double, (long double x)); # else # if !@HAVE_DECL_CEILL@ # undef ceill -_GL_FUNCDECL_SYS (ceill, long double, (long double x)); +_GL_FUNCDECL_SYS (ceill, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (ceill, long double, (long double x)); # endif @@ -544,7 +557,7 @@ _GL_WARN_ON_USE (ceill, "ceill is unportable - " #if @GNULIB_COPYSIGNF@ # if !@HAVE_DECL_COPYSIGNF@ # undef copysignf -_GL_FUNCDECL_SYS (copysignf, float, (float x, float y)); +_GL_FUNCDECL_SYS (copysignf, float, (float x, float y), ); # endif _GL_CXXALIAS_SYS (copysignf, float, (float x, float y)); _GL_CXXALIASWARN (copysignf); @@ -558,7 +571,7 @@ _GL_WARN_ON_USE (copysignf, "copysignf is unportable - " #if @GNULIB_COPYSIGN@ # if !@HAVE_COPYSIGN@ -_GL_FUNCDECL_SYS (copysign, double, (double x, double y)); +_GL_FUNCDECL_SYS (copysign, double, (double x, double y), ); # endif _GL_CXXALIAS_SYS (copysign, double, (double x, double y)); # if __GLIBC__ >= 2 @@ -574,7 +587,7 @@ _GL_WARN_ON_USE (copysign, "copysign is unportable - " #if @GNULIB_COPYSIGNL@ # if !@HAVE_COPYSIGNL@ -_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y)); +_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y), ); # endif _GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y)); # if __GLIBC__ >= 2 @@ -595,12 +608,12 @@ _GL_WARN_ON_USE (copysign, "copysignl is unportable - " # undef cosf # define cosf rpl_cosf # endif -_GL_FUNCDECL_RPL (cosf, float, (float x)); +_GL_FUNCDECL_RPL (cosf, float, (float x), ); _GL_CXXALIAS_RPL (cosf, float, (float x)); # else # if !@HAVE_COSF@ # undef cosf -_GL_FUNCDECL_SYS (cosf, float, (float x)); +_GL_FUNCDECL_SYS (cosf, float, (float x), ); # endif _GL_CXXALIAS_SYS (cosf, float, (float x)); # endif @@ -616,7 +629,7 @@ _GL_WARN_ON_USE (cosf, "cosf is unportable - " #if @GNULIB_COSL@ # if !@HAVE_COSL@ || !@HAVE_DECL_COSL@ # undef cosl -_GL_FUNCDECL_SYS (cosl, long double, (long double x)); +_GL_FUNCDECL_SYS (cosl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (cosl, long double, (long double x)); # if __GLIBC__ >= 2 @@ -637,12 +650,12 @@ _GL_WARN_ON_USE (cosl, "cosl is unportable - " # undef coshf # define coshf rpl_coshf # endif -_GL_FUNCDECL_RPL (coshf, float, (float x)); +_GL_FUNCDECL_RPL (coshf, float, (float x), ); _GL_CXXALIAS_RPL (coshf, float, (float x)); # else # if !@HAVE_COSHF@ # undef coshf -_GL_FUNCDECL_SYS (coshf, float, (float x)); +_GL_FUNCDECL_SYS (coshf, float, (float x), ); # endif _GL_CXXALIAS_SYS (coshf, float, (float x)); # endif @@ -662,12 +675,12 @@ _GL_WARN_ON_USE (coshf, "coshf is unportable - " # undef expf # define expf rpl_expf # endif -_GL_FUNCDECL_RPL (expf, float, (float x)); +_GL_FUNCDECL_RPL (expf, float, (float x), ); _GL_CXXALIAS_RPL (expf, float, (float x)); # else # if !@HAVE_EXPF@ # undef expf -_GL_FUNCDECL_SYS (expf, float, (float x)); +_GL_FUNCDECL_SYS (expf, float, (float x), ); # endif _GL_CXXALIAS_SYS (expf, float, (float x)); # endif @@ -686,12 +699,12 @@ _GL_WARN_ON_USE (expf, "expf is unportable - " # undef expl # define expl rpl_expl # endif -_GL_FUNCDECL_RPL (expl, long double, (long double x)); +_GL_FUNCDECL_RPL (expl, long double, (long double x), ); _GL_CXXALIAS_RPL (expl, long double, (long double x)); # else # if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@ # undef expl -_GL_FUNCDECL_SYS (expl, long double, (long double x)); +_GL_FUNCDECL_SYS (expl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (expl, long double, (long double x)); # endif @@ -709,7 +722,7 @@ _GL_WARN_ON_USE (expl, "expl is unportable - " #if @GNULIB_EXP2F@ # if !@HAVE_DECL_EXP2F@ -_GL_FUNCDECL_SYS (exp2f, float, (float x)); +_GL_FUNCDECL_SYS (exp2f, float, (float x), ); # endif _GL_CXXALIAS_SYS (exp2f, float, (float x)); _GL_CXXALIASWARN (exp2f); @@ -727,11 +740,11 @@ _GL_WARN_ON_USE (exp2f, "exp2f is unportable - " # undef exp2 # define exp2 rpl_exp2 # endif -_GL_FUNCDECL_RPL (exp2, double, (double x)); +_GL_FUNCDECL_RPL (exp2, double, (double x), ); _GL_CXXALIAS_RPL (exp2, double, (double x)); # else # if !@HAVE_DECL_EXP2@ -_GL_FUNCDECL_SYS (exp2, double, (double x)); +_GL_FUNCDECL_SYS (exp2, double, (double x), ); # endif _GL_CXXALIAS_SYS (exp2, double, (double x)); # endif @@ -752,12 +765,12 @@ _GL_WARN_ON_USE (exp2, "exp2 is unportable - " # undef exp2l # define exp2l rpl_exp2l # endif -_GL_FUNCDECL_RPL (exp2l, long double, (long double x)); +_GL_FUNCDECL_RPL (exp2l, long double, (long double x), ); _GL_CXXALIAS_RPL (exp2l, long double, (long double x)); # else # if !@HAVE_DECL_EXP2L@ # undef exp2l -_GL_FUNCDECL_SYS (exp2l, long double, (long double x)); +_GL_FUNCDECL_SYS (exp2l, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (exp2l, long double, (long double x)); # endif @@ -779,11 +792,11 @@ _GL_WARN_ON_USE (exp2l, "exp2l is unportable - " # undef expm1f # define expm1f rpl_expm1f # endif -_GL_FUNCDECL_RPL (expm1f, float, (float x)); +_GL_FUNCDECL_RPL (expm1f, float, (float x), ); _GL_CXXALIAS_RPL (expm1f, float, (float x)); # else # if !@HAVE_EXPM1F@ -_GL_FUNCDECL_SYS (expm1f, float, (float x)); +_GL_FUNCDECL_SYS (expm1f, float, (float x), ); # endif _GL_CXXALIAS_SYS (expm1f, float, (float x)); # endif @@ -802,11 +815,11 @@ _GL_WARN_ON_USE (expm1f, "expm1f is unportable - " # undef expm1 # define expm1 rpl_expm1 # endif -_GL_FUNCDECL_RPL (expm1, double, (double x)); +_GL_FUNCDECL_RPL (expm1, double, (double x), ); _GL_CXXALIAS_RPL (expm1, double, (double x)); # else # if !@HAVE_EXPM1@ -_GL_FUNCDECL_SYS (expm1, double, (double x)); +_GL_FUNCDECL_SYS (expm1, double, (double x), ); # endif _GL_CXXALIAS_SYS (expm1, double, (double x)); # endif @@ -827,13 +840,13 @@ _GL_WARN_ON_USE (expm1, "expm1 is unportable - " # undef expm1l # define expm1l rpl_expm1l # endif -_GL_FUNCDECL_RPL (expm1l, long double, (long double x)); +_GL_FUNCDECL_RPL (expm1l, long double, (long double x), ); _GL_CXXALIAS_RPL (expm1l, long double, (long double x)); # else # if !@HAVE_DECL_EXPM1L@ # undef expm1l # if !(defined __cplusplus && defined _AIX) -_GL_FUNCDECL_SYS (expm1l, long double, (long double x)); +_GL_FUNCDECL_SYS (expm1l, long double, (long double x), ); # endif # endif _GL_CXXALIAS_SYS (expm1l, long double, (long double x)); @@ -853,7 +866,7 @@ _GL_WARN_ON_USE (expm1l, "expm1l is unportable - " #if @GNULIB_FABSF@ # if !@HAVE_FABSF@ # undef fabsf -_GL_FUNCDECL_SYS (fabsf, float, (float x)); +_GL_FUNCDECL_SYS (fabsf, float, (float x), ); # endif _GL_CXXALIAS_SYS (fabsf, float, (float x)); # if __GLIBC__ >= 2 @@ -873,12 +886,12 @@ _GL_WARN_ON_USE (fabsf, "fabsf is unportable - " # undef fabsl # define fabsl rpl_fabsl # endif -_GL_FUNCDECL_RPL (fabsl, long double, (long double x)); +_GL_FUNCDECL_RPL (fabsl, long double, (long double x), ); _GL_CXXALIAS_RPL (fabsl, long double, (long double x)); # else # if !@HAVE_FABSL@ # undef fabsl -_GL_FUNCDECL_SYS (fabsl, long double, (long double x)); +_GL_FUNCDECL_SYS (fabsl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (fabsl, long double, (long double x)); # endif @@ -900,12 +913,12 @@ _GL_WARN_ON_USE (fabsl, "fabsl is unportable - " # undef floorf # define floorf rpl_floorf # endif -_GL_FUNCDECL_RPL (floorf, float, (float x)); +_GL_FUNCDECL_RPL (floorf, float, (float x), ); _GL_CXXALIAS_RPL (floorf, float, (float x)); # else # if !@HAVE_DECL_FLOORF@ # undef floorf -_GL_FUNCDECL_SYS (floorf, float, (float x)); +_GL_FUNCDECL_SYS (floorf, float, (float x), ); # endif _GL_CXXALIAS_SYS (floorf, float, (float x)); # endif @@ -924,7 +937,7 @@ _GL_WARN_ON_USE (floorf, "floorf is unportable - " # undef floor # define floor rpl_floor # endif -_GL_FUNCDECL_RPL (floor, double, (double x)); +_GL_FUNCDECL_RPL (floor, double, (double x), ); _GL_CXXALIAS_RPL (floor, double, (double x)); # else _GL_CXXALIAS_SYS (floor, double, (double x)); @@ -940,12 +953,12 @@ _GL_CXXALIASWARN1 (floor, double, (double x)); # undef floorl # define floorl rpl_floorl # endif -_GL_FUNCDECL_RPL (floorl, long double, (long double x)); +_GL_FUNCDECL_RPL (floorl, long double, (long double x), ); _GL_CXXALIAS_RPL (floorl, long double, (long double x)); # else # if !@HAVE_DECL_FLOORL@ # undef floorl -_GL_FUNCDECL_SYS (floorl, long double, (long double x)); +_GL_FUNCDECL_SYS (floorl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (floorl, long double, (long double x)); # endif @@ -967,12 +980,12 @@ _GL_WARN_ON_USE (floorl, "floorl is unportable - " # undef fmaf # define fmaf rpl_fmaf # endif -_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z)); +_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z), ); _GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z)); # else # if !@HAVE_FMAF@ # undef fmaf -_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z)); +_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z), ); # endif _GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z)); # endif @@ -991,12 +1004,12 @@ _GL_WARN_ON_USE (fmaf, "fmaf is unportable - " # undef fma # define fma rpl_fma # endif -_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z)); +_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z), ); _GL_CXXALIAS_RPL (fma, double, (double x, double y, double z)); # else # if !@HAVE_FMA@ # undef fma -_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z)); +_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z), ); # endif _GL_CXXALIAS_SYS (fma, double, (double x, double y, double z)); # endif @@ -1018,7 +1031,7 @@ _GL_WARN_ON_USE (fma, "fma is unportable - " # define fmal rpl_fmal # endif _GL_FUNCDECL_RPL (fmal, long double, - (long double x, long double y, long double z)); + (long double x, long double y, long double z), ); _GL_CXXALIAS_RPL (fmal, long double, (long double x, long double y, long double z)); # else @@ -1026,7 +1039,7 @@ _GL_CXXALIAS_RPL (fmal, long double, # undef fmal # if !(defined __cplusplus && defined _AIX) _GL_FUNCDECL_SYS (fmal, long double, - (long double x, long double y, long double z)); + (long double x, long double y, long double z), ); # endif # endif _GL_CXXALIAS_SYS (fmal, long double, @@ -1050,12 +1063,12 @@ _GL_WARN_ON_USE (fmal, "fmal is unportable - " # undef fmodf # define fmodf rpl_fmodf # endif -_GL_FUNCDECL_RPL (fmodf, float, (float x, float y)); +_GL_FUNCDECL_RPL (fmodf, float, (float x, float y), ); _GL_CXXALIAS_RPL (fmodf, float, (float x, float y)); # else # if !@HAVE_FMODF@ # undef fmodf -_GL_FUNCDECL_SYS (fmodf, float, (float x, float y)); +_GL_FUNCDECL_SYS (fmodf, float, (float x, float y), ); # endif _GL_CXXALIAS_SYS (fmodf, float, (float x, float y)); # endif @@ -1074,7 +1087,7 @@ _GL_WARN_ON_USE (fmodf, "fmodf is unportable - " # undef fmod # define fmod rpl_fmod # endif -_GL_FUNCDECL_RPL (fmod, double, (double x, double y)); +_GL_FUNCDECL_RPL (fmod, double, (double x, double y), ); _GL_CXXALIAS_RPL (fmod, double, (double x, double y)); # else _GL_CXXALIAS_SYS (fmod, double, (double x, double y)); @@ -1096,12 +1109,12 @@ _GL_WARN_ON_USE (fmod, "fmod has portability problems - " # undef fmodl # define fmodl rpl_fmodl # endif -_GL_FUNCDECL_RPL (fmodl, long double, (long double x, long double y)); +_GL_FUNCDECL_RPL (fmodl, long double, (long double x, long double y), ); _GL_CXXALIAS_RPL (fmodl, long double, (long double x, long double y)); # else # if !@HAVE_FMODL@ # undef fmodl -_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y)); +_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y), ); # endif _GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y)); # endif @@ -1130,12 +1143,12 @@ _GL_WARN_ON_USE (fmodl, "fmodl is unportable - " # undef frexpf # define frexpf rpl_frexpf # endif -_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr)); # else # if !@HAVE_FREXPF@ # undef frexpf -_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr)); # endif @@ -1163,7 +1176,8 @@ _GL_WARN_ON_USE (frexpf, "frexpf is unportable - " # undef frexp # define frexp rpl_frexp # endif -_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr), + _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr)); # else _GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr)); @@ -1174,8 +1188,10 @@ _GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr)); #elif defined GNULIB_POSIXCHECK # undef frexp /* Assume frexp is always declared. */ -_GL_WARN_ON_USE (frexp, "frexp is unportable - " - "use gnulib module frexp for portability"); +_GL_WARN_ON_USE_CXX (frexp, + double, double, (double, int *), + "frexp is unportable - " + "use gnulib module frexp for portability"); #endif /* Write x as @@ -1191,12 +1207,12 @@ _GL_WARN_ON_USE (frexp, "frexp is unportable - " # define frexpl rpl_frexpl # endif _GL_FUNCDECL_RPL (frexpl, long double, - (long double x, int *expptr) _GL_ARG_NONNULL ((2))); + (long double x, int *expptr), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr)); #else # if !@HAVE_DECL_FREXPL@ _GL_FUNCDECL_SYS (frexpl, long double, - (long double x, int *expptr) _GL_ARG_NONNULL ((2))); + (long double x, int *expptr), _GL_ARG_NONNULL ((2))); # endif # if @GNULIB_FREXPL@ _GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr)); @@ -1223,11 +1239,11 @@ _GL_WARN_ON_USE (frexpl, "frexpl is unportable - " # undef hypotf # define hypotf rpl_hypotf # endif -_GL_FUNCDECL_RPL (hypotf, float, (float x, float y)); +_GL_FUNCDECL_RPL (hypotf, float, (float x, float y), ); _GL_CXXALIAS_RPL (hypotf, float, (float x, float y)); # else # if !@HAVE_HYPOTF@ -_GL_FUNCDECL_SYS (hypotf, float, (float x, float y)); +_GL_FUNCDECL_SYS (hypotf, float, (float x, float y), ); # endif _GL_CXXALIAS_SYS (hypotf, float, (float x, float y)); # endif @@ -1249,7 +1265,7 @@ _GL_WARN_ON_USE (hypotf, "hypotf is unportable - " # undef hypot # define hypot rpl_hypot # endif -_GL_FUNCDECL_RPL (hypot, double, (double x, double y)); +_GL_FUNCDECL_RPL (hypot, double, (double x, double y), ); _GL_CXXALIAS_RPL (hypot, double, (double x, double y)); # else _GL_CXXALIAS_SYS (hypot, double, (double x, double y)); @@ -1272,11 +1288,11 @@ _GL_WARN_ON_USE (hypotf, "hypot has portability problems - " # undef hypotl # define hypotl rpl_hypotl # endif -_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y)); +_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y), ); _GL_CXXALIAS_RPL (hypotl, long double, (long double x, long double y)); # else # if !@HAVE_HYPOTL@ -_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y)); +_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y), ); # endif _GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y)); # endif @@ -1298,11 +1314,11 @@ _GL_WARN_ON_USE (hypotl, "hypotl is unportable - " # undef ilogbf # define ilogbf rpl_ilogbf # endif -_GL_FUNCDECL_RPL (ilogbf, int, (float x)); +_GL_FUNCDECL_RPL (ilogbf, int, (float x), ); _GL_CXXALIAS_RPL (ilogbf, int, (float x)); # else # if !@HAVE_ILOGBF@ -_GL_FUNCDECL_SYS (ilogbf, int, (float x)); +_GL_FUNCDECL_SYS (ilogbf, int, (float x), ); # endif _GL_CXXALIAS_SYS (ilogbf, int, (float x)); # endif @@ -1321,11 +1337,11 @@ _GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - " # undef ilogb # define ilogb rpl_ilogb # endif -_GL_FUNCDECL_RPL (ilogb, int, (double x)); +_GL_FUNCDECL_RPL (ilogb, int, (double x), ); _GL_CXXALIAS_RPL (ilogb, int, (double x)); # else # if !@HAVE_ILOGB@ -_GL_FUNCDECL_SYS (ilogb, int, (double x)); +_GL_FUNCDECL_SYS (ilogb, int, (double x), ); # endif _GL_CXXALIAS_SYS (ilogb, int, (double x)); # endif @@ -1346,12 +1362,12 @@ _GL_WARN_ON_USE (ilogb, "ilogb is unportable - " # undef ilogbl # define ilogbl rpl_ilogbl # endif -_GL_FUNCDECL_RPL (ilogbl, int, (long double x)); +_GL_FUNCDECL_RPL (ilogbl, int, (long double x), ); _GL_CXXALIAS_RPL (ilogbl, int, (long double x)); # else # if !@HAVE_ILOGBL@ # undef ilogbl -_GL_FUNCDECL_SYS (ilogbl, int, (long double x)); +_GL_FUNCDECL_SYS (ilogbl, int, (long double x), ); # endif _GL_CXXALIAS_SYS (ilogbl, int, (long double x)); # endif @@ -1420,7 +1436,7 @@ _GL_CXXALIASWARN (jn); #if @GNULIB_LDEXPF@ # if !@HAVE_LDEXPF@ # undef ldexpf -_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp)); +_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp), ); # endif _GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp)); # if __GLIBC__ >= 2 @@ -1441,7 +1457,7 @@ _GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - " # undef ldexp # define ldexp rpl_ldexp # endif -_GL_FUNCDECL_RPL (ldexp, double, (double x, int exp)); +_GL_FUNCDECL_RPL (ldexp, double, (double x, int exp), ); _GL_CXXALIAS_RPL (ldexp, double, (double x, int exp)); # else /* Assume ldexp is always declared. */ @@ -1453,8 +1469,10 @@ _GL_CXXALIASWARN1 (ldexp, double, (double x, int exp)); #elif defined GNULIB_POSIXCHECK # undef ldexp /* Assume ldexp is always declared. */ -_GL_WARN_ON_USE (ldexp, "ldexp is unportable - " - "use gnulib module ldexp for portability"); +_GL_WARN_ON_USE_CXX (ldexp, + double, double, (double, int), + "ldexp is unportable - " + "use gnulib module ldexp for portability"); #endif /* Return x * 2^exp. */ @@ -1463,11 +1481,11 @@ _GL_WARN_ON_USE (ldexp, "ldexp is unportable - " # undef ldexpl # define ldexpl rpl_ldexpl # endif -_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp)); +_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp), ); _GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp)); #else # if !@HAVE_DECL_LDEXPL@ -_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp)); +_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp), ); # endif # if @GNULIB_LDEXPL@ _GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp)); @@ -1493,12 +1511,12 @@ _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - " # undef logf # define logf rpl_logf # endif -_GL_FUNCDECL_RPL (logf, float, (float x)); +_GL_FUNCDECL_RPL (logf, float, (float x), ); _GL_CXXALIAS_RPL (logf, float, (float x)); # else # if !@HAVE_LOGF@ # undef logf -_GL_FUNCDECL_SYS (logf, float, (float x)); +_GL_FUNCDECL_SYS (logf, float, (float x), ); # endif _GL_CXXALIAS_SYS (logf, float, (float x)); # endif @@ -1517,7 +1535,7 @@ _GL_WARN_ON_USE (logf, "logf is unportable - " # undef log # define log rpl_log # endif -_GL_FUNCDECL_RPL (log, double, (double x)); +_GL_FUNCDECL_RPL (log, double, (double x), ); _GL_CXXALIAS_RPL (log, double, (double x)); # else _GL_CXXALIAS_SYS (log, double, (double x)); @@ -1539,12 +1557,12 @@ _GL_WARN_ON_USE (log, "log has portability problems - " # undef logl # define logl rpl_logl # endif -_GL_FUNCDECL_RPL (logl, long double, (long double x)); +_GL_FUNCDECL_RPL (logl, long double, (long double x), ); _GL_CXXALIAS_RPL (logl, long double, (long double x)); # else # if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@ # undef logl -_GL_FUNCDECL_SYS (logl, long double, (long double x)); +_GL_FUNCDECL_SYS (logl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (logl, long double, (long double x)); # endif @@ -1566,12 +1584,12 @@ _GL_WARN_ON_USE (logl, "logl is unportable - " # undef log10f # define log10f rpl_log10f # endif -_GL_FUNCDECL_RPL (log10f, float, (float x)); +_GL_FUNCDECL_RPL (log10f, float, (float x), ); _GL_CXXALIAS_RPL (log10f, float, (float x)); # else # if !@HAVE_LOG10F@ # undef log10f -_GL_FUNCDECL_SYS (log10f, float, (float x)); +_GL_FUNCDECL_SYS (log10f, float, (float x), ); # endif _GL_CXXALIAS_SYS (log10f, float, (float x)); # endif @@ -1590,7 +1608,7 @@ _GL_WARN_ON_USE (log10f, "log10f is unportable - " # undef log10 # define log10 rpl_log10 # endif -_GL_FUNCDECL_RPL (log10, double, (double x)); +_GL_FUNCDECL_RPL (log10, double, (double x), ); _GL_CXXALIAS_RPL (log10, double, (double x)); # else _GL_CXXALIAS_SYS (log10, double, (double x)); @@ -1612,12 +1630,12 @@ _GL_WARN_ON_USE (log10, "log10 has portability problems - " # undef log10l # define log10l rpl_log10l # endif -_GL_FUNCDECL_RPL (log10l, long double, (long double x)); +_GL_FUNCDECL_RPL (log10l, long double, (long double x), ); _GL_CXXALIAS_RPL (log10l, long double, (long double x)); # else # if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@ # undef log10l -_GL_FUNCDECL_SYS (log10l, long double, (long double x)); +_GL_FUNCDECL_SYS (log10l, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (log10l, long double, (long double x)); # endif @@ -1639,11 +1657,11 @@ _GL_WARN_ON_USE (log10l, "log10l is unportable - " # undef log1pf # define log1pf rpl_log1pf # endif -_GL_FUNCDECL_RPL (log1pf, float, (float x)); +_GL_FUNCDECL_RPL (log1pf, float, (float x), ); _GL_CXXALIAS_RPL (log1pf, float, (float x)); # else # if !@HAVE_LOG1PF@ -_GL_FUNCDECL_SYS (log1pf, float, (float x)); +_GL_FUNCDECL_SYS (log1pf, float, (float x), ); # endif _GL_CXXALIAS_SYS (log1pf, float, (float x)); # endif @@ -1662,11 +1680,11 @@ _GL_WARN_ON_USE (log1pf, "log1pf is unportable - " # undef log1p # define log1p rpl_log1p # endif -_GL_FUNCDECL_RPL (log1p, double, (double x)); +_GL_FUNCDECL_RPL (log1p, double, (double x), ); _GL_CXXALIAS_RPL (log1p, double, (double x)); # else # if !@HAVE_LOG1P@ -_GL_FUNCDECL_SYS (log1p, double, (double x)); +_GL_FUNCDECL_SYS (log1p, double, (double x), ); # endif _GL_CXXALIAS_SYS (log1p, double, (double x)); # endif @@ -1687,11 +1705,11 @@ _GL_WARN_ON_USE (log1p, "log1p has portability problems - " # undef log1pl # define log1pl rpl_log1pl # endif -_GL_FUNCDECL_RPL (log1pl, long double, (long double x)); +_GL_FUNCDECL_RPL (log1pl, long double, (long double x), ); _GL_CXXALIAS_RPL (log1pl, long double, (long double x)); # else # if !@HAVE_LOG1PL@ -_GL_FUNCDECL_SYS (log1pl, long double, (long double x)); +_GL_FUNCDECL_SYS (log1pl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (log1pl, long double, (long double x)); # endif @@ -1713,12 +1731,12 @@ _GL_WARN_ON_USE (log1pl, "log1pl has portability problems - " # undef log2f # define log2f rpl_log2f # endif -_GL_FUNCDECL_RPL (log2f, float, (float x)); +_GL_FUNCDECL_RPL (log2f, float, (float x), ); _GL_CXXALIAS_RPL (log2f, float, (float x)); # else # if !@HAVE_DECL_LOG2F@ # undef log2f -_GL_FUNCDECL_SYS (log2f, float, (float x)); +_GL_FUNCDECL_SYS (log2f, float, (float x), ); # endif _GL_CXXALIAS_SYS (log2f, float, (float x)); # endif @@ -1739,12 +1757,12 @@ _GL_WARN_ON_USE (log2f, "log2f is unportable - " # undef log2 # define log2 rpl_log2 # endif -_GL_FUNCDECL_RPL (log2, double, (double x)); +_GL_FUNCDECL_RPL (log2, double, (double x), ); _GL_CXXALIAS_RPL (log2, double, (double x)); # else # if !@HAVE_DECL_LOG2@ # undef log2 -_GL_FUNCDECL_SYS (log2, double, (double x)); +_GL_FUNCDECL_SYS (log2, double, (double x), ); # endif _GL_CXXALIAS_SYS (log2, double, (double x)); # endif @@ -1765,11 +1783,11 @@ _GL_WARN_ON_USE (log2, "log2 is unportable - " # undef log2l # define log2l rpl_log2l # endif -_GL_FUNCDECL_RPL (log2l, long double, (long double x)); +_GL_FUNCDECL_RPL (log2l, long double, (long double x), ); _GL_CXXALIAS_RPL (log2l, long double, (long double x)); # else # if !@HAVE_DECL_LOG2L@ -_GL_FUNCDECL_SYS (log2l, long double, (long double x)); +_GL_FUNCDECL_SYS (log2l, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (log2l, long double, (long double x)); # endif @@ -1791,11 +1809,11 @@ _GL_WARN_ON_USE (log2l, "log2l is unportable - " # undef logbf # define logbf rpl_logbf # endif -_GL_FUNCDECL_RPL (logbf, float, (float x)); +_GL_FUNCDECL_RPL (logbf, float, (float x), ); _GL_CXXALIAS_RPL (logbf, float, (float x)); # else # if !@HAVE_LOGBF@ -_GL_FUNCDECL_SYS (logbf, float, (float x)); +_GL_FUNCDECL_SYS (logbf, float, (float x), ); # endif _GL_CXXALIAS_SYS (logbf, float, (float x)); # endif @@ -1814,11 +1832,11 @@ _GL_WARN_ON_USE (logbf, "logbf is unportable - " # undef logb # define logb rpl_logb # endif -_GL_FUNCDECL_RPL (logb, double, (double x)); +_GL_FUNCDECL_RPL (logb, double, (double x), ); _GL_CXXALIAS_RPL (logb, double, (double x)); # else # if !@HAVE_DECL_LOGB@ -_GL_FUNCDECL_SYS (logb, double, (double x)); +_GL_FUNCDECL_SYS (logb, double, (double x), ); # endif _GL_CXXALIAS_SYS (logb, double, (double x)); # endif @@ -1839,11 +1857,11 @@ _GL_WARN_ON_USE (logb, "logb is unportable - " # undef logbl # define logbl rpl_logbl # endif -_GL_FUNCDECL_RPL (logbl, long double, (long double x)); +_GL_FUNCDECL_RPL (logbl, long double, (long double x), ); _GL_CXXALIAS_RPL (logbl, long double, (long double x)); # else # if !@HAVE_LOGBL@ -_GL_FUNCDECL_SYS (logbl, long double, (long double x)); +_GL_FUNCDECL_SYS (logbl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (logbl, long double, (long double x)); # endif @@ -1859,18 +1877,67 @@ _GL_WARN_ON_USE (logbl, "logbl is unportable - " #endif +#if @GNULIB_LOGP1F@ +# if !@HAVE_LOGP1F@ +_GL_FUNCDECL_SYS (logp1f, float, (float x), ); +# endif +_GL_CXXALIAS_SYS (logp1f, float, (float x)); +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN1 (logp1f, float, (float x)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef logp1f +# if HAVE_RAW_DECL_LOGP1F +_GL_WARN_ON_USE (logp1f, "logp1f is unportable - " + "use gnulib module logp1f for portability"); +# endif +#endif + +#if @GNULIB_LOGP1@ +# if !@HAVE_LOGP1@ +_GL_FUNCDECL_SYS (logp1, double, (double x), ); +# endif +_GL_CXXALIAS_SYS (logp1, double, (double x)); +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN1 (logp1, double, (double x)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef logp1 +# if HAVE_RAW_DECL_LOGP1 +_GL_WARN_ON_USE (logp1, "logp1 is unportable - " + "use gnulib module logp1 for portability"); +# endif +#endif + +#if @GNULIB_LOGP1L@ +# if !@HAVE_LOGP1L@ +_GL_FUNCDECL_SYS (logp1l, long double, (long double x), ); +# endif +_GL_CXXALIAS_SYS (logp1l, long double, (long double x)); +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN1 (logp1l, long double, (long double x)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef logp1l +# if HAVE_RAW_DECL_LOGP1L +_GL_WARN_ON_USE (logp1l, "logp1l is unportable - " + "use gnulib module logp1l for portability"); +# endif +#endif + + #if @GNULIB_MODFF@ # if @REPLACE_MODFF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef modff # define modff rpl_modff # endif -_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (modff, float, (float x, float *iptr)); # else # if !@HAVE_MODFF@ # undef modff -_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (modff, float, (float x, float *iptr)); # endif @@ -1889,7 +1956,8 @@ _GL_WARN_ON_USE (modff, "modff is unportable - " # undef modf # define modf rpl_modf # endif -_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr), + _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (modf, double, (double x, double *iptr)); # else _GL_CXXALIAS_SYS (modf, double, (double x, double *iptr)); @@ -1911,13 +1979,13 @@ _GL_WARN_ON_USE (modf, "modf has portability problems - " # undef modfl # define modfl rpl_modfl # endif -_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr) +_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (modfl, long double, (long double x, long double *iptr)); # else # if !@HAVE_MODFL@ # undef modfl -_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr) +_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr)); @@ -1937,7 +2005,7 @@ _GL_WARN_ON_USE (modfl, "modfl is unportable - " #if @GNULIB_POWF@ # if !@HAVE_POWF@ # undef powf -_GL_FUNCDECL_SYS (powf, float, (float x, float y)); +_GL_FUNCDECL_SYS (powf, float, (float x, float y), ); # endif _GL_CXXALIAS_SYS (powf, float, (float x, float y)); _GL_CXXALIASWARN (powf); @@ -1956,11 +2024,11 @@ _GL_WARN_ON_USE (powf, "powf is unportable - " # undef remainderf # define remainderf rpl_remainderf # endif -_GL_FUNCDECL_RPL (remainderf, float, (float x, float y)); +_GL_FUNCDECL_RPL (remainderf, float, (float x, float y), ); _GL_CXXALIAS_RPL (remainderf, float, (float x, float y)); # else # if !@HAVE_REMAINDERF@ -_GL_FUNCDECL_SYS (remainderf, float, (float x, float y)); +_GL_FUNCDECL_SYS (remainderf, float, (float x, float y), ); # endif _GL_CXXALIAS_SYS (remainderf, float, (float x, float y)); # endif @@ -1979,11 +2047,11 @@ _GL_WARN_ON_USE (remainderf, "remainderf is unportable - " # undef remainder # define remainder rpl_remainder # endif -_GL_FUNCDECL_RPL (remainder, double, (double x, double y)); +_GL_FUNCDECL_RPL (remainder, double, (double x, double y), ); _GL_CXXALIAS_RPL (remainder, double, (double x, double y)); # else # if !@HAVE_REMAINDER@ || !@HAVE_DECL_REMAINDER@ -_GL_FUNCDECL_SYS (remainder, double, (double x, double y)); +_GL_FUNCDECL_SYS (remainder, double, (double x, double y), ); # endif _GL_CXXALIAS_SYS (remainder, double, (double x, double y)); # endif @@ -2004,13 +2072,13 @@ _GL_WARN_ON_USE (remainder, "remainder is unportable - " # undef remainderl # define remainderl rpl_remainderl # endif -_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y)); +_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y), ); _GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y)); # else # if !@HAVE_DECL_REMAINDERL@ # undef remainderl # if !(defined __cplusplus && defined _AIX) -_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y)); +_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y), ); # endif # endif _GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y)); @@ -2029,7 +2097,7 @@ _GL_WARN_ON_USE (remainderl, "remainderl is unportable - " #if @GNULIB_RINTF@ # if !@HAVE_DECL_RINTF@ -_GL_FUNCDECL_SYS (rintf, float, (float x)); +_GL_FUNCDECL_SYS (rintf, float, (float x), ); # endif _GL_CXXALIAS_SYS (rintf, float, (float x)); _GL_CXXALIASWARN (rintf); @@ -2043,7 +2111,7 @@ _GL_WARN_ON_USE (rintf, "rintf is unportable - " #if @GNULIB_RINT@ # if !@HAVE_RINT@ -_GL_FUNCDECL_SYS (rint, double, (double x)); +_GL_FUNCDECL_SYS (rint, double, (double x), ); # endif _GL_CXXALIAS_SYS (rint, double, (double x)); # if __GLIBC__ >= 2 @@ -2063,11 +2131,11 @@ _GL_WARN_ON_USE (rint, "rint is unportable - " # undef rintl # define rintl rpl_rintl # endif -_GL_FUNCDECL_RPL (rintl, long double, (long double x)); +_GL_FUNCDECL_RPL (rintl, long double, (long double x), ); _GL_CXXALIAS_RPL (rintl, long double, (long double x)); # else # if !@HAVE_RINTL@ -_GL_FUNCDECL_SYS (rintl, long double, (long double x)); +_GL_FUNCDECL_SYS (rintl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (rintl, long double, (long double x)); # endif @@ -2089,11 +2157,11 @@ _GL_WARN_ON_USE (rintl, "rintl is unportable - " # undef roundf # define roundf rpl_roundf # endif -_GL_FUNCDECL_RPL (roundf, float, (float x)); +_GL_FUNCDECL_RPL (roundf, float, (float x), ); _GL_CXXALIAS_RPL (roundf, float, (float x)); # else # if !@HAVE_DECL_ROUNDF@ -_GL_FUNCDECL_SYS (roundf, float, (float x)); +_GL_FUNCDECL_SYS (roundf, float, (float x), ); # endif _GL_CXXALIAS_SYS (roundf, float, (float x)); # endif @@ -2112,11 +2180,11 @@ _GL_WARN_ON_USE (roundf, "roundf is unportable - " # undef round # define round rpl_round # endif -_GL_FUNCDECL_RPL (round, double, (double x)); +_GL_FUNCDECL_RPL (round, double, (double x), ); _GL_CXXALIAS_RPL (round, double, (double x)); # else # if !@HAVE_DECL_ROUND@ -_GL_FUNCDECL_SYS (round, double, (double x)); +_GL_FUNCDECL_SYS (round, double, (double x), ); # endif _GL_CXXALIAS_SYS (round, double, (double x)); # endif @@ -2137,13 +2205,13 @@ _GL_WARN_ON_USE (round, "round is unportable - " # undef roundl # define roundl rpl_roundl # endif -_GL_FUNCDECL_RPL (roundl, long double, (long double x)); +_GL_FUNCDECL_RPL (roundl, long double, (long double x), ); _GL_CXXALIAS_RPL (roundl, long double, (long double x)); # else # if !@HAVE_DECL_ROUNDL@ # undef roundl # if !(defined __cplusplus && defined _AIX) -_GL_FUNCDECL_SYS (roundl, long double, (long double x)); +_GL_FUNCDECL_SYS (roundl, long double, (long double x), ); # endif # endif _GL_CXXALIAS_SYS (roundl, long double, (long double x)); @@ -2166,12 +2234,12 @@ _GL_WARN_ON_USE (roundl, "roundl is unportable - " # undef sinf # define sinf rpl_sinf # endif -_GL_FUNCDECL_RPL (sinf, float, (float x)); +_GL_FUNCDECL_RPL (sinf, float, (float x), ); _GL_CXXALIAS_RPL (sinf, float, (float x)); # else # if !@HAVE_SINF@ # undef sinf -_GL_FUNCDECL_SYS (sinf, float, (float x)); +_GL_FUNCDECL_SYS (sinf, float, (float x), ); # endif _GL_CXXALIAS_SYS (sinf, float, (float x)); # endif @@ -2185,11 +2253,20 @@ _GL_WARN_ON_USE (sinf, "sinf is unportable - " #endif #if @GNULIB_SINL@ -# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@ -# undef sinl -_GL_FUNCDECL_SYS (sinl, long double, (long double x)); -# endif +# if @REPLACE_SINL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sinl +# define sinl rpl_sinl +# endif +_GL_FUNCDECL_RPL (sinl, long double, (long double x), ); +_GL_CXXALIAS_RPL (sinl, long double, (long double x)); +# else +# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@ +# undef sinl +_GL_FUNCDECL_SYS (sinl, long double, (long double x), ); +# endif _GL_CXXALIAS_SYS (sinl, long double, (long double x)); +# endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (sinl); # endif @@ -2208,12 +2285,12 @@ _GL_WARN_ON_USE (sinl, "sinl is unportable - " # undef sinhf # define sinhf rpl_sinhf # endif -_GL_FUNCDECL_RPL (sinhf, float, (float x)); +_GL_FUNCDECL_RPL (sinhf, float, (float x), ); _GL_CXXALIAS_RPL (sinhf, float, (float x)); # else # if !@HAVE_SINHF@ # undef sinhf -_GL_FUNCDECL_SYS (sinhf, float, (float x)); +_GL_FUNCDECL_SYS (sinhf, float, (float x), ); # endif _GL_CXXALIAS_SYS (sinhf, float, (float x)); # endif @@ -2233,12 +2310,12 @@ _GL_WARN_ON_USE (sinhf, "sinhf is unportable - " # undef sqrtf # define sqrtf rpl_sqrtf # endif -_GL_FUNCDECL_RPL (sqrtf, float, (float x)); +_GL_FUNCDECL_RPL (sqrtf, float, (float x), ); _GL_CXXALIAS_RPL (sqrtf, float, (float x)); # else # if !@HAVE_SQRTF@ # undef sqrtf -_GL_FUNCDECL_SYS (sqrtf, float, (float x)); +_GL_FUNCDECL_SYS (sqrtf, float, (float x), ); # endif _GL_CXXALIAS_SYS (sqrtf, float, (float x)); # endif @@ -2257,12 +2334,12 @@ _GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - " # undef sqrtl # define sqrtl rpl_sqrtl # endif -_GL_FUNCDECL_RPL (sqrtl, long double, (long double x)); +_GL_FUNCDECL_RPL (sqrtl, long double, (long double x), ); _GL_CXXALIAS_RPL (sqrtl, long double, (long double x)); # else # if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@ # undef sqrtl -_GL_FUNCDECL_SYS (sqrtl, long double, (long double x)); +_GL_FUNCDECL_SYS (sqrtl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (sqrtl, long double, (long double x)); # endif @@ -2284,12 +2361,12 @@ _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - " # undef tanf # define tanf rpl_tanf # endif -_GL_FUNCDECL_RPL (tanf, float, (float x)); +_GL_FUNCDECL_RPL (tanf, float, (float x), ); _GL_CXXALIAS_RPL (tanf, float, (float x)); # else # if !@HAVE_TANF@ # undef tanf -_GL_FUNCDECL_SYS (tanf, float, (float x)); +_GL_FUNCDECL_SYS (tanf, float, (float x), ); # endif _GL_CXXALIAS_SYS (tanf, float, (float x)); # endif @@ -2305,7 +2382,7 @@ _GL_WARN_ON_USE (tanf, "tanf is unportable - " #if @GNULIB_TANL@ # if !@HAVE_TANL@ || !@HAVE_DECL_TANL@ # undef tanl -_GL_FUNCDECL_SYS (tanl, long double, (long double x)); +_GL_FUNCDECL_SYS (tanl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (tanl, long double, (long double x)); # if __GLIBC__ >= 2 @@ -2326,12 +2403,12 @@ _GL_WARN_ON_USE (tanl, "tanl is unportable - " # undef tanhf # define tanhf rpl_tanhf # endif -_GL_FUNCDECL_RPL (tanhf, float, (float x)); +_GL_FUNCDECL_RPL (tanhf, float, (float x), ); _GL_CXXALIAS_RPL (tanhf, float, (float x)); # else # if !@HAVE_TANHF@ # undef tanhf -_GL_FUNCDECL_SYS (tanhf, float, (float x)); +_GL_FUNCDECL_SYS (tanhf, float, (float x), ); # endif _GL_CXXALIAS_SYS (tanhf, float, (float x)); # endif @@ -2351,11 +2428,11 @@ _GL_WARN_ON_USE (tanhf, "tanhf is unportable - " # undef truncf # define truncf rpl_truncf # endif -_GL_FUNCDECL_RPL (truncf, float, (float x)); +_GL_FUNCDECL_RPL (truncf, float, (float x), ); _GL_CXXALIAS_RPL (truncf, float, (float x)); # else # if !@HAVE_DECL_TRUNCF@ -_GL_FUNCDECL_SYS (truncf, float, (float x)); +_GL_FUNCDECL_SYS (truncf, float, (float x), ); # endif _GL_CXXALIAS_SYS (truncf, float, (float x)); # endif @@ -2374,11 +2451,11 @@ _GL_WARN_ON_USE (truncf, "truncf is unportable - " # undef trunc # define trunc rpl_trunc # endif -_GL_FUNCDECL_RPL (trunc, double, (double x)); +_GL_FUNCDECL_RPL (trunc, double, (double x), ); _GL_CXXALIAS_RPL (trunc, double, (double x)); # else # if !@HAVE_DECL_TRUNC@ -_GL_FUNCDECL_SYS (trunc, double, (double x)); +_GL_FUNCDECL_SYS (trunc, double, (double x), ); # endif _GL_CXXALIAS_SYS (trunc, double, (double x)); # endif @@ -2399,11 +2476,11 @@ _GL_WARN_ON_USE (trunc, "trunc is unportable - " # undef truncl # define truncl rpl_truncl # endif -_GL_FUNCDECL_RPL (truncl, long double, (long double x)); +_GL_FUNCDECL_RPL (truncl, long double, (long double x), ); _GL_CXXALIAS_RPL (truncl, long double, (long double x)); # else # if !@HAVE_DECL_TRUNCL@ -_GL_FUNCDECL_SYS (truncl, long double, (long double x)); +_GL_FUNCDECL_SYS (truncl, long double, (long double x), ); # endif _GL_CXXALIAS_SYS (truncl, long double, (long double x)); # endif @@ -2487,7 +2564,7 @@ _GL_EXTERN_C int gl_isfinitel (long double x); # if defined isfinite || defined GNULIB_NAMESPACE _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite) # undef isfinite -# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__))) +# if __GNUC__ >= 6 || (defined __clang__ && (__clang_major__ >= 19 || !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__)))) /* This platform's possibly defines isfinite through a set of inline functions. */ _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool) @@ -2557,7 +2634,7 @@ _GL_EXTERN_C int isnanf (float x); GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't. */ # undef isnanf # define isnanf(x) __builtin_isnan ((float)(x)) -# elif defined isnan +# elif defined isnan && !defined HAVE_ISNANF_NOLIBM # undef isnanf # define isnanf(x) isnan ((float)(x)) # endif @@ -2586,7 +2663,7 @@ _GL_EXTERN_C int isnand (double x); /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. */ # undef isnand # define isnand(x) __builtin_isnan ((double)(x)) -# else +# elif !defined HAVE_ISNAND_NOLIBM # undef isnand # define isnand(x) isnan ((double)(x)) # endif @@ -2609,7 +2686,7 @@ _GL_EXTERN_C int isnand (double x); GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't. */ # undef isnanl # define isnanl(x) __builtin_isnan ((long double)(x)) -# elif defined isnan +# elif defined isnan && !defined HAVE_ISNANL_NOLIBM # undef isnanl # define isnanl(x) isnan ((long double)(x)) # endif @@ -2754,7 +2831,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg); # if defined signbit || defined GNULIB_NAMESPACE _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit) # undef signbit -# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__))) +# if __cplusplus >= 201103L || __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__))) /* This platform's possibly defines signbit through a set of inline functions. */ _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool) @@ -2780,11 +2857,11 @@ _GL_WARN_REAL_FLOATING_DECL (signbit); # undef getpayloadf # define getpayloadf rpl_getpayloadf # endif -_GL_FUNCDECL_RPL (getpayloadf, float, (const float *)); +_GL_FUNCDECL_RPL (getpayloadf, float, (const float *), ); _GL_CXXALIAS_RPL (getpayloadf, float, (const float *)); # else # if !@HAVE_GETPAYLOADF@ -_GL_FUNCDECL_SYS (getpayloadf, float, (const float *)); +_GL_FUNCDECL_SYS (getpayloadf, float, (const float *), ); # endif _GL_CXXALIAS_SYS (getpayloadf, float, (const float *)); # endif @@ -2803,11 +2880,11 @@ _GL_WARN_ON_USE (getpayloadf, "getpayloadf is unportable - " # undef getpayload # define getpayload rpl_getpayload # endif -_GL_FUNCDECL_RPL (getpayload, double, (const double *)); +_GL_FUNCDECL_RPL (getpayload, double, (const double *), ); _GL_CXXALIAS_RPL (getpayload, double, (const double *)); # else # if !@HAVE_GETPAYLOAD@ -_GL_FUNCDECL_SYS (getpayload, double, (const double *)); +_GL_FUNCDECL_SYS (getpayload, double, (const double *), ); # endif _GL_CXXALIAS_SYS (getpayload, double, (const double *)); # endif @@ -2826,11 +2903,11 @@ _GL_WARN_ON_USE (getpayload, "getpayload is unportable - " # undef getpayloadl # define getpayloadl rpl_getpayloadl # endif -_GL_FUNCDECL_RPL (getpayloadl, long double, (const long double *)); +_GL_FUNCDECL_RPL (getpayloadl, long double, (const long double *), ); _GL_CXXALIAS_RPL (getpayloadl, long double, (const long double *)); # else # if !@HAVE_GETPAYLOADL@ -_GL_FUNCDECL_SYS (getpayloadl, long double, (const long double *)); +_GL_FUNCDECL_SYS (getpayloadl, long double, (const long double *), ); # endif _GL_CXXALIAS_SYS (getpayloadl, long double, (const long double *)); # endif @@ -2846,7 +2923,7 @@ _GL_WARN_ON_USE (getpayloadl, "getpayloadl is unportable - " #if @GNULIB_SETPAYLOADF@ # if !@HAVE_SETPAYLOADF@ -_GL_FUNCDECL_SYS (setpayloadf, int, (float *, float)); +_GL_FUNCDECL_SYS (setpayloadf, int, (float *, float), ); # endif _GL_CXXALIAS_SYS (setpayloadf, int, (float *, float)); _GL_CXXALIASWARN (setpayloadf); @@ -2860,7 +2937,7 @@ _GL_WARN_ON_USE (setpayloadf, "setpayloadf is unportable - " #if @GNULIB_SETPAYLOAD@ # if !@HAVE_SETPAYLOAD@ -_GL_FUNCDECL_SYS (setpayload, int, (double *, double)); +_GL_FUNCDECL_SYS (setpayload, int, (double *, double), ); # endif _GL_CXXALIAS_SYS (setpayload, int, (double *, double)); _GL_CXXALIASWARN (setpayload); @@ -2874,7 +2951,7 @@ _GL_WARN_ON_USE (setpayload, "setpayload is unportable - " #if @GNULIB_SETPAYLOADL@ # if !@HAVE_SETPAYLOADL@ -_GL_FUNCDECL_SYS (setpayloadl, int, (long double *, long double)); +_GL_FUNCDECL_SYS (setpayloadl, int, (long double *, long double), ); # endif _GL_CXXALIAS_SYS (setpayloadl, int, (long double *, long double)); _GL_CXXALIASWARN (setpayloadl); @@ -2889,7 +2966,7 @@ _GL_WARN_ON_USE (setpayloadl, "setpayloadl is unportable - " #if @GNULIB_SETPAYLOADSIGF@ # if !@HAVE_SETPAYLOADSIGF@ -_GL_FUNCDECL_SYS (setpayloadsigf, int, (float *, float)); +_GL_FUNCDECL_SYS (setpayloadsigf, int, (float *, float), ); # endif _GL_CXXALIAS_SYS (setpayloadsigf, int, (float *, float)); _GL_CXXALIASWARN (setpayloadsigf); @@ -2903,7 +2980,7 @@ _GL_WARN_ON_USE (setpayloadsigf, "setpayloadsigf is unportable - " #if @GNULIB_SETPAYLOADSIG@ # if !@HAVE_SETPAYLOADSIG@ -_GL_FUNCDECL_SYS (setpayloadsig, int, (double *, double)); +_GL_FUNCDECL_SYS (setpayloadsig, int, (double *, double), ); # endif _GL_CXXALIAS_SYS (setpayloadsig, int, (double *, double)); _GL_CXXALIASWARN (setpayloadsig); @@ -2917,7 +2994,7 @@ _GL_WARN_ON_USE (setpayloadsig, "setpayloadsig is unportable - " #if @GNULIB_SETPAYLOADSIGL@ # if !@HAVE_SETPAYLOADSIGL@ -_GL_FUNCDECL_SYS (setpayloadsigl, int, (long double *, long double)); +_GL_FUNCDECL_SYS (setpayloadsigl, int, (long double *, long double), ); # endif _GL_CXXALIAS_SYS (setpayloadsigl, int, (long double *, long double)); _GL_CXXALIASWARN (setpayloadsigl); @@ -2936,11 +3013,11 @@ _GL_WARN_ON_USE (setpayloadsigl, "setpayloadsigl is unportable - " # undef totalorderf # define totalorderf rpl_totalorderf # endif -_GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *)); +_GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *), ); _GL_CXXALIAS_RPL (totalorderf, int, (float const *, float const *)); # else # if !@HAVE_TOTALORDERF@ -_GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *)); +_GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *), ); # endif _GL_CXXALIAS_SYS (totalorderf, int, (float const *, float const *)); # endif @@ -2959,11 +3036,11 @@ _GL_WARN_ON_USE (totalorderf, "totalorderf is unportable - " # undef totalorder # define totalorder rpl_totalorder # endif -_GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *)); +_GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *), ); _GL_CXXALIAS_RPL (totalorder, int, (double const *, double const *)); # else # if !@HAVE_TOTALORDER@ -_GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *)); +_GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *), ); # endif _GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *)); # endif @@ -2985,13 +3062,13 @@ _GL_WARN_ON_USE (totalorder, "totalorder is unportable - " # define totalorderl rpl_totalorderl # endif _GL_FUNCDECL_RPL (totalorderl, int, - (long double const *, long double const *)); + (long double const *, long double const *), ); _GL_CXXALIAS_RPL (totalorderl, int, (long double const *, long double const *)); # else # if !@HAVE_TOTALORDERL@ _GL_FUNCDECL_SYS (totalorderl, int, - (long double const *, long double const *)); + (long double const *, long double const *), ); # endif _GL_CXXALIAS_SYS (totalorderl, int, (long double const *, long double const *)); @@ -3012,11 +3089,11 @@ _GL_WARN_ON_USE (totalorderl, "totalorderl is unportable - " # undef totalordermagf # define totalordermagf rpl_totalordermagf # endif -_GL_FUNCDECL_RPL (totalordermagf, int, (float const *, float const *)); +_GL_FUNCDECL_RPL (totalordermagf, int, (float const *, float const *), ); _GL_CXXALIAS_RPL (totalordermagf, int, (float const *, float const *)); # else # if !@HAVE_TOTALORDERMAGF@ -_GL_FUNCDECL_SYS (totalordermagf, int, (float const *, float const *)); +_GL_FUNCDECL_SYS (totalordermagf, int, (float const *, float const *), ); # endif _GL_CXXALIAS_SYS (totalordermagf, int, (float const *, float const *)); # endif @@ -3037,11 +3114,11 @@ _GL_WARN_ON_USE (totalordermagf, "totalordermagf is unportable - " # undef totalordermag # define totalordermag rpl_totalordermag # endif -_GL_FUNCDECL_RPL (totalordermag, int, (double const *, double const *)); +_GL_FUNCDECL_RPL (totalordermag, int, (double const *, double const *), ); _GL_CXXALIAS_RPL (totalordermag, int, (double const *, double const *)); # else # if !@HAVE_TOTALORDERMAG@ -_GL_FUNCDECL_SYS (totalordermag, int, (double const *, double const *)); +_GL_FUNCDECL_SYS (totalordermag, int, (double const *, double const *), ); # endif _GL_CXXALIAS_SYS (totalordermag, int, (double const *, double const *)); # endif @@ -3063,13 +3140,13 @@ _GL_WARN_ON_USE (totalordermag, "totalordermag is unportable - " # define totalordermagl rpl_totalordermagl # endif _GL_FUNCDECL_RPL (totalordermagl, int, - (long double const *, long double const *)); + (long double const *, long double const *), ); _GL_CXXALIAS_RPL (totalordermagl, int, (long double const *, long double const *)); # else # if !@HAVE_TOTALORDERMAGL@ _GL_FUNCDECL_SYS (totalordermagl, int, - (long double const *, long double const *)); + (long double const *, long double const *), ); # endif _GL_CXXALIAS_SYS (totalordermagl, int, (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 @@ +/* Copyright (C) 2001, 2006, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + + +#include + +#define MBCHAR_INLINE _GL_EXTERN_INLINE + +#include + +#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 @@ +/* Multibyte character data type. + Copyright (C) 2001, 2005-2007, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible . */ + +/* A multibyte character is a short subsequence of a char* string, + representing a single 32-bit wide character. + + We use multibyte characters instead of 32-bit wide characters because + of the following goals: + 1) correct multibyte handling, i.e. operate according to the LC_CTYPE + locale, + 2) ease of maintenance, i.e. the maintainer needs not know all details + of the ISO C 99 standard, + 3) don't fail grossly if the input is not in the encoding set by the + locale, because often different encodings are in use in the same + countries (ISO-8859-1/UTF-8, EUC-JP/Shift_JIS, ...), + 4) fast in the case of ASCII characters. + + Multibyte characters are only accessed through the mb* macros. + + mb_ptr (mbc) + return a pointer to the beginning of the multibyte sequence. + + mb_len (mbc) + returns the number of bytes occupied by the multibyte sequence. + Always > 0. + + mb_iseq (mbc, sc) + returns true if mbc is the standard ASCII character sc. + + mb_isnul (mbc) + returns true if mbc is the nul character. + + mb_cmp (mbc1, mbc2) + returns a positive, zero, or negative value depending on whether mbc1 + sorts after, same or before mbc2. + + mb_casecmp (mbc1, mbc2) + returns a positive, zero, or negative value depending on whether mbc1 + sorts after, same or before mbc2, modulo upper/lowercase conversion. + + mb_equal (mbc1, mbc2) + returns true if mbc1 and mbc2 are equal. + + mb_caseequal (mbc1, mbc2) + returns true if mbc1 and mbc2 are equal modulo upper/lowercase conversion. + + mb_isalnum (mbc) + returns true if mbc is alphanumeric. + + mb_isalpha (mbc) + returns true if mbc is alphabetic. + + mb_isascii(mbc) + returns true if mbc is plain ASCII. + + mb_isblank (mbc) + returns true if mbc is a blank. + + mb_iscntrl (mbc) + returns true if mbc is a control character. + + mb_isdigit (mbc) + returns true if mbc is a decimal digit. + + mb_isgraph (mbc) + returns true if mbc is a graphic character. + + mb_islower (mbc) + returns true if mbc is lowercase. + + mb_isprint (mbc) + returns true if mbc is a printable character. + + mb_ispunct (mbc) + returns true if mbc is a punctuation character. + + mb_isspace (mbc) + returns true if mbc is a space character. + + mb_isupper (mbc) + returns true if mbc is uppercase. + + mb_isxdigit (mbc) + returns true if mbc is a hexadecimal digit. + + mb_width (mbc) + returns the number of columns on the output device occupied by mbc. + Always >= 0. + + mb_putc (mbc, stream) + outputs mbc on stream, a byte oriented FILE stream opened for output. + + mb_setascii (&mbc, sc) + assigns the standard ASCII character sc to mbc. + (Only available if the 'mbfile' module is in use.) + + mb_copy (&destmbc, &srcmbc) + copies srcmbc to destmbc. + + Here are the function prototypes of the macros. + + extern const char * mb_ptr (const mbchar_t mbc); + extern size_t mb_len (const mbchar_t mbc); + extern bool mb_iseq (const mbchar_t mbc, char sc); + extern bool mb_isnul (const mbchar_t mbc); + extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2); + extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2); + extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2); + extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2); + extern bool mb_isalnum (const mbchar_t mbc); + extern bool mb_isalpha (const mbchar_t mbc); + extern bool mb_isascii (const mbchar_t mbc); + extern bool mb_isblank (const mbchar_t mbc); + extern bool mb_iscntrl (const mbchar_t mbc); + extern bool mb_isdigit (const mbchar_t mbc); + extern bool mb_isgraph (const mbchar_t mbc); + extern bool mb_islower (const mbchar_t mbc); + extern bool mb_isprint (const mbchar_t mbc); + extern bool mb_ispunct (const mbchar_t mbc); + extern bool mb_isspace (const mbchar_t mbc); + extern bool mb_isupper (const mbchar_t mbc); + extern bool mb_isxdigit (const mbchar_t mbc); + extern int mb_width (const mbchar_t mbc); + extern void mb_putc (const mbchar_t mbc, FILE *stream); + extern void mb_setascii (mbchar_t *new, char sc); + extern void mb_copy (mbchar_t *new, const mbchar_t *old); + */ + +#ifndef _MBCHAR_H +#define _MBCHAR_H 1 + +/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#include +#include + +_GL_INLINE_HEADER_BEGIN +#ifndef MBCHAR_INLINE +# define MBCHAR_INLINE _GL_INLINE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/* The longest multibyte characters, nowadays, are 4 bytes long. + Regardless of the values of MB_CUR_MAX and MB_LEN_MAX. */ +#define MBCHAR_BUF_SIZE 4 + +struct mbchar +{ + const char *ptr; /* pointer to current character */ + size_t bytes; /* number of bytes of current character, > 0 */ + bool wc_valid; /* true if wc is a valid 32-bit wide character */ + char32_t wc; /* if wc_valid: the current character */ +#if defined GNULIB_MBFILE + char buf[MBCHAR_BUF_SIZE]; /* room for the bytes, used for file input only */ +#endif +}; + +/* EOF (not a real character) is represented with bytes = 0 and + wc_valid = false. */ + +typedef struct mbchar mbchar_t; + +/* Access the current character. */ +#define mb_ptr(mbc) ((mbc).ptr) +#define mb_len(mbc) ((mbc).bytes) + +/* Comparison of characters. */ +#define mb_iseq(mbc, sc) ((mbc).wc_valid && (mbc).wc == (sc)) +#define mb_isnul(mbc) ((mbc).wc_valid && (mbc).wc == 0) +#define mb_cmp(mbc1, mbc2) \ + ((mbc1).wc_valid \ + ? ((mbc2).wc_valid \ + ? _GL_CMP ((mbc1).wc, (mbc2).wc) \ + : -1) \ + : ((mbc2).wc_valid \ + ? 1 \ + : (mbc1).bytes == (mbc2).bytes \ + ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ + : (mbc1).bytes < (mbc2).bytes \ + ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \ + : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1))) +#define mb_casecmp(mbc1, mbc2) \ + ((mbc1).wc_valid \ + ? ((mbc2).wc_valid \ + ? _GL_CMP (c32tolower ((mbc1).wc), c32tolower ((mbc2).wc)) \ + : -1) \ + : ((mbc2).wc_valid \ + ? 1 \ + : (mbc1).bytes == (mbc2).bytes \ + ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \ + : (mbc1).bytes < (mbc2).bytes \ + ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \ + : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1))) +#define mb_equal(mbc1, mbc2) \ + ((mbc1).wc_valid && (mbc2).wc_valid \ + ? (mbc1).wc == (mbc2).wc \ + : (mbc1).bytes == (mbc2).bytes \ + && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0) +#define mb_caseequal(mbc1, mbc2) \ + ((mbc1).wc_valid && (mbc2).wc_valid \ + ? c32tolower ((mbc1).wc) == c32tolower ((mbc2).wc) \ + : (mbc1).bytes == (mbc2).bytes \ + && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0) + +/* , classification. */ +#define mb_isascii(mbc) \ + ((mbc).wc_valid && (mbc).wc >= 0 && (mbc).wc <= 127) +#define mb_isalnum(mbc) ((mbc).wc_valid && c32isalnum ((mbc).wc)) +#define mb_isalpha(mbc) ((mbc).wc_valid && c32isalpha ((mbc).wc)) +#define mb_isblank(mbc) ((mbc).wc_valid && c32isblank ((mbc).wc)) +#define mb_iscntrl(mbc) ((mbc).wc_valid && c32iscntrl ((mbc).wc)) +#define mb_isdigit(mbc) ((mbc).wc_valid && c32isdigit ((mbc).wc)) +#define mb_isgraph(mbc) ((mbc).wc_valid && c32isgraph ((mbc).wc)) +#define mb_islower(mbc) ((mbc).wc_valid && c32islower ((mbc).wc)) +#define mb_isprint(mbc) ((mbc).wc_valid && c32isprint ((mbc).wc)) +#define mb_ispunct(mbc) ((mbc).wc_valid && c32ispunct ((mbc).wc)) +#define mb_isspace(mbc) ((mbc).wc_valid && c32isspace ((mbc).wc)) +#define mb_isupper(mbc) ((mbc).wc_valid && c32isupper ((mbc).wc)) +#define mb_isxdigit(mbc) ((mbc).wc_valid && c32isxdigit ((mbc).wc)) + +/* Extra function. */ + +/* Unprintable characters appear as a small box of width 1. */ +#define MB_UNPRINTABLE_WIDTH 1 + +MBCHAR_INLINE int +mb_width_aux (char32_t wc) +{ + int w = c32width (wc); + /* For unprintable characters, arbitrarily return 0 for control characters + and MB_UNPRINTABLE_WIDTH otherwise. */ + return (w >= 0 ? w : c32iscntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH); +} + +#define mb_width(mbc) \ + ((mbc).wc_valid ? mb_width_aux ((mbc).wc) : MB_UNPRINTABLE_WIDTH) + +/* Output. */ +#define mb_putc(mbc, stream) fwrite ((mbc).ptr, 1, (mbc).bytes, (stream)) + +#if defined GNULIB_MBFILE +/* Assignment. */ +# define mb_setascii(mbc, sc) \ + ((mbc)->ptr = (mbc)->buf, (mbc)->bytes = 1, (mbc)->wc_valid = 1, \ + (mbc)->wc = (mbc)->buf[0] = (sc)) +#endif + +/* Copying a character. */ +MBCHAR_INLINE void +mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc) +{ +#if defined GNULIB_MBFILE + if (old_mbc->ptr == &old_mbc->buf[0]) + { + memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes); + new_mbc->ptr = &new_mbc->buf[0]; + } + else +#endif + new_mbc->ptr = old_mbc->ptr; + new_mbc->bytes = old_mbc->bytes; + if ((new_mbc->wc_valid = old_mbc->wc_valid)) + new_mbc->wc = old_mbc->wc; +} + + +/* is_basic(c) tests whether the single-byte character c is + - in the ISO C "basic character set" or is one of '@', '$', and '`' + which ISO C 23 § 5.2.1.1.(1) guarantees to be single-byte and in + practice are safe to treat as basic in the execution character set, + or + - in the POSIX "portable character set", which + + equally guarantees to be single-byte. + This is a convenience function, and is in this file only to share code + between mbiter.h, mbuiter.h, and mbfile.h. */ +#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('$' == 36) && ('%' == 37) && ('&' == 38) && ('\'' == 39) \ + && ('(' == 40) && (')' == 41) && ('*' == 42) && ('+' == 43) \ + && (',' == 44) && ('-' == 45) && ('.' == 46) && ('/' == 47) \ + && ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) \ + && ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) \ + && ('8' == 56) && ('9' == 57) && (':' == 58) && (';' == 59) \ + && ('<' == 60) && ('=' == 61) && ('>' == 62) && ('?' == 63) \ + && ('@' == 64) && ('A' == 65) && ('B' == 66) && ('C' == 67) \ + && ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) \ + && ('H' == 72) && ('I' == 73) && ('J' == 74) && ('K' == 75) \ + && ('L' == 76) && ('M' == 77) && ('N' == 78) && ('O' == 79) \ + && ('P' == 80) && ('Q' == 81) && ('R' == 82) && ('S' == 83) \ + && ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) \ + && ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) \ + && ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) \ + && ('`' == 96) && ('a' == 97) && ('b' == 98) && ('c' == 99) \ + && ('d' == 100) && ('e' == 101) && ('f' == 102) && ('g' == 103) \ + && ('h' == 104) && ('i' == 105) && ('j' == 106) && ('k' == 107) \ + && ('l' == 108) && ('m' == 109) && ('n' == 110) && ('o' == 111) \ + && ('p' == 112) && ('q' == 113) && ('r' == 114) && ('s' == 115) \ + && ('t' == 116) && ('u' == 117) && ('v' == 118) && ('w' == 119) \ + && ('x' == 120) && ('y' == 121) && ('z' == 122) && ('{' == 123) \ + && ('|' == 124) && ('}' == 125) && ('~' == 126) +/* The character set is ISO-646, not EBCDIC. */ +# define IS_BASIC_ASCII 1 + +/* All locale encodings (see localcharset.h) map the characters 0x00..0x7F + to U+0000..U+007F, like ASCII, except for + CP864 different mapping of '%' + SHIFT_JIS different mappings of 0x5C, 0x7E + JOHAB different mapping of 0x5C + However, these characters in the range 0x20..0x7E are in the ISO C + "basic character set" and in the POSIX "portable character set", which + ISO C and POSIX guarantee to be single-byte. Thus, locales with these + encodings are not POSIX compliant. And they are most likely not in use + any more (as of 2023). */ +# define is_basic(c) ((unsigned char) (c) < 0x80) + +#else + +MBCHAR_INLINE bool +is_basic (char c) +{ + switch (c) + { + case '\0': + case '\007': case '\010': + case '\t': case '\n': case '\v': case '\f': case '\r': + case ' ': case '!': case '"': case '#': case '$': case '%': + case '&': case '\'': case '(': case ')': case '*': + case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': + case '?': case '@': + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': + case 'Z': + case '[': case '\\': case ']': case '^': case '_': case '`': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': + case 'z': case '{': case '|': case '}': case '~': + return 1; + default: + return 0; + } +} + +#endif + + +#ifdef __cplusplus +} +#endif + +_GL_INLINE_HEADER_END + +#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 @@ +/* Iterating through multibyte strings: macros for multi-byte encodings. + + Copyright (C) 2023-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define MBITERF_INLINE _GL_EXTERN_INLINE +#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 @@ +/* Iterating through multibyte strings, faster: macros for multi-byte encodings. + Copyright (C) 2001, 2005, 2007, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , + with insights from Paul Eggert. */ + +/* The macros in this file implement forward iteration through a + multi-byte string. + + With these macros, an iteration loop that looks like + + char *iter; + for (iter = buf; iter < buf + buflen; iter++) + { + do_something (*iter); + } + + becomes + + const char *buf_end = buf + buflen; + mbif_state_t state; + [const] char *iter; + for (mbif_init (state), iter = buf; mbif_avail (state, iter, buf_end); ) + { + mbchar_t cur = mbif_next (state, iter, buf_end); + // Note: Here always mb_ptr (cur) == iter. + do_something (iter, mb_len (cur)); + iter += mb_len (cur); + } + + The benefit of these macros over plain use of mbrtowc or mbrtoc32 is: + - Handling of invalid multibyte sequences is possible without + making the code more complicated, while still preserving the + invalid multibyte sequences. + + The benefit of these macros over those from mbiter.h is that it + produces faster code with today's optimizing compilers (because mbif_next + returns its result by value). + + mbif_state_t + is a type usable for variable declarations. + + mbif_init (state) + initializes the state. + + mbif_avail (state, iter, endptr) + returns true if another loop round is needed. + + mbif_next (state, iter, endptr) + returns the next multibyte character. + It asssumes that the state is initialized and that iter < endptr. + + Here are the function prototypes of the macros. + + extern void mbif_init (mbif_state_t state); + extern bool mbif_avail (mbif_state_t state, const char *iter, const char *endptr); + extern mbchar_t mbif_next (mbif_state_t state, const char *iter, const char *endptr); + */ + +#ifndef _MBITERF_H +#define _MBITERF_H 1 + +/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, + _GL_ATTRIBUTE_ALWAYS_INLINE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#include +#include +#include +#include +#include + +#include "mbchar.h" + +_GL_INLINE_HEADER_BEGIN +#ifndef MBITERF_INLINE +# define MBITERF_INLINE _GL_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +struct mbif_state +{ + #if !GNULIB_MBRTOC32_REGULAR + bool in_shift; /* true if next byte may not be interpreted as ASCII */ + /* If GNULIB_MBRTOC32_REGULAR, it is always false, + so optimize it away. */ + #endif + mbstate_t state; /* if in_shift: current shift state */ + /* If GNULIB_MBRTOC32_REGULAR, it is in an initial state + before and after every mbiterf_next invocation. + */ +}; + +MBITERF_INLINE mbchar_t +mbiterf_next (struct mbif_state *ps, const char *iter, const char *endptr) +{ + #if !GNULIB_MBRTOC32_REGULAR + if (ps->in_shift) + goto with_shift; + #endif + /* Handle most ASCII characters quickly, without calling mbrtowc(). */ + if (is_basic (*iter)) + { + /* These characters are part of the POSIX portable character set. + For most of them, namely those in the ISO C basic character set, + ISO C 99 guarantees that their wide character code is identical to + their char code. For the few other ones, this is the case as well, + in all locale encodings that are in use. The 32-bit wide character + code is the same as well. */ + return (mbchar_t) { .ptr = iter, .bytes = 1, .wc_valid = true, .wc = *iter }; + } + else + { + assert (mbsinit (&ps->state)); + #if !GNULIB_MBRTOC32_REGULAR + ps->in_shift = true; + with_shift:; + #endif + size_t bytes; + char32_t wc; + bytes = mbrtoc32 (&wc, iter, endptr - iter, &ps->state); + if (bytes == (size_t) -1) + { + /* An invalid multibyte sequence was encountered. */ + /* Allow the next invocation to continue from a sane state. */ + #if !GNULIB_MBRTOC32_REGULAR + ps->in_shift = false; + #endif + mbszero (&ps->state); + return (mbchar_t) { .ptr = iter, .bytes = 1, .wc_valid = false }; + } + else if (bytes == (size_t) -2) + { + /* An incomplete multibyte character at the end. */ + #if !GNULIB_MBRTOC32_REGULAR + ps->in_shift = false; + #endif + /* Whether to reset ps->state or not is not important; the string end + is reached anyway. */ + return (mbchar_t) { .ptr = iter, .bytes = endptr - iter, .wc_valid = false }; + } + else + { + if (bytes == 0) + { + /* A null wide character was encountered. */ + bytes = 1; + assert (*iter == '\0'); + assert (wc == 0); + } + #if !GNULIB_MBRTOC32_REGULAR + else if (bytes == (size_t) -3) + /* The previous multibyte sequence produced an additional 32-bit + wide character. */ + bytes = 0; + #endif + + /* When in an initial state, we can go back treating ASCII + characters more quickly. */ + #if !GNULIB_MBRTOC32_REGULAR + if (mbsinit (&ps->state)) + ps->in_shift = false; + #endif + return (mbchar_t) { .ptr = iter, .bytes = bytes, .wc_valid = true, .wc = wc }; + } + } +} + +/* Iteration macros. */ +typedef struct mbif_state mbif_state_t; +#if !GNULIB_MBRTOC32_REGULAR +#define mbif_init(st) \ + ((st).in_shift = false, mbszero (&(st).state)) +#else +/* Optimized: no in_shift. */ +#define mbif_init(st) \ + (mbszero (&(st).state)) +#endif +#if !GNULIB_MBRTOC32_REGULAR +#define mbif_avail(st, iter, endptr) ((st).in_shift || ((iter) < (endptr))) +#else +/* Optimized: no in_shift. */ +#define mbif_avail(st, iter, endptr) ((iter) < (endptr)) +#endif +#define mbif_next(st, iter, endptr) \ + mbiterf_next (&(st), (iter), (endptr)) + + +#ifdef __cplusplus +} +#endif + +_GL_INLINE_HEADER_END + +#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 @@ +/* Convert multibyte character to 32-bit wide character. + Copyright (C) 2020-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2020. */ + +#include + +/* Specification. */ +#include + +#include "attribute.h" + +#include +#include + +#if GL_CHAR32_T_IS_UNICODE +# include "lc-charset-unicode.h" +#endif + +#if GNULIB_defined_mbstate_t /* AIX, IRIX */ +/* Implement mbrtoc32() on top of mbtowc() for the non-UTF-8 locales + and directly for the UTF-8 locales. */ + +/* Note: On AIX (64-bit) we can implement mbrtoc32 in two equivalent ways: + - in a way that parallels the override of mbrtowc; this is the code branch + here; + - in a way that invokes the overridden mbrtowc; this would be the #else + branch below. + They are equivalent. */ + +# if AVOID_ANY_THREADS + +/* The option '--disable-threads' explicitly requests no locking. */ + +# elif defined _WIN32 && !defined __CYGWIN__ + +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ +# include + +# elif HAVE_PTHREAD_API + +# include +# if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS +# include +# pragma weak thrd_exit +# define c11_threads_in_use() (thrd_exit != NULL) +# else +# define c11_threads_in_use() 0 +# endif + +# elif HAVE_THREADS_H + +# include + +# endif + +# include "lc-charset-dispatch.h" +# include "mbtowc-lock.h" + +static_assert (sizeof (mbstate_t) >= 4); +static char internal_state[4]; + +size_t +mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps) +{ +# define FITS_IN_CHAR_TYPE(wc) 1 +# include "mbrtowc-impl.h" +} + +#else /* glibc, macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, MSVC, Minix, Android */ + +/* Implement mbrtoc32() based on the original mbrtoc32() or on mbrtowc(). */ + +# include + +# include "localcharset.h" +# include "streq.h" + +# if MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ +# include "hard-locale.h" +# include +# endif + +static mbstate_t internal_state; + +size_t +mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps) +# undef mbrtoc32 +{ + /* It's simpler to handle the case s == NULL upfront, than to worry about + this case later, before every test of pwc and n. */ + if (s == NULL) + { + pwc = NULL; + s = ""; + n = 1; + } + +# if MBRTOC32_EMPTY_INPUT_BUG || _GL_SMALL_WCHAR_T + if (n == 0) + return (size_t) -2; +# endif + + if (ps == NULL) + ps = &internal_state; + +# if HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB && !MBRTOC32_MULTIBYTE_LOCALE_BUG + /* mbrtoc32() may produce different values for wc than mbrtowc(). Therefore + use mbrtoc32(). */ + +# if defined _WIN32 && !defined __CYGWIN__ + char32_t wc; + size_t ret = mbrtoc32 (&wc, s, n, ps); + if (ret < (size_t) -2 && pwc != NULL) + *pwc = wc; +# else + size_t ret = mbrtoc32 (pwc, s, n, ps); +# endif + +# if GNULIB_MBRTOC32_REGULAR + /* Verify that mbrtoc32 is regular. */ + if (ret < (size_t) -3 && ! mbsinit (ps)) + /* This occurs on glibc 2.36. */ + mbszero (ps); + if (ret == (size_t) -3) + abort (); +# endif + +# if MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ + if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE)) + { + if (pwc != NULL) + *pwc = (unsigned char) *s; + return 1; + } +# endif + + return ret; + +# elif _GL_SMALL_WCHAR_T + + /* Special-case all encodings that may produce wide character values + > WCHAR_MAX. */ + const char *encoding = locale_charset (); + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + { + /* Special-case the UTF-8 encoding. Assume that the wide-character + encoding in a UTF-8 locale is UCS-2 or, equivalently, UTF-16. */ + /* Here n > 0. */ + char *pstate = (char *)ps; + size_t nstate = pstate[0]; + char buf[4]; + const char *p; + size_t m; + int res; + + switch (nstate) + { + case 0: + p = s; + m = n; + break; + case 3: + buf[2] = pstate[3]; + FALLTHROUGH; + case 2: + buf[1] = pstate[2]; + FALLTHROUGH; + case 1: + buf[0] = pstate[1]; + p = buf; + m = nstate; + buf[m++] = s[0]; + if (n >= 2 && m < 4) + { + buf[m++] = s[1]; + if (n >= 3 && m < 4) + buf[m++] = s[2]; + } + break; + default: + errno = EINVAL; + return (size_t)(-1); + } + + /* Here m > 0. */ + + { +# define FITS_IN_CHAR_TYPE(wc) 1 +# include "mbrtowc-impl-utf8.h" + } + + success: + if (nstate >= (res > 0 ? res : 1)) + abort (); + res -= nstate; + /* Set *ps to an initial state. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* Native Windows. */ + /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4 bytes matter. + On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined + as an 8-byte struct, of which the first 4 bytes matter. */ + *(unsigned int *)pstate = 0; +# elif defined __CYGWIN__ + /* Cygwin defines 'mbstate_t' as an 8-byte struct; the first 4 bytes + matter. */ + ps->__count = 0; +# else + pstate[0] = 0; +# endif + return res; + + incomplete: + { + size_t k = nstate; + /* Here 0 <= k < m < 4. */ + pstate[++k] = s[0]; + if (k < m) + { + pstate[++k] = s[1]; + if (k < m) + pstate[++k] = s[2]; + } + if (k != m) + abort (); + } + pstate[0] = m; + return (size_t)(-2); + + invalid: + errno = EILSEQ; + /* The conversion state is undefined, says POSIX. */ + return (size_t)(-1); + } + else + { + wchar_t wc; + size_t ret = mbrtowc (&wc, s, n, ps); + if (ret < (size_t) -2 && pwc != NULL) + *pwc = wc; + return ret; + } + +# else + + /* char32_t and wchar_t are equivalent. Use mbrtowc(). */ + wchar_t wc; + size_t ret = mbrtowc (&wc, s, n, ps); + +# if GNULIB_MBRTOC32_REGULAR + /* Ensure that mbrtoc32 is regular. */ + if (ret < (size_t) -2 && ! mbsinit (ps)) + /* This occurs on glibc 2.12. */ + mbszero (ps); +# endif + +# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION + if (ret < (size_t) -2 && wc != 0) + { + wc = locale_encoding_to_unicode (wc); + if (wc == 0) + { + ret = (size_t) -1; + errno = EILSEQ; + } + } +# endif + if (ret < (size_t) -2 && pwc != NULL) + *pwc = wc; + return ret; + +# endif +} + +#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 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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 @@ /* Test for initial conversion state. - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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 @@ +/* Counting the multibyte characters in a string. + Copyright (C) 2007-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2007. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#include + +#if GNULIB_MCEL_PREFER +# include "mcel.h" +#else +# include "mbiterf.h" +#endif + +/* Return the number of multibyte characters in the character string starting + at STRING and ending at STRING + LEN. */ +size_t +mbsnlen (const char *string, size_t len) +{ + if (MB_CUR_MAX > 1) + { + size_t count = 0; + + const char *string_end = string + len; + +#if GNULIB_MCEL_PREFER + for (; string < string_end; string += mcel_scan (string, string_end).len) + count++; +#else + mbif_state_t state; + const char *iter; + for (mbif_init (state), iter = string; mbif_avail (state, iter, string_end); ) + { + mbchar_t cur = mbif_next (state, iter, string_end); + count++; + iter += mb_len (cur); + } +#endif + + return count; + } + else + return len; +} 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 @@ /* Put an mbstate_t into an initial conversion state. - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Convert multibyte character to wide character. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 @@ /* Return the internal lock used by mbrtowc and mbrtoc32. - Copyright (C) 2019-2024 Free Software Foundation, Inc. + Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Use the internal lock used by mbrtowc and mbrtoc32. - Copyright (C) 2019-2024 Free Software Foundation, Inc. + Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Convert multibyte character to wide character. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2024 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2025 Free Software Foundation, Inc. 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 @@ # Suppress a valgrind message about use of uninitialized memory in memchr(). -# Copyright (C) 2009-2024 Free Software Foundation, Inc. +# Copyright (C) 2009-2025 Free Software Foundation, Inc. # # This file is free software: you can redistribute it and/or modify # 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 @@ /* MIN, MAX macros. - Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2024 Free Software + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2025 Free Software Foundation, Inc. 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 @@ /* Internals of mktime and related functions - Copyright 2016-2024 Free Software Foundation, Inc. + Copyright 2016-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Eggert . @@ -19,6 +19,9 @@ #ifndef _LIBC # include +# define __libc_lock_lock(lock) ((void) 0) +# define __libc_lock_unlock(lock) ((void) 0) +# define __tzset_unlocked() tzset () #endif /* mktime_offset_t is a signed type wide enough to hold a UTC offset @@ -71,9 +74,10 @@ typedef int mktime_offset_t; #endif /* Subroutine of mktime. Return the time_t representation of TP and - normalize TP, given that a struct tm * maps to a time_t as performed - by FUNC. Record next guess for localtime-gmtime offset in *OFFSET. */ -extern __time64_t __mktime_internal (struct tm *tp, - struct tm *(*func) (__time64_t const *, - struct tm *), + normalize TP, given that a struct tm * maps to a time_t. If + LOCAL, the mapping is performed by localtime_r, otherwise by gmtime_r. + Record next guess for localtime-gmtime offset in *OFFSET. + + If _LIBC, the caller must lock __tzset_lock. */ +extern __time64_t __mktime_internal (struct tm *tp, bool local, 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 @@ /* Convert a 'struct tm' to a time_t value. - Copyright (C) 1993-2024 Free Software Foundation, Inc. + Copyright (C) 1993-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Eggert . @@ -51,7 +51,6 @@ #include #include -#include #ifndef NEED_MKTIME_INTERNAL # define NEED_MKTIME_INTERNAL 0 @@ -63,6 +62,9 @@ # define NEED_MKTIME_WORKING 0 #endif +#ifdef _LIBC +# include +#endif #include "mktime-internal.h" #if !defined _LIBC && (NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS) @@ -99,8 +101,8 @@ my_tzset (void) tzset (); # endif } -# undef __tzset -# define __tzset() my_tzset () +# undef tzset +# define tzset() my_tzset () #endif #if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL @@ -119,12 +121,12 @@ my_tzset (void) __time64_t values that mktime can generate even on platforms where __time64_t is wider than the int components of struct tm. */ -#if INT_MAX <= LONG_MAX / 4 / 366 / 24 / 60 / 60 +# if INT_MAX <= LONG_MAX / 4 / 366 / 24 / 60 / 60 typedef long int long_int; -#else +# else typedef long long int long_int; -#endif -verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60); +# endif +static_assert (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60); /* Shift A right by B bits portably, by dividing A by 2**B and truncating towards minus infinity. B should be in the range 0 <= B @@ -155,9 +157,9 @@ static long_int const mktime_max = (TYPE_MAXIMUM (long_int) < TYPE_MAXIMUM (__time64_t) ? TYPE_MAXIMUM (long_int) : TYPE_MAXIMUM (__time64_t)); -#define EPOCH_YEAR 1970 -#define TM_YEAR_BASE 1900 -verify (TM_YEAR_BASE % 100 == 0); +# define EPOCH_YEAR 1970 +# define TM_YEAR_BASE 1900 +static_assert (TM_YEAR_BASE % 100 == 0); /* Is YEAR + TM_YEAR_BASE a leap year? */ static bool @@ -172,9 +174,9 @@ leapyear (long_int year) } /* How many days come before each month (0-12). */ -#ifndef _LIBC +# ifndef _LIBC static -#endif +# endif const unsigned short int __mon_yday[2][13] = { /* Normal years. */ @@ -206,7 +208,7 @@ static long_int ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1, int year0, int yday0, int hour0, int min0, int sec0) { - verify (-1 / 2 == 0); + static_assert (-1 / 2 == 0); /* Compute intervening leap days correctly even if year is negative. 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, tp->tm_hour, tp->tm_min, tp->tm_sec); } -/* Use CONVERT to convert T to a struct tm value in *TM. T must be in - range for __time64_t. Return TM if successful, NULL (setting errno) on - failure. */ +#ifndef _LIBC +/* Convert T to a struct tm value in *TM. Use localtime64_r if LOCAL, + otherwise gmtime64_r. T must be in range for __time64_t. Return + TM if successful, NULL (setting errno) on failure. */ static struct tm * -convert_time (struct tm *(*convert) (const __time64_t *, struct tm *), - long_int t, struct tm *tm) +convert_time (long_int t, bool local, struct tm *tm) { __time64_t x = t; - return convert (&x, tm); + if (local) + return __localtime64_r (&x, tm); + else + return __gmtime64_r (&x, tm); } +# define __tz_convert convert_time +#endif -/* Use CONVERT to convert *T to a broken down time in *TP. - If *T is out of range for conversion, adjust it so that - it is the nearest in-range value and then convert that. - A value is in range if it fits in both __time64_t and long_int. - Return TP on success, NULL (setting errno) on failure. */ +/* Convert *T to a broken down time in *TP (as if by localtime if + LOCAL, otherwise as if by gmtime). If *T is out of range for + conversion, adjust it so that it is the nearest in-range value and + then convert that. A value is in range if it fits in both + __time64_t and long_int. Return TP on success, NULL (setting + errno) on failure. */ static struct tm * -ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *), - long_int *t, struct tm *tp) +ranged_convert (bool local, long_int *t, struct tm *tp) { long_int t1 = (*t < mktime_min ? mktime_min : *t <= mktime_max ? *t : mktime_max); - struct tm *r = convert_time (convert, t1, tp); + struct tm *r = __tz_convert (t1, local, tp); if (r) { *t = t1; @@ -294,7 +301,7 @@ ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *), long_int mid = long_int_avg (ok, bad); if (mid == ok || mid == bad) break; - if (convert_time (convert, mid, tp)) + if (__tz_convert (mid, local, tp)) ok = mid, oktm = *tp; else if (errno != EOVERFLOW) return NULL; @@ -310,29 +317,38 @@ ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *), } -/* Convert *TP to a __time64_t value, inverting - the monotonic and mostly-unit-linear conversion function CONVERT. - Use *OFFSET to keep track of a guess at the offset of the result, +/* Convert *TP to a __time64_t value. If LOCAL, the reverse mapping + is performed as if localtime, otherwise as if by gmtime. Use + *OFFSET to keep track of a guess at the offset of the result, compared to what the result would be for UTC without leap seconds. - If *OFFSET's guess is correct, only one CONVERT call is needed. - If successful, set *TP to the canonicalized struct tm; + If *OFFSET's guess is correct, only one reverse mapping call is + needed. If successful, set *TP to the canonicalized struct tm; otherwise leave *TP alone, return ((time_t) -1) and set errno. - This function is external because it is used also by timegm.c. */ + This function is external because it is used also by timegm.c. + + If _LIBC, the caller must lock __tzset_lock. */ __time64_t -__mktime_internal (struct tm *tp, - struct tm *(*convert) (const __time64_t *, struct tm *), - mktime_offset_t *offset) +__mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset) { struct tm tm; - /* The maximum number of probes (calls to CONVERT) should be enough - to handle any combinations of time zone rule changes, solar time, - leap seconds, and oscillations around a spring-forward gap. - POSIX.1 prohibits leap seconds, but some hosts have them anyway. */ + /* The maximum number of probes should be enough to handle any + combinations of time zone rule changes, solar time, leap seconds, + and oscillations around a spring-forward gap. POSIX.1 prohibits + leap seconds, but some hosts have them anyway. */ int remaining_probes = 6; - /* Time requested. Copy it in case CONVERT modifies *TP; this can - occur if TP is localtime's returned value and CONVERT is localtime. */ +#ifndef _LIBC + /* Gnulib mktime doesn't lock the tz state, so it may need to probe + more often if some other thread changes local time while + __mktime_internal is probing. Double the number of probes; this + should suffice for practical cases that are at all likely. */ + remaining_probes *= 2; +#endif + + /* Time requested. Copy it in case gmtime/localtime modify *TP; + this can occur if TP is localtime's returned value and CONVERT is + localtime. */ int sec = tp->tm_sec; int min = tp->tm_min; int hour = tp->tm_hour; @@ -341,8 +357,8 @@ __mktime_internal (struct tm *tp, int year_requested = tp->tm_year; int isdst = tp->tm_isdst; - /* 1 if the previous probe was DST. */ - int dst2 = 0; + /* True if the previous probe was DST. */ + bool dst2 = false; /* Ensure that mon is in range, and set year accordingly. */ int mon_remainder = mon % 12; @@ -390,7 +406,7 @@ __mktime_internal (struct tm *tp, while (true) { - if (! ranged_convert (convert, &t, &tm)) + if (! ranged_convert (local, &t, &tm)) return -1; long_int dt = tm_diff (year, yday, hour, min, sec, &tm); if (dt == 0) @@ -431,13 +447,10 @@ __mktime_internal (struct tm *tp, Heuristic: probe the adjacent timestamps in both directions, looking for the desired isdst. If none is found within a - reasonable duration bound, assume a one-hour DST difference. + reasonable duration bound, ignore the disagreement. This should work for all real time zone histories in the tz database. */ - /* +1 if we wanted standard time but got DST, -1 if the reverse. */ - int dst_difference = (isdst == 0) - (tm.tm_isdst == 0); - /* Distance between probes when looking for a DST boundary. In tzdata2003a, the shortest period of DST is 601200 seconds (e.g., America/Recife starting 2000-10-08 01:00), and the @@ -447,21 +460,17 @@ __mktime_internal (struct tm *tp, periods when probing. */ int stride = 601200; - /* In TZDB 2021e, the longest period of DST (or of non-DST), in - which the DST (or adjacent DST) difference is not one hour, - is 457243209 seconds: e.g., America/Cambridge_Bay with leap - seconds, starting 1965-10-31 00:00 in a switch from - double-daylight time (-05) to standard time (-07), and - continuing to 1980-04-27 02:00 in a switch from standard time - (-07) to daylight time (-06). */ - int duration_max = 457243209; - - /* Search in both directions, so the maximum distance is half - the duration; add the stride to avoid off-by-1 problems. */ - int delta_bound = duration_max / 2 + stride; + /* Do not probe too far away from the requested time, + by striding until at least a year has passed, but then giving up. + This helps avoid unexpected results in (for example) Asia/Kolkata, + for which today's users expect to see no DST even though it + did observe DST long ago. */ + int year_seconds_bound = 366 * 24 * 60 * 60 + 1; + int delta_bound = year_seconds_bound + stride; int delta, direction; + /* Search in both directions, closest first. */ for (delta = stride; delta < delta_bound; delta += stride) for (direction = -1; direction <= 1; direction += 2) { @@ -469,7 +478,7 @@ __mktime_internal (struct tm *tp, if (! ckd_add (&ot, t, delta * direction)) { struct tm otm; - if (! ranged_convert (convert, &ot, &otm)) + if (! ranged_convert (local, &ot, &otm)) return -1; if (! isdst_differ (isdst, otm.tm_isdst)) { @@ -479,7 +488,7 @@ __mktime_internal (struct tm *tp, &otm); if (mktime_min <= gt && gt <= mktime_max) { - if (convert_time (convert, gt, &tm)) + if (__tz_convert (gt, local, &tm)) { t = gt; goto offset_found; @@ -491,13 +500,8 @@ __mktime_internal (struct tm *tp, } } - /* No unusual DST offset was found nearby. Assume one-hour DST. */ - t += 60 * 60 * dst_difference; - if (mktime_min <= t && t <= mktime_max && convert_time (convert, t, &tm)) - goto offset_found; - - __set_errno (EOVERFLOW); - return -1; + /* No probe with the requested tm_isdst was found nearby. + Ignore the requested tm_isdst. */ } offset_found: @@ -520,7 +524,7 @@ __mktime_internal (struct tm *tp, __set_errno (EOVERFLOW); return -1; } - if (! convert_time (convert, t, &tm)) + if (! __tz_convert (t, local, &tm)) return -1; } @@ -536,18 +540,19 @@ __mktime_internal (struct tm *tp, __time64_t __mktime64 (struct tm *tp) { - /* POSIX.1 8.1.1 requires that whenever mktime() is called, the - time zone names contained in the external variable 'tzname' shall - be set as if the tzset() function had been called. */ - __tzset (); + __libc_lock_lock (__tzset_lock); + __tzset_unlocked (); # if defined _LIBC || NEED_MKTIME_WORKING static mktime_offset_t localtime_offset; - return __mktime_internal (tp, __localtime64_r, &localtime_offset); + __time64_t result = __mktime_internal (tp, true, &localtime_offset); # else # undef mktime - return mktime (tp); + __time64_t result = mktime (tp); # endif + + __libc_lock_unlock (__tzset_lock); + return result; } #endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */ 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 @@ /* mountlist.c -- return a list of mounted file systems - Copyright (C) 1991-1992, 1997-2024 Free Software Foundation, Inc. + Copyright (C) 1991-1992, 1997-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,20 +19,18 @@ #include "mountlist.h" +#include +#include #include #include #include #include #include +#include +#include "c-ctype.h" #include "xalloc.h" -#include - -#include - -#include - #if HAVE_SYS_PARAM_H # include #endif @@ -132,6 +130,10 @@ # endif #endif +#if defined _WIN32 && !defined __CYGWIN__ +# include +#endif + #ifndef HAVE_HASMNTOPT # define hasmntopt(mnt, opt) ((char *) 0) #endif @@ -396,15 +398,18 @@ dev_from_mount_options (char const *mount_options) if (devopt) { char const *optval = devopt + sizeof dev_pattern - 1; - char *optvalend; - unsigned long int dev; - errno = 0; - dev = strtoul (optval, &optvalend, 16); - if (optval != optvalend - && (*optvalend == '\0' || *optvalend == ',') - && ! (dev == ULONG_MAX && errno == ERANGE) - && dev == (dev_t) dev) - return dev; + if (c_isxdigit (*optval)) + { + char *optvalend; + unsigned long int dev; + errno = 0; + dev = strtoul (optval, &optvalend, 16); + if (optval != optvalend + && (*optvalend == '\0' || *optvalend == ',') + && ! (dev == ULONG_MAX && errno == ERANGE) + && dev == (dev_t) dev) + return dev; + } } # endif @@ -452,12 +457,8 @@ terminate_at_blank (char *str) *s = '\0'; return s; } -#endif -/* Return a list of the currently mounted file systems, or NULL on error. - Add each entry to the tail of the list so that they stay in order. - If NEED_FS_TYPE is true, ensure that the file system type fields in - the returned list are valid. Otherwise, they might not be. */ +#endif struct mount_entry * read_file_system_list (bool need_fs_type) @@ -567,7 +568,7 @@ read_file_system_list (bool need_fs_type) goto free_then_fail; } else /* fallback to /proc/self/mounts (/etc/mtab). */ -# endif /* __linux __ || __ANDROID__ */ +# endif /* __linux__ || __ANDROID__ */ { struct mntent *mnt; char const *table = MOUNTED; @@ -883,7 +884,9 @@ read_file_system_list (bool need_fs_type) me->me_mntroot = NULL; me->me_type = xstrdup (mnt.mnt_fstype); me->me_type_malloced = 1; - me->me_dummy = MNT_IGNORE (&mnt) != 0; + /* The cast from 'struct extmnttab *' to 'struct mnttab *' is OK + because 'struct extmnttab' extends 'struct mnttab'. */ + me->me_dummy = MNT_IGNORE ((struct mnttab *) &mnt) != 0; me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_dev = makedev (mnt.mnt_major, mnt.mnt_minor); @@ -1092,6 +1095,201 @@ read_file_system_list (bool need_fs_type) } #endif /* MOUNTED_INTERIX_STATVFS */ +#if defined _WIN32 && !defined __CYGWIN__ /* native Windows */ +/* Don't assume that UNICODE is not defined. */ +# undef GetDriveType +# define GetDriveType GetDriveTypeA +# undef GetVolumeInformation +# define GetVolumeInformation GetVolumeInformationA + { + /* Windows has drive prefixes which are similar to mount points. + GetLogicalDrives returns a bitmask where the i-th bit is set + if ASCII 'A' + i is an available drive. See: + . */ + DWORD value = GetLogicalDrives (); + unsigned int i; + + for (i = 0; i < 26; ++i) + { + if (value & (1U << i)) + { + char mountdir[4]; + char fs_name[MAX_PATH + 1]; + mountdir[0] = 'A' + i; + mountdir[1] = ':'; + mountdir[2] = '\\'; + mountdir[3] = '\0'; + /* Test whether the drive actually exists, and + get the name of the file system. See: + . */ + if (GetVolumeInformation (mountdir, NULL, 0, NULL, NULL, NULL, + fs_name, sizeof fs_name)) + { + me = xmalloc (sizeof *me); + me->me_mountdir = xstrdup (mountdir); + /* Check if drive is remote. See: + . */ + me->me_remote = GetDriveType (mountdir) == DRIVE_REMOTE; + /* Here we could use + QueryDosDeviceW -> returns something like '\Device\HarddiskVolume2' + GetVolumeNameForVolumeMountPointW -> return something like '\\?\Volume{...}' + */ + me->me_devname = NULL; + { + /* Find the SUBST or NET USE mapping of the given drive. + + For testing of SUBST: + For testing of NET USE: */ + wchar_t drive[3]; + wchar_t mapping[MAX_PATH + 1]; + drive[0] = L'A' + i; + drive[1] = L':'; + drive[2] = L'\0'; + DWORD mapping_len = QueryDosDeviceW (drive, mapping, sizeof (mapping) / sizeof (mapping[0])); + if (mapping_len > 4 && wcsncmp (mapping, L"\\??\\", 4) == 0) + { + /* It's a SUBSTed drive. */ + char subst_dir[MAX_PATH + 1]; + size_t subst_dir_len = wcstombs (subst_dir, mapping + 4, sizeof (subst_dir)); + if (subst_dir_len > 0 && subst_dir_len <= MAX_PATH) + me->me_mntroot = xstrdup (subst_dir); + else + /* mapping is too long or not convertible to the + locale encoding. */ + me->me_mntroot = NULL; + } + else if (mapping_len > 26 + && wcsncmp (mapping, L"\\Device\\LanmanRedirector\\;", 26) == 0) + { + wchar_t *next_backslash = wcschr (mapping + 26, L'\\'); + if (next_backslash != NULL) + { + *--next_backslash = L'\\'; + char share_dir[MAX_PATH + 1]; + size_t share_dir_len = wcstombs (share_dir, next_backslash, sizeof (share_dir)); + if (share_dir_len > 0 && share_dir_len <= MAX_PATH) + me->me_mntroot = xstrdup (share_dir); + else + /* mapping is too long or not convertible to the + locale encoding. */ + me->me_mntroot = NULL; + } + else + /* mapping does not have the expected form. */ + me->me_mntroot = NULL; + } + else + /* It's neither a SUBSTed nor a NET USEd drive. */ + me->me_mntroot = NULL; + } + me->me_dev = (dev_t) -1; + me->me_dummy = 0; + me->me_type = xstrdup (fs_name); + me->me_type_malloced = 1; + + /* Add to the linked list. */ + *mtail = me; + mtail = &me->me_next; + } + } + } + } + { + /* Windows also has true mount points, called "mounted folders". See + + For testing: */ + /* Enumerate the volumes. See + + + */ + wchar_t vol_name[MAX_PATH + 1]; + HANDLE h = FindFirstVolumeW (vol_name, sizeof (vol_name) / sizeof (vol_name[0])); + if (h != INVALID_HANDLE_VALUE) + { + do + { + /* Look where the volume vol_name is mounted. + There are two APIs for doing this: + - FindFirstVolumeMountPointW, FindNextVolumeMountPointW, + FindVolumeMountPointClose. This API always fails with + error code ERROR_ACCESS_DENIED. + - GetVolumePathNamesForVolumeNameW. This API works but + may require a significantly larger buffer. + */ + wchar_t stack_buf[MAX_PATH + 2]; + wchar_t *malloced_buf = NULL; + wchar_t *buf = stack_buf; + DWORD bufsize = sizeof (stack_buf) / sizeof (wchar_t); + BOOL success; + for (;;) + { + success = GetVolumePathNamesForVolumeNameW (vol_name, buf, bufsize, &bufsize); + if (!success && GetLastError () == ERROR_MORE_DATA) + { + free (malloced_buf); + malloced_buf = (wchar_t *) xmalloc (bufsize * sizeof (wchar_t)); + buf = malloced_buf; + } + else + break; + } + if (success) + { + wchar_t *mount_dir = buf; + while (*mount_dir != L'\0') + { + /* Drive mounts are already handled above. */ + if (!(mount_dir[0] >= L'A' && mount_dir[0] <= L'Z' + && mount_dir[1] == L':' && mount_dir[2] == L'\\' + && mount_dir[3] == L'\0')) + { + char mountdir[MAX_PATH + 1]; + size_t mountdir_len = wcstombs (mountdir, mount_dir, sizeof (mountdir)); + if (mountdir_len > 0 && mountdir_len <= MAX_PATH) + { + char fs_name[MAX_PATH + 1]; + /* Get the name of the file system. See: + . */ + if (GetVolumeInformation (mountdir, NULL, 0, NULL, NULL, NULL, + fs_name, sizeof fs_name)) + { + me = xmalloc (sizeof *me); + me->me_mountdir = xstrdup (mountdir); + me->me_remote = false; + /* Here we could use vol_name, something like '\\?\Volume{...}'. */ + me->me_devname = NULL; + me->me_mntroot = NULL; + me->me_dev = (dev_t) -1; + me->me_dummy = 0; + me->me_type = xstrdup (fs_name); + me->me_type_malloced = 1; + + /* Add to the linked list. */ + *mtail = me; + mtail = &me->me_next; + } + } + else + { + /* mount_dir is too long or not convertible to the + locale encoding. */ + } + } + mount_dir += wcslen (mount_dir) + 1; + } + } + free (malloced_buf); + } + while (FindNextVolumeW (h, vol_name, sizeof (vol_name) / sizeof (vol_name[0]))); + FindVolumeClose (h); + } + } +#endif + +#if MOUNTED_NOT_PORTED +# error "Please port gnulib mountlist.c to your platform!" +#endif + *mtail = NULL; return mount_list; 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 @@ /* mountlist.h -- declarations for list of mounted file systems - Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2024 Free Software + Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -46,8 +46,13 @@ struct mount_entry struct mount_entry *me_next; }; +/* Return a list of the currently mounted file systems, or NULL on error. + Add each entry to the tail of the list so that they stay in order. + If NEED_FS_TYPE is true, ensure that the file system type fields in + the returned list are valid. Otherwise, they might not be. */ struct mount_entry *read_file_system_list (bool need_fs_type) _GL_ATTRIBUTE_MALLOC; + void free_mount_entry (struct mount_entry *entry); 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 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Provide a netdb.h header file for systems lacking it (read: MinGW). - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. Written by Simon Josefsson. This file is free software: you can redistribute it and/or modify @@ -54,6 +54,14 @@ /* Declarations for a platform that lacks , or where it is incomplete. */ +/* Maximum length of a fully-qualified domain name. */ +#undef NI_MAXHOST +#define NI_MAXHOST 1025 + +/* Maximum length of a service. */ +#undef NI_MAXSERV +#define NI_MAXSERV 32 + #if @GNULIB_GETADDRINFO@ # if !@HAVE_STRUCT_ADDRINFO@ @@ -91,12 +99,11 @@ struct addrinfo # ifndef AI_CANONNAME # define AI_CANONNAME 0x0002 /* Request for canonical name. */ # endif -# ifndef AI_NUMERICSERV -# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ +# ifndef AI_NUMERICHOST +# define AI_NUMERICHOST 0x0004 /* Return numeric host address as name. */ # endif - -# if 0 -# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ +# ifndef AI_NUMERICSERV +# define AI_NUMERICSERV 0x0400 /* Return service number as service name. */ # endif /* These symbolic constants are required to be present by POSIX, but @@ -176,7 +183,7 @@ _GL_FUNCDECL_RPL (getaddrinfo, int, (const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, - struct addrinfo **restrict res) + struct addrinfo **restrict res), _GL_ARG_NONNULL ((4))); _GL_CXXALIAS_RPL (getaddrinfo, int, (const char *restrict nodename, @@ -189,7 +196,7 @@ _GL_FUNCDECL_SYS (getaddrinfo, int, (const char *restrict nodename, const char *restrict servname, const struct addrinfo *restrict hints, - struct addrinfo **restrict res) + struct addrinfo **restrict res), _GL_ARG_NONNULL ((4))); # endif _GL_CXXALIAS_SYS (getaddrinfo, int, @@ -208,12 +215,12 @@ _GL_CXXALIASWARN (getaddrinfo); # undef freeaddrinfo # define freeaddrinfo rpl_freeaddrinfo # endif -_GL_FUNCDECL_RPL (freeaddrinfo, void, (struct addrinfo *ai) +_GL_FUNCDECL_RPL (freeaddrinfo, void, (struct addrinfo *ai), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (freeaddrinfo, void, (struct addrinfo *ai)); # else # if !@HAVE_DECL_FREEADDRINFO@ -_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai) +_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai)); @@ -225,14 +232,14 @@ _GL_CXXALIASWARN (freeaddrinfo); # undef gai_strerror # define gai_strerror rpl_gai_strerror # endif -_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode)); +_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode), ); _GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode)); # else # if !@HAVE_DECL_GAI_STRERROR@ /* Convert error return from getaddrinfo() to a string. For more details, see the POSIX:2008 specification . */ -_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode)); +_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode), ); # endif _GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode)); # endif @@ -248,7 +255,7 @@ _GL_FUNCDECL_SYS (getnameinfo, int, (const struct sockaddr *restrict sa, socklen_t salen, char *restrict node, socklen_t nodelen, char *restrict service, socklen_t servicelen, - int flags) + int flags), _GL_ARG_NONNULL ((1))); # endif /* 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 @@ /* Substitute for . - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Return the internal lock used by nl_langinfo. - Copyright (C) 2019-2024 Free Software Foundation, Inc. + Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* nl_langinfo() replacement: query locale dependent information. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -154,11 +154,15 @@ ctype_codeset (void) "thread5 disturbed by threadN!", even when threadN invokes only nl_langinfo (CODESET); nl_langinfo (CRNCYSTR); - Similarly on Solaris 10. */ + Similarly on Solaris 10 and macOS 26. */ -# if !NL_LANGINFO_MTSAFE /* Solaris */ +# if !NL_LANGINFO_MTSAFE /* macOS, Solaris */ -# define ITEMS (MAXSTRMSG + 1) +# ifdef __sun /* Solaris */ +# define ITEMS (MAXSTRMSG + 1) +# else /* macOS */ +# define ITEMS (CRNCYSTR + 20) +# endif # define MAX_RESULT_LEN 80 static char * @@ -317,6 +321,24 @@ rpl_nl_langinfo (nl_item item) item = item - ALTMON_1 + MON_1; break; # endif +# if GNULIB_defined_ABALTMON + case ABALTMON_1: + case ABALTMON_2: + case ABALTMON_3: + case ABALTMON_4: + case ABALTMON_5: + case ABALTMON_6: + case ABALTMON_7: + case ABALTMON_8: + case ABALTMON_9: + case ABALTMON_10: + case ABALTMON_11: + case ABALTMON_12: + /* We don't ship the appropriate localizations with gnulib. Therefore, + treat ABALTMON_i like ABMON_i. */ + item = item - ABALTMON_1 + ABMON_1; + break; +# endif # if GNULIB_defined_ERA case ERA: /* The format is not standardized. In glibc it is a sequence of strings @@ -510,30 +532,57 @@ nl_langinfo (nl_item item) return result[item - ALTMON_1]; } } - case ABMON_1: - case ABMON_2: - case ABMON_3: - case ABMON_4: - case ABMON_5: - case ABMON_6: - case ABMON_7: - case ABMON_8: - case ABMON_9: - case ABMON_10: - case ABMON_11: - case ABMON_12: - { - static char result[12][30]; - static char const abmonths[][sizeof "Jan"] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", - "Aug", "Sep", "Oct", "Nov", "Dec" - }; - tmm.tm_mon = item - ABMON_1; - if (!strftime (buf, sizeof result[0], "%b", &tmm)) - return (char *) abmonths[item - ABMON_1]; - strcpy (result[item - ABMON_1], buf); - return result[item - ABMON_1]; - } + { + static char const abmonths[][sizeof "Jan"] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", + "Aug", "Sep", "Oct", "Nov", "Dec" + }; + case ABMON_1: + case ABMON_2: + case ABMON_3: + case ABMON_4: + case ABMON_5: + case ABMON_6: + case ABMON_7: + case ABMON_8: + case ABMON_9: + case ABMON_10: + case ABMON_11: + case ABMON_12: + { + static char result[12][30]; + tmm.tm_mon = item - ABMON_1; + if (!strftime (buf, sizeof result[0], "%b", &tmm)) + return (char *) abmonths[item - ABMON_1]; + strcpy (result[item - ABMON_1], buf); + return result[item - ABMON_1]; + } + case ABALTMON_1: + case ABALTMON_2: + case ABALTMON_3: + case ABALTMON_4: + case ABALTMON_5: + case ABALTMON_6: + case ABALTMON_7: + case ABALTMON_8: + case ABALTMON_9: + case ABALTMON_10: + case ABALTMON_11: + case ABALTMON_12: + { + static char result[12][50]; + tmm.tm_mon = item - ABALTMON_1; + /* The platforms without nl_langinfo() don't support strftime with + %Ob. We don't even need to try. */ + #if 0 + if (!strftime (buf, sizeof result[0], "%Ob", &tmm)) + #endif + if (!strftime (buf, sizeof result[0], "%b", &tmm)) + return (char *) abmonths[item - ABALTMON_1]; + strcpy (result[item - ABALTMON_1], buf); + return result[item - ABALTMON_1]; + } + } case ERA: return (char *) ""; 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 @@ /* Open a descriptor to a file. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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) #include #include +#ifndef HAVE_WORKING_O_DIRECTORY +# define HAVE_WORKING_O_DIRECTORY false +#endif + +#ifndef OPEN_TRAILING_SLASH_BUG +# define OPEN_TRAILING_SLASH_BUG false +#endif + #ifndef REPLACE_OPEN_DIRECTORY -# define REPLACE_OPEN_DIRECTORY 0 +# define REPLACE_OPEN_DIRECTORY false #endif +static int +lstatif (char const *filename, struct stat *st, int flags) +{ + return flags & O_NOFOLLOW ? lstat (filename, st) : stat (filename, st); +} + int open (const char *filename, int flags, ...) { - /* 0 = unknown, 1 = yes, -1 = no. */ -#if GNULIB_defined_O_CLOEXEC - int have_cloexec = -1; -#else - static int have_cloexec; -#endif - - mode_t mode; - int fd; + mode_t mode = 0; - mode = 0; if (flags & O_CREAT) { va_list arg; @@ -99,7 +104,6 @@ open (const char *filename, int flags, ...) filename = "NUL"; #endif -#if OPEN_TRAILING_SLASH_BUG /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename ends in a slash, as POSIX says such a filename must name a directory : @@ -118,21 +122,55 @@ open (const char *filename, int flags, ...) directories, - if O_WRONLY or O_RDWR is specified, open() must fail because the file does not contain a '.' directory. */ - if ((flags & O_CREAT) - || (flags & O_ACCMODE) == O_RDWR - || (flags & O_ACCMODE) == O_WRONLY) + bool check_for_slash_bug; + if (OPEN_TRAILING_SLASH_BUG) { size_t len = strlen (filename); - if (len > 0 && filename[len - 1] == '/') + check_for_slash_bug = len && filename[len - 1] == '/'; + } + else + check_for_slash_bug = false; + + if (check_for_slash_bug + && (flags & O_CREAT + || (flags & O_ACCMODE) == O_RDWR + || (flags & O_ACCMODE) == O_WRONLY)) + { + errno = EISDIR; + return -1; + } + + /* With the trailing slash bug or without working O_DIRECTORY, check with + stat first lest we hang trying to open a fifo. Although there is + a race between this and opening the file, we can do no better. + After opening the file we will check again with fstat. */ + bool check_directory = + (check_for_slash_bug + || (!HAVE_WORKING_O_DIRECTORY && flags & O_DIRECTORY)); + if (check_directory) + { + struct stat statbuf; + if (lstatif (filename, &statbuf, flags) < 0) + { + if (! (flags & O_CREAT && errno == ENOENT)) + return -1; + } + else if (!S_ISDIR (statbuf.st_mode)) { - errno = EISDIR; + errno = ENOTDIR; return -1; } } + + /* 0 = unknown, 1 = yes, -1 = no. */ +#if GNULIB_defined_O_CLOEXEC + int have_cloexec = -1; +#else + static int have_cloexec; #endif - fd = orig_open (filename, - flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode); + int fd = orig_open (filename, + flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode); if (flags & O_CLOEXEC) { @@ -154,19 +192,21 @@ open (const char *filename, int flags, ...) #if REPLACE_FCHDIR /* Implementing fchdir and fdopendir requires the ability to open a directory file descriptor. If open doesn't support that (as on - mingw), we use a dummy file that behaves the same as directories + mingw), use a dummy file that behaves the same as directories on Linux (ie. always reports EOF on attempts to read()), and - override fstat() in fchdir.c to hide the fact that we have a - dummy. */ + override fstat in fchdir.c to hide the dummy. */ if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES - && ((flags & O_ACCMODE) == O_RDONLY - || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH))) + && ((flags & (O_ACCMODE | O_CREAT)) == O_RDONLY + || (O_SEARCH != O_RDONLY + && (flags & (O_ACCMODE | O_CREAT)) == O_SEARCH))) { struct stat statbuf; - if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) + if (check_directory + || (lstatif (filename, &statbuf, flags) == 0 + && S_ISDIR (statbuf.st_mode))) { /* Maximum recursion depth of 1. */ - fd = open ("/dev/null", flags, mode); + fd = open ("/dev/null", flags & ~O_DIRECTORY, mode); if (0 <= fd) fd = _gl_register_fd (fd, filename); } @@ -175,10 +215,8 @@ open (const char *filename, int flags, ...) } #endif -#if OPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and fd does not refer to a directory, - then fail. - Rationale: POSIX says such a filename must name a directory + /* If checking for directories, fail if fd does not refer to a directory. + Rationale: A filename ending in slash cannot name a non-directory : "A pathname that contains at least one non- character and that ends with one or more trailing characters shall not be resolved @@ -186,23 +224,18 @@ open (const char *filename, int flags, ...) characters names an existing directory" If the named file without the slash is not a directory, open() must fail with ENOTDIR. */ - if (fd >= 0) + if (check_directory && 0 <= fd) { - /* We know len is positive, since open did not fail with ENOENT. */ - size_t len = strlen (filename); - if (filename[len - 1] == '/') + struct stat statbuf; + int r = fstat (fd, &statbuf); + if (r < 0 || !S_ISDIR (statbuf.st_mode)) { - struct stat statbuf; - - if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) - { - close (fd); - errno = ENOTDIR; - return -1; - } + int err = r < 0 ? errno : ENOTDIR; + close (fd); + errno = err; + return -1; } } -#endif #if REPLACE_FCHDIR 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 @@ /* Define PATH_MAX somehow. Requires sys/types.h. - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2024 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2025 Free Software Foundation, Inc. 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 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2024 Free Software + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify @@ -32,6 +32,9 @@ /* Get INT_WIDTH. */ #include +/* Get abort(). */ +#include + #ifdef STATIC STATIC #endif @@ -198,7 +201,6 @@ PRINTF_FETCHARGS (va_list args, arguments *a) if (ap->a.a_string == NULL) ap->a.a_string = "(NULL)"; break; -#if HAVE_WCHAR_T case TYPE_WIDE_STRING: ap->a.a_wide_string = va_arg (args, const wchar_t *); /* A null pointer is an invalid argument for "%ls", but in practice @@ -216,7 +218,6 @@ PRINTF_FETCHARGS (va_list args, arguments *a) ap->a.a_wide_string = wide_null_string; } break; -#endif case TYPE_POINTER: ap->a.a_pointer = va_arg (args, void *); break; @@ -298,9 +299,19 @@ PRINTF_FETCHARGS (va_list args, arguments *a) } break; #endif - default: - /* Unknown type. */ + case TYPE_NONE: + /* Argument i is not used by any directive, but some argument with + number > i is used by a format directive. POSIX says that this + is invalid: + "When numbered argument specifications are used, specifying the + Nth argument requires that all the leading arguments, from the + first to the (N-1)th, are specified in the format string." + The reason is that we cannot know how many bytes to skip in the + va_arg sequence. */ return -1; + default: + /* Unknown type. Should not happen. */ + abort (); } return 0; } 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 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2024 Free Software + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify @@ -28,14 +28,9 @@ # define PRINTF_FETCHARGS printf_fetchargs #endif -/* Get size_t. */ +/* Get size_t, wchar_t. */ #include -/* Get wchar_t. */ -#if HAVE_WCHAR_T -# include -#endif - /* Get wint_t. */ #if HAVE_WINT_T # include @@ -89,9 +84,7 @@ typedef enum TYPE_WIDE_CHAR, #endif TYPE_STRING, -#if HAVE_WCHAR_T TYPE_WIDE_STRING, -#endif TYPE_POINTER, TYPE_COUNT_SCHAR_POINTER, TYPE_COUNT_SHORT_POINTER, @@ -154,9 +147,7 @@ typedef struct wint_t a_wide_char; #endif const char* a_string; -#if HAVE_WCHAR_T const wchar_t* a_wide_string; -#endif void* a_pointer; signed char * a_count_schar_pointer; 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 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2024 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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) if (signed_type == TYPE_LONGINT /* For backward compatibility only. */ || signed_type == TYPE_LONGLONGINT) -#if HAVE_WCHAR_T type = TYPE_WIDE_STRING; -#else - goto error; -#endif else type = TYPE_STRING; break; -#if HAVE_WCHAR_T case 'S': type = TYPE_WIDE_STRING; c = 's'; break; -#endif case 'p': type = TYPE_POINTER; 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 @@ /* Parse printf format string. - Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2024 Free Software + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2025 Free Software Foundation, Inc. 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 @@ +/* POSIX once-only control. + Copyright (C) 2019-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2019. */ + +#include + +/* Specification. */ +#include + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# include "windows-once.h" +#endif + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +/* Use Windows threads. */ + +int +pthread_once (pthread_once_t *once_control, void (*initfunction) (void)) +{ + glwthread_once (once_control, initfunction); + return 0; +} + +#elif HAVE_PTHREAD_H +/* Provide workarounds for POSIX threads. */ + +# if defined __CYGWIN__ + +# include + +int +pthread_once (pthread_once_t *once_control, void (*initfunction) (void)) +{ + /* In this implementation, we reuse the type + typedef struct { pthread_mutex_t mutex; int state; } pthread_once_t; + #define PTHREAD_ONCE_INIT { PTHREAD_MUTEX_INITIALIZER, 0 } + while assigning the following meaning to the state: + state = ( << 16) + <1 if done> + In other words: + state = { unsigned int num_threads : 16; unsigned int done : 16; } + */ + struct actual_state + { + _Atomic unsigned short num_threads; + /* done == 0: initial state + done == 1: initfunction executed, lock still active + done == 2: initfunction executed, lock no longer usable */ + _Atomic unsigned short done; + }; + struct actual_state *state_p = (struct actual_state *) &once_control->state; + /* This test is not necessary. It's only an optimization, to establish + a fast path for the common case that the 'done' word is already > 0. */ + if (state_p->done == 0) + { + /* Increment num_threads (atomically), to indicate that this thread will + possibly take the lock. */ + state_p->num_threads += 1; + /* Test the 'done' word. */ + if (state_p->done == 0) + { + /* The 'done' word is still zero. Now take the lock. */ + pthread_mutex_lock (&once_control->mutex); + /* Test the 'done' word again. */ + if (state_p->done == 0) + { + /* Execute the initfunction. */ + (*initfunction) (); + /* Set the 'done' word to 1 (atomically). */ + state_p->done = 1; + } + /* Now the 'done' word is 1. Release the lock. */ + pthread_mutex_unlock (&once_control->mutex); + } + /* Here, done is > 0. */ + /* Decrement num_threads (atomically). */ + if ((state_p->num_threads -= 1) == 0) + { + /* num_threads is now zero, and done is > 0. + No other thread will need to use the lock. + We can therefore destroy the lock, to free resources. */ + if (__sync_bool_compare_and_swap (&state_p->done, 1, 2)) + pthread_mutex_destroy (&once_control->mutex); + } + } + /* Proof of correctness: + * num_threads is incremented and then decremented by some threads. + Therefore, num_threads always stays >= 0, and is == 0 at the end. + * The 'done' word, once > 0, stays > 0 (since it is never assigned 0). + * The 'done' word is changed from == 0 to > 0 only while the lock + is taken. Therefore, only the first thread that succeeds in taking + the lock executes the initfunction and sets the 'done' word to a + value > 0; the other threads that take the lock do no side effects + between taking and releasing the lock. + * The 'done' word does not change any more once it is 2. + Therefore, it can be changed from 1 to 2 only once. + * pthread_mutex_destroy gets invoked right after 'done' has been changed + from 1 to 2. Therefore, pthread_mutex_destroy gets invoked only once. + * After a moment where num_threads was 0 and done was > 0, no thread can + reach the pthread_mutex_lock invocation. Proof: + - At such a moment, no thread is in the code range between + state_p->num_threads += 1 + and + state_p->num_threads -= 1 + - After such a moment, some thread can increment num_threads, but from + there they cannot reach the pthread_mutex_lock invocation, because the + if (state_p->done == 0) + test prevents that. + * From this it follows that: + - pthread_mutex_destroy cannot be executed while the lock is taken + (because pthread_mutex_destroy is only executed after a moment where + num_threads was 0 and done was > 0). + - Once pthread_mutex_destroy has been executed, the lock is not used any + more. + */ + return 0; +} + +# endif + +#else +/* Provide a dummy implementation for single-threaded applications. */ + +int +pthread_once (pthread_once_t *once_control, void (*initfunction) (void)) +{ + if (*once_control == 0) + { + *once_control = ~ 0; + initfunction (); + } + return 0; +} + +#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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Implement the most essential subset of POSIX pthread.h. + + Copyright (C) 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Paul Eggert, Glen Lenker, and Bruno Haible. */ + +#if __GNUC__ >= 3 +#pragma GCC system_header +#endif + + +#if defined _GL_ALREADY_INCLUDING_PTHREAD_H +/* Special invocation convention: + On Android, we have a sequence of nested includes + -> -> -> -> + -> . + In this situation, PTHREAD_COND_INITIALIZER is not yet defined, + therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc. */ + +#include_next + +#else +/* Normal invocation convention. */ + +#ifndef _GL_PTHREAD_H_ + +#if 1 + +# define _GL_ALREADY_INCLUDING_PTHREAD_H + +/* The include_next requires a split double-inclusion guard. */ +# include_next + +# undef _GL_ALREADY_INCLUDING_PTHREAD_H + +#endif + +#ifndef _GL_PTHREAD_H_ +#define _GL_PTHREAD_H_ + +/* This file uses _Noreturn, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, + HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#define __need_system_stdlib_h +#include +#undef __need_system_stdlib_h + + +/* The pthreads-win32 defines a couple of broken macros. */ +#undef asctime_r +#undef ctime_r +#undef gmtime_r +#undef localtime_r +#undef rand_r +#undef strtok_r + +#include +#include +#include +#include + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ +/* C++ compatible function declaration macros. + Copyright (C) 2010-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _GL_CXXDEFS_H +#define _GL_CXXDEFS_H + +/* Begin/end the GNULIB_NAMESPACE namespace. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { +# define _GL_END_NAMESPACE } +#else +# define _GL_BEGIN_NAMESPACE +# define _GL_END_NAMESPACE +#endif + +/* The three most frequent use cases of these macros are: + + * For providing a substitute for a function that is missing on some + platforms, but is declared and works fine on the platforms on which + it exists: + + #if @GNULIB_FOO@ + # if !@HAVE_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on all platforms, + but is broken/insufficient and needs to be replaced on some platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on some platforms + but is broken/insufficient and needs to be replaced on some of them and + is additionally either missing or undeclared on some other platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif +*/ + +/* _GL_EXTERN_C declaration; + performs the declaration with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C extern "C" +#else +# define _GL_EXTERN_C extern +#endif + +/* _GL_EXTERN_C_FUNC declaration; + performs the declaration of a function with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C_FUNC extern "C" +#else +/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax + are not allowed between 'extern' and the return type (see gnulib-common.m4). + */ +# define _GL_EXTERN_C_FUNC +#endif + +/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]); + declares a replacement function, named rpl_func, with the given prototype, + consisting of return type, parameters, and attributes. + Although attributes are optional, the comma before them is required + for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, + if needed, must be placed after the _GL_FUNCDECL_RPL invocation, + at the end of the declaration. + Examples: + _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW; + _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...), + _GL_ARG_NONNULL ((1))); + + Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front + of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's + because + [[...]] extern "C" ; + is invalid syntax in C++.) + */ +#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \ + _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__) +#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters + +/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to + parenthesized func otherwise. Parenthesization is needed in C23 if + the function is like strchr and so is a qualifier-generic macro + that expands to something more complicated. */ +#ifdef __cplusplus +# define _GL_FUNCDECL_SYS_NAME(func) func +#else +# define _GL_FUNCDECL_SYS_NAME(func) (func) +#endif + +/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); + declares the system function, named func, with the given prototype, + consisting of return type, parameters, and attributes. + Although attributes are optional, the comma before them is required + for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, + if needed, must be placed after the _GL_FUNCDECL_RPL invocation, + at the end of the declaration. + Examples: + _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW; + _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); + */ +#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters + +/* _GL_CXXALIAS_RPL (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to rpl_func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); + + Wrapping rpl_func in an object with an inline conversion operator + avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_MDA (func, rettype, parameters); + is to be used when func is a Microsoft deprecated alias, on native Windows. + It declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to _func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); + */ +#define _GL_CXXALIAS_MDA(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) + +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the "invalid conversion" error + that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::rpl_func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_MDA (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) + +/* _GL_CXXALIAS_SYS (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to the system provided function func, if GNULIB_NAMESPACE + is defined. + Example: + _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); + + Wrapping func in an object with an inline conversion operator + avoids a reference to func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function is picked among a set of overloaded functions, + namely the one with rettype2 and parameters2. Two consecutive casts + are used to silence the "cannot find a match" and "invalid conversion" + errors that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* The outer cast must be a reinterpret_cast. + The inner cast: When the function is defined as a set of overloaded + functions, it works as a static_cast<>, choosing the designated variant. + When the function is defined as a single variant, it works as a + reinterpret_cast<>. The parenthesized cast syntax works both ways. */ +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast((rettype2 (*) parameters2)(::func)); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN (func); + causes a warning to be emitted when ::func is used but not when + GNULIB_NAMESPACE::func is used. func must be defined without overloaded + variants. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN(func) \ + _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN_1(func,namespace) \ + _GL_CXXALIASWARN_2 (func, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_WARN_ON_USE (func, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN_2(func,namespace) \ + extern __typeof__ (func) func +# else +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN(func) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); + causes a warning to be emitted when the given overloaded variant of ::func + is used but not when GNULIB_NAMESPACE::func is used. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ + GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ + _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# else +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +#endif /* _GL_CXXDEFS_H */ + +/* The definition of _Noreturn is copied here. */ +/* A C macro for declaring that a function does not return. + Copyright (C) 2011-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* The _Noreturn keyword of C11. + Do not use [[noreturn]], because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would be valid only with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. So even though C23 deprecates _Noreturn, + it is currently more portable to prefer it to [[noreturn]]. + + Also, do not try to work around LLVM bug 59792 (clang 15 or earlier). + This rare bug can be worked around by compiling with 'clang -D_Noreturn=', + though the workaround may generate many false-alarm warnings. */ +#ifndef _Noreturn +# if ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0))) + /* _Noreturn works as-is. */ +# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ + || 0x5110 <= __SUNPRO_C) + /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the + latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */ +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif + +/* The definition of _GL_ARG_NONNULL is copied here. */ +/* A C macro for declaring that specific arguments must not be NULL. + Copyright (C) 2009-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools + that the values passed as arguments n, ..., m must be non-NULL pointers. + n = 1 stands for the first argument, n = 2 for the second argument etc. */ +#ifndef _GL_ARG_NONNULL +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ +# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) +# else +# define _GL_ARG_NONNULL(params) +# endif +#endif + +/* The definition of _GL_WARN_ON_USE is copied here. */ +/* A C macro for emitting warnings if a function is used. + Copyright (C) 2010-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* _GL_WARN_ON_USE (function, "literal string") issues a declaration + for FUNCTION which will then trigger a compiler warning containing + the text of "literal string" anywhere that function is called, if + supported by the compiler. If the compiler does not support this + feature, the macro expands to an unused extern declaration. + + _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the + attribute used in _GL_WARN_ON_USE. If the compiler does not support + this feature, it expands to empty. + + These macros are useful for marking a function as a potential + portability trap, with the intent that "literal string" include + instructions on the replacement function that should be used + instead. + _GL_WARN_ON_USE is for functions with 'extern' linkage. + _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' + linkage. + + _GL_WARN_ON_USE should not be used more than once for a given function + in a given compilation unit (because this may generate a warning even + if the function is never called). + + However, one of the reasons that a function is a portability trap is + if it has the wrong signature. Declaring FUNCTION with a different + signature in C is a compilation error, so this macro must use the + same type as any existing declaration so that programs that avoid + the problematic FUNCTION do not fail to compile merely because they + included a header that poisoned the function. But this implies that + _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already + have a declaration. Use of this macro implies that there must not + be any other macro hiding the declaration of FUNCTION; but + undefining FUNCTION first is part of the poisoning process anyway + (although for symbols that are provided only via a macro, the result + is a compilation error rather than a warning containing + "literal string"). Also note that in C++, it is only safe to use if + FUNCTION has no overloads. + + For an example, it is possible to poison 'getline' by: + - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], + [getline]) in configure.ac, which potentially defines + HAVE_RAW_DECL_GETLINE + - adding this code to a header that wraps the system : + #undef getline + #if HAVE_RAW_DECL_GETLINE + _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" + "not universally present; use the gnulib module getline"); + #endif + + It is not possible to directly poison global variables. But it is + possible to write a wrapper accessor function, and poison that + (less common usage, like &environ, will cause a compilation error + rather than issue the nice warning, but the end result of informing + the developer about their portability problem is still achieved): + #if HAVE_RAW_DECL_ENVIRON + static char *** + rpl_environ (void) { return &environ; } + _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); + # undef environ + # define environ (*rpl_environ ()) + #endif + or better (avoiding contradictory use of 'static' and 'extern'): + #if HAVE_RAW_DECL_ENVIRON + static char *** + _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") + rpl_environ (void) { return &environ; } + # undef environ + # define environ (*rpl_environ ()) + #endif + */ +#ifndef _GL_WARN_ON_USE + +# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__warning__ (message))) +# elif __clang_major__ >= 4 +/* Another compiler attribute is available in clang. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function \ + __attribute__ ((__diagnose_if__ (1, message, "warning"))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__diagnose_if__ (1, message, "warning"))) +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function +# define _GL_WARN_ON_USE_ATTRIBUTE(message) +# else /* Unsupported. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# define _GL_WARN_ON_USE_ATTRIBUTE(message) +# endif +#endif + +/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") + is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the + function is declared with the given prototype, consisting of return type, + parameters, and attributes. + This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does + not work in this case. */ +#ifndef _GL_WARN_ON_USE_CXX +# if !defined __cplusplus +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ + _GL_WARN_ON_USE (function, msg) +# else +# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes \ + __attribute__ ((__warning__ (msg))) +# elif __clang_major__ >= 4 +/* Another compiler attribute is available in clang. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_clang function parameters_and_attributes \ + __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes +# else /* Unsupported. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +# endif +#endif + +/* _GL_WARN_EXTERN_C declaration; + performs the declaration with C linkage. */ +#ifndef _GL_WARN_EXTERN_C +# if defined __cplusplus +# define _GL_WARN_EXTERN_C extern "C" +# else +# define _GL_WARN_EXTERN_C extern +# endif +#endif + +/* =========== Thread types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if 0 +# include "windows-thread.h" +# if 1 +# define pthread_t rpl_pthread_t +# define pthread_attr_t rpl_pthread_attr_t +# endif +# if !GNULIB_defined_pthread_thread_types +typedef glwthread_thread_t pthread_t; +typedef unsigned int pthread_attr_t; +# define GNULIB_defined_pthread_thread_types 1 +# endif +# else +# if 1 +# define pthread_t rpl_pthread_t +# define pthread_attr_t rpl_pthread_attr_t +# endif +# if !GNULIB_defined_pthread_thread_types +typedef int pthread_t; +typedef unsigned int pthread_attr_t; +# define GNULIB_defined_pthread_thread_types 1 +# endif +# endif +# undef PTHREAD_CREATE_JOINABLE +# undef PTHREAD_CREATE_DETACHED +# define PTHREAD_CREATE_JOINABLE 0 +# define PTHREAD_CREATE_DETACHED 1 +#else +# if !1 +# if !GNULIB_defined_pthread_thread_types +typedef int pthread_t; +typedef unsigned int pthread_attr_t; +# define GNULIB_defined_pthread_thread_types 1 +# endif +# endif +# if !1 +# define PTHREAD_CREATE_JOINABLE 0 +# define PTHREAD_CREATE_DETACHED 1 +# endif +#endif + +/* =========== Once-only control (initialization) types and macros ========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if 1 +# include "windows-once.h" +# if 1 +# define pthread_once_t rpl_pthread_once_t +# endif +# if !GNULIB_defined_pthread_once_types +typedef glwthread_once_t pthread_once_t; +# define GNULIB_defined_pthread_once_types 1 +# endif +# undef PTHREAD_ONCE_INIT +# define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT +# else +# if 1 +# define pthread_once_t rpl_pthread_once_t +# endif +# if !GNULIB_defined_pthread_once_types +typedef int pthread_once_t; +# define GNULIB_defined_pthread_once_types 1 +# endif +# undef PTHREAD_ONCE_INIT +# define PTHREAD_ONCE_INIT { 0 } +# endif +#else +# if !1 +# if !GNULIB_defined_pthread_once_types +typedef int pthread_once_t; +# define GNULIB_defined_pthread_once_types 1 +# endif +# undef PTHREAD_ONCE_INIT +# define PTHREAD_ONCE_INIT { 0 } +# endif +#endif + +/* =========== Mutex types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if 0 +# include "windows-timedmutex.h" +# include "windows-timedrecmutex.h" +# if 1 +# define pthread_mutex_t rpl_pthread_mutex_t +# define pthread_mutexattr_t rpl_pthread_mutexattr_t +# endif +# if !GNULIB_defined_pthread_mutex_types +typedef struct + { + int type; + union + { + glwthread_timedmutex_t u_timedmutex; + glwthread_timedrecmutex_t u_timedrecmutex; + } + u; + } + pthread_mutex_t; +typedef unsigned int pthread_mutexattr_t; +# define GNULIB_defined_pthread_mutex_types 1 +# endif +# undef PTHREAD_MUTEX_INITIALIZER +# define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } } +# else +# if 1 +# define pthread_mutex_t rpl_pthread_mutex_t +# define pthread_mutexattr_t rpl_pthread_mutexattr_t +# endif +# if !GNULIB_defined_pthread_mutex_types +typedef int pthread_mutex_t; +typedef unsigned int pthread_mutexattr_t; +# define GNULIB_defined_pthread_mutex_types 1 +# endif +# undef PTHREAD_MUTEX_INITIALIZER +# define PTHREAD_MUTEX_INITIALIZER { 0 } +# endif +# undef PTHREAD_MUTEX_DEFAULT +# undef PTHREAD_MUTEX_NORMAL +# undef PTHREAD_MUTEX_ERRORCHECK +# undef PTHREAD_MUTEX_RECURSIVE +# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL +# define PTHREAD_MUTEX_NORMAL 0 +# define PTHREAD_MUTEX_ERRORCHECK 1 +# define PTHREAD_MUTEX_RECURSIVE 2 +# undef PTHREAD_MUTEX_STALLED +# undef PTHREAD_MUTEX_ROBUST +# define PTHREAD_MUTEX_STALLED 0 +# define PTHREAD_MUTEX_ROBUST 1 +#else +# if !1 +# if !GNULIB_defined_pthread_mutex_types +typedef int pthread_mutex_t; +typedef unsigned int pthread_mutexattr_t; +# define GNULIB_defined_pthread_mutex_types 1 +# endif +# undef PTHREAD_MUTEX_INITIALIZER +# define PTHREAD_MUTEX_INITIALIZER { 0 } +# endif +# if !1 +# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL +# define PTHREAD_MUTEX_NORMAL 0 +# define PTHREAD_MUTEX_ERRORCHECK 1 +# define PTHREAD_MUTEX_RECURSIVE 2 +# endif +# if !1 +# define PTHREAD_MUTEX_STALLED 0 +# define PTHREAD_MUTEX_ROBUST 1 +# endif +#endif + +/* =========== Read-write lock types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if 0 +# include "windows-timedrwlock.h" +# if 1 +# define pthread_rwlock_t rpl_pthread_rwlock_t +# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t +# endif +# if !GNULIB_defined_pthread_rwlock_types +typedef glwthread_timedrwlock_t pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT +# else +# if 1 +# define pthread_rwlock_t rpl_pthread_rwlock_t +# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t +# endif +# if !GNULIB_defined_pthread_rwlock_types +typedef int pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER { 0 } +# endif +#elif 0 && 0 /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */ +# if 1 +# define pthread_rwlock_t rpl_pthread_rwlock_t +# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t +# endif +# if !GNULIB_defined_pthread_rwlock_types +typedef struct + { + pthread_mutex_t lock; /* protects the remaining fields */ + pthread_cond_t waiting_readers; /* waiting readers */ + pthread_cond_t waiting_writers; /* waiting writers */ + unsigned int waiting_writers_count; /* number of waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER \ + { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 } +#elif 0 && 0 /* i.e. PTHREAD_RWLOCK_BAD_WAITQUEUE */ +/* Use rwlocks of kind PREFER_WRITER or PREFER_WRITER_NONRECURSIVE instead of + the DEFAULT. */ +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP +#else +# if 1 +# if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */ +# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP +# endif +# else +# if !GNULIB_defined_pthread_rwlock_types +typedef int pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER { 0 } +# endif +#endif + +/* =========== Condition variable types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if 0 +# include "windows-cond.h" +# if 1 +# define pthread_cond_t rpl_pthread_cond_t +# define pthread_condattr_t rpl_pthread_condattr_t +# endif +# if !GNULIB_defined_pthread_cond_types +typedef glwthread_cond_t pthread_cond_t; +typedef unsigned int pthread_condattr_t; +# define GNULIB_defined_pthread_cond_types 1 +# endif +# undef PTHREAD_COND_INITIALIZER +# define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT +# else +# if 1 +# define pthread_cond_t rpl_pthread_cond_t +# define pthread_condattr_t rpl_pthread_condattr_t +# endif +# if !GNULIB_defined_pthread_cond_types +typedef int pthread_cond_t; +typedef unsigned int pthread_condattr_t; +# define GNULIB_defined_pthread_cond_types 1 +# endif +# undef PTHREAD_COND_INITIALIZER +# define PTHREAD_COND_INITIALIZER { 0 } +# endif +#else +# if !1 +# if !GNULIB_defined_pthread_cond_types +typedef int pthread_cond_t; +typedef unsigned int pthread_condattr_t; +# define GNULIB_defined_pthread_cond_types 1 +# endif +# undef PTHREAD_COND_INITIALIZER +# define PTHREAD_COND_INITIALIZER { 0 } +# endif +#endif + +/* =========== Thread-specific storage types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if 0 +# include "windows-tls.h" +# if 1 +# define pthread_key_t rpl_pthread_key_t +# endif +# if !GNULIB_defined_pthread_tss_types +typedef glwthread_tls_key_t pthread_key_t; +# define GNULIB_defined_pthread_tss_types 1 +# endif +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS +# else +# if 1 +# define pthread_key_t rpl_pthread_key_t +# endif +# if !GNULIB_defined_pthread_tss_types +typedef void ** pthread_key_t; +# define GNULIB_defined_pthread_tss_types 1 +# endif +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# define PTHREAD_DESTRUCTOR_ITERATIONS 0 +# endif +#else +# if !1 +# if !GNULIB_defined_pthread_tss_types +typedef void ** pthread_key_t; +# define GNULIB_defined_pthread_tss_types 1 +# endif +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# define PTHREAD_DESTRUCTOR_ITERATIONS 0 +# endif +#endif + +/* =========== Spinlock types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if 0 +# include "windows-spin.h" +# if 1 +# define pthread_spinlock_t rpl_pthread_spinlock_t +# endif +# if !GNULIB_defined_pthread_spin_types +typedef glwthread_spinlock_t pthread_spinlock_t; +# define GNULIB_defined_pthread_spin_types 1 +# endif +# else +# if 1 +# define pthread_spinlock_t rpl_pthread_spinlock_t +# endif +# if !GNULIB_defined_pthread_spin_types +typedef pthread_mutex_t pthread_spinlock_t; +# define GNULIB_defined_pthread_spin_types 1 +# endif +# endif +# undef PTHREAD_PROCESS_PRIVATE +# undef PTHREAD_PROCESS_SHARED +# define PTHREAD_PROCESS_PRIVATE 0 +# define PTHREAD_PROCESS_SHARED 1 +#else +# if 1 +/* exists and defines pthread_spinlock_t. */ +# if !1 || 0 +/* If the 'pthread-spin' module is in use, it defines all the pthread_spin* + functions. Prepare for it by overriding pthread_spinlock_t if that might + be needed. */ +# if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \ + || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \ + || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \ + && !defined __ANDROID__) \ + || __clang_major__ >= 3)) \ + && !defined __ibmxl__) +/* We can't use GCC built-ins. Approximate spinlocks with mutexes. */ +# if !GNULIB_defined_pthread_spin_types +# define pthread_spinlock_t pthread_mutex_t +# define GNULIB_defined_pthread_spin_types 1 +# endif +# endif +# endif +# else +/* Approximate spinlocks with mutexes. */ +# if !GNULIB_defined_pthread_spin_types +typedef pthread_mutex_t pthread_spinlock_t; +# define GNULIB_defined_pthread_spin_types 1 +# endif +# endif +# if !1 +# define PTHREAD_PROCESS_PRIVATE 0 +# define PTHREAD_PROCESS_SHARED 1 +# endif +#endif + +/* =========== Other types and macros =========== */ + +#if !1 +# if !GNULIB_defined_other_pthread_types +typedef int pthread_barrier_t; +typedef unsigned int pthread_barrierattr_t; +# define GNULIB_defined_other_pthread_types 1 +# endif +#endif + +#if !defined PTHREAD_CANCELED + +# define PTHREAD_BARRIER_SERIAL_THREAD (-1) + +# define PTHREAD_CANCEL_DEFERRED 0 +# define PTHREAD_CANCEL_ASYNCHRONOUS 1 + +# define PTHREAD_CANCEL_ENABLE 0 +# define PTHREAD_CANCEL_DISABLE 1 + +# define PTHREAD_CANCELED ((void *) -1) + +# define PTHREAD_INHERIT_SCHED 0 +# define PTHREAD_EXPLICIT_SCHED 1 + +# define PTHREAD_PRIO_NONE 0 +# define PTHREAD_PRIO_INHERIT 1 +# define PTHREAD_PRIO_PROTECT 2 + +# define PTHREAD_SCOPE_SYSTEM 0 +# define PTHREAD_SCOPE_PROCESS 1 + +#endif + +/* =========== Thread functions =========== */ + +#if 0 +/* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way. + Sigh. */ +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_create +# define pthread_create rpl_pthread_create +# endif +_GL_FUNCDECL_RPL (pthread_create, int, + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg), + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (pthread_create, int, + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_create, int, + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg), + _GL_ARG_NONNULL ((1, 3))); +# endif +_GL_CXXALIAS_SYS_CAST (pthread_create, int, + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_create); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_CREATE +_GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_attr_init +# define pthread_attr_init rpl_pthread_attr_init +# endif +_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_attr_init); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_ATTR_INIT +_GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_attr_getdetachstate +# define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate +# endif +_GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int, + (const pthread_attr_t *attr, int *detachstatep), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int, + (const pthread_attr_t *attr, int *detachstatep)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int, + (const pthread_attr_t *attr, int *detachstatep), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int, + (const pthread_attr_t *attr, int *detachstatep)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_attr_getdetachstate); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE +_GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_attr_setdetachstate +# define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate +# endif +_GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int, + (pthread_attr_t *attr, int detachstate), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int, + (pthread_attr_t *attr, int detachstate)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int, + (pthread_attr_t *attr, int detachstate), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int, + (pthread_attr_t *attr, int detachstate)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_attr_setdetachstate); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE +_GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_attr_destroy +# define pthread_attr_destroy rpl_pthread_attr_destroy +# endif +_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_attr_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY +_GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_self +# define pthread_self rpl_pthread_self +# endif +_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE); +_GL_CXXALIAS_RPL (pthread_self, pthread_t, (void)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (pthread_self, pthread_t, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_self); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_SELF +_GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_equal +# define pthread_equal rpl_pthread_equal +# endif +_GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2), ); +_GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2), ); +# endif +_GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_equal); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_EQUAL +_GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_detach +# define pthread_detach rpl_pthread_detach +# endif +_GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread), ); +_GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread), ); +# endif +_GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_detach); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_DETACH +_GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_join +# define pthread_join rpl_pthread_join +# endif +_GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep), ); +_GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep), ); +# endif +_GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_join); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_JOIN +_GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_exit +# define pthread_exit rpl_pthread_exit +# endif +_GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value), ); +_GL_CXXALIAS_RPL (pthread_exit, void, (void *value)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value), ); +# endif +/* Need to cast because of AIX with xlclang++. */ +_GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_exit); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_EXIT +_GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +/* =========== Once-only control (initialization) functions =========== */ + +#if 1 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_once +# define pthread_once rpl_pthread_once +# endif +_GL_FUNCDECL_RPL (pthread_once, int, + (pthread_once_t *once_control, void (*initfunction) (void)), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_once, int, + (pthread_once_t *once_control, void (*initfunction) (void))); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_once, int, + (pthread_once_t *once_control, void (*initfunction) (void)), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS_CAST (pthread_once, int, + (pthread_once_t *once_control, + void (*initfunction) (void))); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_once); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_ONCE +_GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - " + "use gnulib module pthread-once for portability"); +# endif +#endif + +/* =========== Mutex functions =========== */ + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_init +# define pthread_mutex_init rpl_pthread_mutex_init +# endif +_GL_FUNCDECL_RPL (pthread_mutex_init, int, + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_init, int, + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutex_init, int, + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_init, int, + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_init); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT +_GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_init +# define pthread_mutexattr_init rpl_pthread_mutexattr_init +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_init); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT +_GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_gettype +# define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict typep), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict typep)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict typep), + _GL_ARG_NONNULL ((1, 2))); +# endif +/* Need to cast, because on FreeBSD the first parameter is + pthread_mutexattr_t *attr. */ +_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict typep)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_gettype); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE +_GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_settype +# define pthread_mutexattr_settype rpl_pthread_mutexattr_settype +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_settype, int, + (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutexattr_settype, int, + (pthread_mutexattr_t *attr, int type)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutexattr_settype, int, + (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutexattr_settype, int, + (pthread_mutexattr_t *attr, int type)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_settype); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE +_GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_getrobust +# define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp), + _GL_ARG_NONNULL ((1, 2))); +# endif +/* Need to cast, because on FreeBSD the first parameter is + pthread_mutexattr_t *attr. */ +_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_getrobust); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST +_GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_setrobust +# define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int, + (pthread_mutexattr_t *attr, int robust), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int, + (pthread_mutexattr_t *attr, int robust)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int, + (pthread_mutexattr_t *attr, int robust), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int, + (pthread_mutexattr_t *attr, int robust)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_setrobust); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST +_GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_destroy +# define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY +_GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_lock +# define pthread_mutex_lock rpl_pthread_mutex_lock +# endif +_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_lock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK +_GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_trylock +# define pthread_mutex_trylock rpl_pthread_mutex_trylock +# endif +_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_trylock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK +_GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_timedlock +# define pthread_mutex_timedlock rpl_pthread_mutex_timedlock +# endif +_GL_FUNCDECL_RPL (pthread_mutex_timedlock, int, + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_mutex_timedlock, int, + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutex_timedlock, int, + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_timedlock, int, + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_timedlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK +_GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - " + "use gnulib module pthread_mutex_timedlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_unlock +# define pthread_mutex_unlock rpl_pthread_mutex_unlock +# endif +_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_unlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK +_GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_destroy +# define pthread_mutex_destroy rpl_pthread_mutex_destroy +# endif +_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY +_GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +/* =========== Read-write lock functions =========== */ + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_init +# define pthread_rwlock_init rpl_pthread_rwlock_init +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_init, int, + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_init, int, + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_init, int, + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_init, int, + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_init); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT +_GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlockattr_init +# define pthread_rwlockattr_init rpl_pthread_rwlockattr_init +# endif +_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlockattr_init); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT +_GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlockattr_destroy +# define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy +# endif +_GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int, + (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int, + (pthread_rwlockattr_t *attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int, + (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int, + (pthread_rwlockattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlockattr_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY +_GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_rdlock +# define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_rdlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK +_GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_wrlock +# define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_wrlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK +_GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_tryrdlock +# define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_tryrdlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK +_GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_trywrlock +# define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_trywrlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK +_GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_timedrdlock +# define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_timedrdlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK +_GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_timedwrlock +# define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_timedwrlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK +_GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_unlock +# define pthread_rwlock_unlock rpl_pthread_rwlock_unlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_unlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK +_GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_destroy +# define pthread_rwlock_destroy rpl_pthread_rwlock_destroy +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY +_GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +/* =========== Condition variable functions =========== */ + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_init +# define pthread_cond_init rpl_pthread_cond_init +# endif +_GL_FUNCDECL_RPL (pthread_cond_init, int, + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_cond_init, int, + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_cond_init, int, + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_init, int, + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_init); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_COND_INIT +_GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_condattr_init +# define pthread_condattr_init rpl_pthread_condattr_init +# endif +_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_condattr_init); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT +_GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_condattr_destroy +# define pthread_condattr_destroy rpl_pthread_condattr_destroy +# endif +_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_condattr_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY +_GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_wait +# define pthread_cond_wait rpl_pthread_cond_wait +# endif +_GL_FUNCDECL_RPL (pthread_cond_wait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_cond_wait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_cond_wait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_wait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_wait); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_COND_WAIT +_GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_timedwait +# define pthread_cond_timedwait rpl_pthread_cond_timedwait +# endif +_GL_FUNCDECL_RPL (pthread_cond_timedwait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2, 3))); +_GL_CXXALIAS_RPL (pthread_cond_timedwait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_cond_timedwait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2, 3))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_timedwait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_timedwait); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT +_GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_signal +# define pthread_cond_signal rpl_pthread_cond_signal +# endif +_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_signal); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL +_GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_broadcast +# define pthread_cond_broadcast rpl_pthread_cond_broadcast +# endif +_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_broadcast); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST +_GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_destroy +# define pthread_cond_destroy rpl_pthread_cond_destroy +# endif +_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_COND_DESTROY +_GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +/* =========== Thread-specific storage functions =========== */ + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_key_create +# define pthread_key_create rpl_pthread_key_create +# endif +_GL_FUNCDECL_RPL (pthread_key_create, int, + (pthread_key_t *keyp, void (*destructor) (void *)), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_key_create, int, + (pthread_key_t *keyp, void (*destructor) (void *))); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_key_create, int, + (pthread_key_t *keyp, void (*destructor) (void *)), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS_CAST (pthread_key_create, int, + (pthread_key_t *keyp, void (*destructor) (void *))); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_key_create); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_KEY_CREATE +_GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - " + "use gnulib module pthread-tss for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_setspecific +# define pthread_setspecific rpl_pthread_setspecific +# endif +_GL_FUNCDECL_RPL (pthread_setspecific, int, + (pthread_key_t key, const void *value), ); +_GL_CXXALIAS_RPL (pthread_setspecific, int, + (pthread_key_t key, const void *value)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_setspecific, int, + (pthread_key_t key, const void *value), ); +# endif +_GL_CXXALIAS_SYS (pthread_setspecific, int, + (pthread_key_t key, const void *value)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_setspecific); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC +_GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - " + "use gnulib module pthread-tss for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_getspecific +# define pthread_getspecific rpl_pthread_getspecific +# endif +_GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key), ); +_GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key), ); +# endif +_GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_getspecific); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC +_GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - " + "use gnulib module pthread-tss for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_key_delete +# define pthread_key_delete rpl_pthread_key_delete +# endif +_GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key), ); +_GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key), ); +# endif +_GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_key_delete); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_KEY_DELETE +_GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - " + "use gnulib module pthread-tss for portability"); +# endif +#endif + +/* =========== Spinlock functions =========== */ + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_init +# define pthread_spin_init rpl_pthread_spin_init +# endif +_GL_FUNCDECL_RPL (pthread_spin_init, int, + (pthread_spinlock_t *lock, int shared_across_processes), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_init, int, + (pthread_spinlock_t *lock, int shared_across_processes)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_spin_init, int, + (pthread_spinlock_t *lock, int shared_across_processes), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_init, int, + (pthread_spinlock_t *lock, int shared_across_processes)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_init); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_SPIN_INIT +_GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_lock +# define pthread_spin_lock rpl_pthread_spin_lock +# endif +_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_lock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK +_GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_trylock +# define pthread_spin_trylock rpl_pthread_spin_trylock +# endif +_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_trylock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK +_GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_unlock +# define pthread_spin_unlock rpl_pthread_spin_unlock +# endif +_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_unlock); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK +_GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_destroy +# define pthread_spin_destroy rpl_pthread_spin_destroy +# endif +_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock)); +# else +# if !1 +_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY +_GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + + +#if defined __cplusplus && defined GNULIB_NAMESPACE && !1 && defined __MINGW32__ +/* Provide the symbols required by mingw's . */ +using GNULIB_NAMESPACE::pthread_create; +using GNULIB_NAMESPACE::pthread_self; +using GNULIB_NAMESPACE::pthread_equal; +using GNULIB_NAMESPACE::pthread_detach; +using GNULIB_NAMESPACE::pthread_join; +using GNULIB_NAMESPACE::pthread_once; +using GNULIB_NAMESPACE::pthread_mutex_init; +using GNULIB_NAMESPACE::pthread_mutexattr_init; +using GNULIB_NAMESPACE::pthread_mutexattr_settype; +using GNULIB_NAMESPACE::pthread_mutexattr_destroy; +using GNULIB_NAMESPACE::pthread_mutex_lock; +using GNULIB_NAMESPACE::pthread_mutex_trylock; +using GNULIB_NAMESPACE::pthread_mutex_timedlock; +using GNULIB_NAMESPACE::pthread_mutex_unlock; +using GNULIB_NAMESPACE::pthread_mutex_destroy; +using GNULIB_NAMESPACE::pthread_cond_wait; +using GNULIB_NAMESPACE::pthread_cond_timedwait; +using GNULIB_NAMESPACE::pthread_cond_signal; +using GNULIB_NAMESPACE::pthread_cond_broadcast; +using GNULIB_NAMESPACE::pthread_cond_destroy; +using GNULIB_NAMESPACE::pthread_key_create; +using GNULIB_NAMESPACE::pthread_setspecific; +using GNULIB_NAMESPACE::pthread_getspecific; +using GNULIB_NAMESPACE::pthread_key_delete; +#endif + + +#endif /* _GL_PTHREAD_H_ */ +#endif /* _GL_PTHREAD_H_ */ +#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 @@ +/* Implement the most essential subset of POSIX pthread.h. + + Copyright (C) 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Paul Eggert, Glen Lenker, and Bruno Haible. */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_PTHREAD_H +/* Special invocation convention: + On Android, we have a sequence of nested includes + -> -> -> -> + -> . + In this situation, PTHREAD_COND_INITIALIZER is not yet defined, + therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc. */ + +#@INCLUDE_NEXT@ @NEXT_PTHREAD_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_PTHREAD_H_ + +#if @HAVE_PTHREAD_H@ + +# define _@GUARD_PREFIX@_ALREADY_INCLUDING_PTHREAD_H + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_PTHREAD_H@ + +# undef _@GUARD_PREFIX@_ALREADY_INCLUDING_PTHREAD_H + +#endif + +#ifndef _@GUARD_PREFIX@_PTHREAD_H_ +#define _@GUARD_PREFIX@_PTHREAD_H_ + +/* This file uses _Noreturn, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, + HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#define __need_system_stdlib_h +#include +#undef __need_system_stdlib_h + + +/* The pthreads-win32 defines a couple of broken macros. */ +#undef asctime_r +#undef ctime_r +#undef gmtime_r +#undef localtime_r +#undef rand_r +#undef strtok_r + +#include +#include +#include +#include + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _Noreturn is copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* =========== Thread types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_THREAD@ +# include "windows-thread.h" +# if @HAVE_PTHREAD_T@ +# define pthread_t rpl_pthread_t +# define pthread_attr_t rpl_pthread_attr_t +# endif +# if !GNULIB_defined_pthread_thread_types +typedef glwthread_thread_t pthread_t; +typedef unsigned int pthread_attr_t; +# define GNULIB_defined_pthread_thread_types 1 +# endif +# else +# if @HAVE_PTHREAD_T@ +# define pthread_t rpl_pthread_t +# define pthread_attr_t rpl_pthread_attr_t +# endif +# if !GNULIB_defined_pthread_thread_types +typedef int pthread_t; +typedef unsigned int pthread_attr_t; +# define GNULIB_defined_pthread_thread_types 1 +# endif +# endif +# undef PTHREAD_CREATE_JOINABLE +# undef PTHREAD_CREATE_DETACHED +# define PTHREAD_CREATE_JOINABLE 0 +# define PTHREAD_CREATE_DETACHED 1 +#else +# if !@HAVE_PTHREAD_T@ +# if !GNULIB_defined_pthread_thread_types +typedef int pthread_t; +typedef unsigned int pthread_attr_t; +# define GNULIB_defined_pthread_thread_types 1 +# endif +# endif +# if !@HAVE_PTHREAD_CREATE_DETACHED@ +# define PTHREAD_CREATE_JOINABLE 0 +# define PTHREAD_CREATE_DETACHED 1 +# endif +#endif + +/* =========== Once-only control (initialization) types and macros ========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_ONCE@ +# include "windows-once.h" +# if @HAVE_PTHREAD_T@ +# define pthread_once_t rpl_pthread_once_t +# endif +# if !GNULIB_defined_pthread_once_types +typedef glwthread_once_t pthread_once_t; +# define GNULIB_defined_pthread_once_types 1 +# endif +# undef PTHREAD_ONCE_INIT +# define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT +# else +# if @HAVE_PTHREAD_T@ +# define pthread_once_t rpl_pthread_once_t +# endif +# if !GNULIB_defined_pthread_once_types +typedef int pthread_once_t; +# define GNULIB_defined_pthread_once_types 1 +# endif +# undef PTHREAD_ONCE_INIT +# define PTHREAD_ONCE_INIT { 0 } +# endif +#else +# if !@HAVE_PTHREAD_T@ +# if !GNULIB_defined_pthread_once_types +typedef int pthread_once_t; +# define GNULIB_defined_pthread_once_types 1 +# endif +# undef PTHREAD_ONCE_INIT +# define PTHREAD_ONCE_INIT { 0 } +# endif +#endif + +/* =========== Mutex types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_MUTEX@ +# include "windows-timedmutex.h" +# include "windows-timedrecmutex.h" +# if @HAVE_PTHREAD_T@ +# define pthread_mutex_t rpl_pthread_mutex_t +# define pthread_mutexattr_t rpl_pthread_mutexattr_t +# endif +# if !GNULIB_defined_pthread_mutex_types +typedef struct + { + int type; + union + { + glwthread_timedmutex_t u_timedmutex; + glwthread_timedrecmutex_t u_timedrecmutex; + } + u; + } + pthread_mutex_t; +typedef unsigned int pthread_mutexattr_t; +# define GNULIB_defined_pthread_mutex_types 1 +# endif +# undef PTHREAD_MUTEX_INITIALIZER +# define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } } +# else +# if @HAVE_PTHREAD_T@ +# define pthread_mutex_t rpl_pthread_mutex_t +# define pthread_mutexattr_t rpl_pthread_mutexattr_t +# endif +# if !GNULIB_defined_pthread_mutex_types +typedef int pthread_mutex_t; +typedef unsigned int pthread_mutexattr_t; +# define GNULIB_defined_pthread_mutex_types 1 +# endif +# undef PTHREAD_MUTEX_INITIALIZER +# define PTHREAD_MUTEX_INITIALIZER { 0 } +# endif +# undef PTHREAD_MUTEX_DEFAULT +# undef PTHREAD_MUTEX_NORMAL +# undef PTHREAD_MUTEX_ERRORCHECK +# undef PTHREAD_MUTEX_RECURSIVE +# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL +# define PTHREAD_MUTEX_NORMAL 0 +# define PTHREAD_MUTEX_ERRORCHECK 1 +# define PTHREAD_MUTEX_RECURSIVE 2 +# undef PTHREAD_MUTEX_STALLED +# undef PTHREAD_MUTEX_ROBUST +# define PTHREAD_MUTEX_STALLED 0 +# define PTHREAD_MUTEX_ROBUST 1 +#else +# if !@HAVE_PTHREAD_T@ +# if !GNULIB_defined_pthread_mutex_types +typedef int pthread_mutex_t; +typedef unsigned int pthread_mutexattr_t; +# define GNULIB_defined_pthread_mutex_types 1 +# endif +# undef PTHREAD_MUTEX_INITIALIZER +# define PTHREAD_MUTEX_INITIALIZER { 0 } +# endif +# if !@HAVE_PTHREAD_MUTEX_RECURSIVE@ +# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL +# define PTHREAD_MUTEX_NORMAL 0 +# define PTHREAD_MUTEX_ERRORCHECK 1 +# define PTHREAD_MUTEX_RECURSIVE 2 +# endif +# if !@HAVE_PTHREAD_MUTEX_ROBUST@ +# define PTHREAD_MUTEX_STALLED 0 +# define PTHREAD_MUTEX_ROBUST 1 +# endif +#endif + +/* =========== Read-write lock types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_RWLOCK@ +# include "windows-timedrwlock.h" +# if @HAVE_PTHREAD_T@ +# define pthread_rwlock_t rpl_pthread_rwlock_t +# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t +# endif +# if !GNULIB_defined_pthread_rwlock_types +typedef glwthread_timedrwlock_t pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT +# else +# if @HAVE_PTHREAD_T@ +# define pthread_rwlock_t rpl_pthread_rwlock_t +# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t +# endif +# if !GNULIB_defined_pthread_rwlock_types +typedef int pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER { 0 } +# endif +#elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_DESTROY@ /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */ +# if @HAVE_PTHREAD_T@ +# define pthread_rwlock_t rpl_pthread_rwlock_t +# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t +# endif +# if !GNULIB_defined_pthread_rwlock_types +typedef struct + { + pthread_mutex_t lock; /* protects the remaining fields */ + pthread_cond_t waiting_readers; /* waiting readers */ + pthread_cond_t waiting_writers; /* waiting writers */ + unsigned int waiting_writers_count; /* number of waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER \ + { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 } +#elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e. PTHREAD_RWLOCK_BAD_WAITQUEUE */ +/* Use rwlocks of kind PREFER_WRITER or PREFER_WRITER_NONRECURSIVE instead of + the DEFAULT. */ +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP +#else +# if @HAVE_PTHREAD_T@ +# if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */ +# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP +# endif +# else +# if !GNULIB_defined_pthread_rwlock_types +typedef int pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER { 0 } +# endif +#endif + +/* =========== Condition variable types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_COND@ +# include "windows-cond.h" +# if @HAVE_PTHREAD_T@ +# define pthread_cond_t rpl_pthread_cond_t +# define pthread_condattr_t rpl_pthread_condattr_t +# endif +# if !GNULIB_defined_pthread_cond_types +typedef glwthread_cond_t pthread_cond_t; +typedef unsigned int pthread_condattr_t; +# define GNULIB_defined_pthread_cond_types 1 +# endif +# undef PTHREAD_COND_INITIALIZER +# define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT +# else +# if @HAVE_PTHREAD_T@ +# define pthread_cond_t rpl_pthread_cond_t +# define pthread_condattr_t rpl_pthread_condattr_t +# endif +# if !GNULIB_defined_pthread_cond_types +typedef int pthread_cond_t; +typedef unsigned int pthread_condattr_t; +# define GNULIB_defined_pthread_cond_types 1 +# endif +# undef PTHREAD_COND_INITIALIZER +# define PTHREAD_COND_INITIALIZER { 0 } +# endif +#else +# if !@HAVE_PTHREAD_T@ +# if !GNULIB_defined_pthread_cond_types +typedef int pthread_cond_t; +typedef unsigned int pthread_condattr_t; +# define GNULIB_defined_pthread_cond_types 1 +# endif +# undef PTHREAD_COND_INITIALIZER +# define PTHREAD_COND_INITIALIZER { 0 } +# endif +#endif + +/* =========== Thread-specific storage types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_TSS@ +# include "windows-tls.h" +# if @HAVE_PTHREAD_T@ +# define pthread_key_t rpl_pthread_key_t +# endif +# if !GNULIB_defined_pthread_tss_types +typedef glwthread_tls_key_t pthread_key_t; +# define GNULIB_defined_pthread_tss_types 1 +# endif +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS +# else +# if @HAVE_PTHREAD_T@ +# define pthread_key_t rpl_pthread_key_t +# endif +# if !GNULIB_defined_pthread_tss_types +typedef void ** pthread_key_t; +# define GNULIB_defined_pthread_tss_types 1 +# endif +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# define PTHREAD_DESTRUCTOR_ITERATIONS 0 +# endif +#else +# if !@HAVE_PTHREAD_T@ +# if !GNULIB_defined_pthread_tss_types +typedef void ** pthread_key_t; +# define GNULIB_defined_pthread_tss_types 1 +# endif +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# define PTHREAD_DESTRUCTOR_ITERATIONS 0 +# endif +#endif + +/* =========== Spinlock types and macros =========== */ + +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_SPIN@ +# include "windows-spin.h" +# if @HAVE_PTHREAD_T@ +# define pthread_spinlock_t rpl_pthread_spinlock_t +# endif +# if !GNULIB_defined_pthread_spin_types +typedef glwthread_spinlock_t pthread_spinlock_t; +# define GNULIB_defined_pthread_spin_types 1 +# endif +# else +# if @HAVE_PTHREAD_T@ +# define pthread_spinlock_t rpl_pthread_spinlock_t +# endif +# if !GNULIB_defined_pthread_spin_types +typedef pthread_mutex_t pthread_spinlock_t; +# define GNULIB_defined_pthread_spin_types 1 +# endif +# endif +# undef PTHREAD_PROCESS_PRIVATE +# undef PTHREAD_PROCESS_SHARED +# define PTHREAD_PROCESS_PRIVATE 0 +# define PTHREAD_PROCESS_SHARED 1 +#else +# if @HAVE_PTHREAD_SPINLOCK_T@ +/* exists and defines pthread_spinlock_t. */ +# if !@HAVE_PTHREAD_SPIN_INIT@ || @REPLACE_PTHREAD_SPIN_INIT@ +/* If the 'pthread-spin' module is in use, it defines all the pthread_spin* + functions. Prepare for it by overriding pthread_spinlock_t if that might + be needed. */ +# if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \ + || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \ + || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \ + && !defined __ANDROID__) \ + || __clang_major__ >= 3)) \ + && !defined __ibmxl__) +/* We can't use GCC built-ins. Approximate spinlocks with mutexes. */ +# if !GNULIB_defined_pthread_spin_types +# define pthread_spinlock_t pthread_mutex_t +# define GNULIB_defined_pthread_spin_types 1 +# endif +# endif +# endif +# else +/* Approximate spinlocks with mutexes. */ +# if !GNULIB_defined_pthread_spin_types +typedef pthread_mutex_t pthread_spinlock_t; +# define GNULIB_defined_pthread_spin_types 1 +# endif +# endif +# if !@HAVE_PTHREAD_PROCESS_SHARED@ +# define PTHREAD_PROCESS_PRIVATE 0 +# define PTHREAD_PROCESS_SHARED 1 +# endif +#endif + +/* =========== Other types and macros =========== */ + +#if !@HAVE_PTHREAD_T@ +# if !GNULIB_defined_other_pthread_types +typedef int pthread_barrier_t; +typedef unsigned int pthread_barrierattr_t; +# define GNULIB_defined_other_pthread_types 1 +# endif +#endif + +#if !defined PTHREAD_CANCELED + +# define PTHREAD_BARRIER_SERIAL_THREAD (-1) + +# define PTHREAD_CANCEL_DEFERRED 0 +# define PTHREAD_CANCEL_ASYNCHRONOUS 1 + +# define PTHREAD_CANCEL_ENABLE 0 +# define PTHREAD_CANCEL_DISABLE 1 + +# define PTHREAD_CANCELED ((void *) -1) + +# define PTHREAD_INHERIT_SCHED 0 +# define PTHREAD_EXPLICIT_SCHED 1 + +# define PTHREAD_PRIO_NONE 0 +# define PTHREAD_PRIO_INHERIT 1 +# define PTHREAD_PRIO_PROTECT 2 + +# define PTHREAD_SCOPE_SYSTEM 0 +# define PTHREAD_SCOPE_PROCESS 1 + +#endif + +/* =========== Thread functions =========== */ + +#if @GNULIB_PTHREAD_THREAD@ +/* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way. + Sigh. */ +# if @REPLACE_PTHREAD_CREATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_create +# define pthread_create rpl_pthread_create +# endif +_GL_FUNCDECL_RPL (pthread_create, int, + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg), + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (pthread_create, int, + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg)); +# else +# if !@HAVE_PTHREAD_CREATE@ +_GL_FUNCDECL_SYS (pthread_create, int, + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg), + _GL_ARG_NONNULL ((1, 3))); +# endif +_GL_CXXALIAS_SYS_CAST (pthread_create, int, + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_create); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_create +# if HAVE_RAW_DECL_PTHREAD_CREATE +_GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_ATTR_INIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_attr_init +# define pthread_attr_init rpl_pthread_attr_init +# endif +_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr)); +# else +# if !@HAVE_PTHREAD_ATTR_INIT@ +_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_attr_init); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_attr_init +# if HAVE_RAW_DECL_PTHREAD_ATTR_INIT +_GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_attr_getdetachstate +# define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate +# endif +_GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int, + (const pthread_attr_t *attr, int *detachstatep), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int, + (const pthread_attr_t *attr, int *detachstatep)); +# else +# if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@ +_GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int, + (const pthread_attr_t *attr, int *detachstatep), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int, + (const pthread_attr_t *attr, int *detachstatep)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_attr_getdetachstate); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_attr_getdetachstate +# if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE +_GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_attr_setdetachstate +# define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate +# endif +_GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int, + (pthread_attr_t *attr, int detachstate), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int, + (pthread_attr_t *attr, int detachstate)); +# else +# if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@ +_GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int, + (pthread_attr_t *attr, int detachstate), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int, + (pthread_attr_t *attr, int detachstate)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_attr_setdetachstate); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_attr_setdetachstate +# if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE +_GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_ATTR_DESTROY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_attr_destroy +# define pthread_attr_destroy rpl_pthread_attr_destroy +# endif +_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr)); +# else +# if !@HAVE_PTHREAD_ATTR_DESTROY@ +_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_attr_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_attr_destroy +# if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY +_GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_SELF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_self +# define pthread_self rpl_pthread_self +# endif +_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE); +_GL_CXXALIAS_RPL (pthread_self, pthread_t, (void)); +# else +# if !@HAVE_PTHREAD_SELF@ +_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (pthread_self, pthread_t, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_self); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_self +# if HAVE_RAW_DECL_PTHREAD_SELF +_GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_EQUAL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_equal +# define pthread_equal rpl_pthread_equal +# endif +_GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2), ); +_GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2)); +# else +# if !@HAVE_PTHREAD_EQUAL@ +_GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2), ); +# endif +_GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_equal); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_equal +# if HAVE_RAW_DECL_PTHREAD_EQUAL +_GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_DETACH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_detach +# define pthread_detach rpl_pthread_detach +# endif +_GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread), ); +_GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread)); +# else +# if !@HAVE_PTHREAD_DETACH@ +_GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread), ); +# endif +_GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_detach); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_detach +# if HAVE_RAW_DECL_PTHREAD_DETACH +_GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_JOIN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_join +# define pthread_join rpl_pthread_join +# endif +_GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep), ); +_GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep)); +# else +# if !@HAVE_PTHREAD_JOIN@ +_GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep), ); +# endif +_GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_join); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_join +# if HAVE_RAW_DECL_PTHREAD_JOIN +_GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_THREAD@ +# if @REPLACE_PTHREAD_EXIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_exit +# define pthread_exit rpl_pthread_exit +# endif +_GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value), ); +_GL_CXXALIAS_RPL (pthread_exit, void, (void *value)); +# else +# if !@HAVE_PTHREAD_EXIT@ +_GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value), ); +# endif +/* Need to cast because of AIX with xlclang++. */ +_GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_exit); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_exit +# if HAVE_RAW_DECL_PTHREAD_EXIT +_GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - " + "use gnulib module pthread-thread for portability"); +# endif +#endif + +/* =========== Once-only control (initialization) functions =========== */ + +#if @GNULIB_PTHREAD_ONCE@ +# if @REPLACE_PTHREAD_ONCE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_once +# define pthread_once rpl_pthread_once +# endif +_GL_FUNCDECL_RPL (pthread_once, int, + (pthread_once_t *once_control, void (*initfunction) (void)), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_once, int, + (pthread_once_t *once_control, void (*initfunction) (void))); +# else +# if !@HAVE_PTHREAD_ONCE@ +_GL_FUNCDECL_SYS (pthread_once, int, + (pthread_once_t *once_control, void (*initfunction) (void)), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS_CAST (pthread_once, int, + (pthread_once_t *once_control, + void (*initfunction) (void))); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_once); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_once +# if HAVE_RAW_DECL_PTHREAD_ONCE +_GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - " + "use gnulib module pthread-once for portability"); +# endif +#endif + +/* =========== Mutex functions =========== */ + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEX_INIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_init +# define pthread_mutex_init rpl_pthread_mutex_init +# endif +_GL_FUNCDECL_RPL (pthread_mutex_init, int, + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_init, int, + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr)); +# else +# if !@HAVE_PTHREAD_MUTEX_INIT@ +_GL_FUNCDECL_SYS (pthread_mutex_init, int, + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_init, int, + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_init); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutex_init +# if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT +_GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEXATTR_INIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_init +# define pthread_mutexattr_init rpl_pthread_mutexattr_init +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)); +# else +# if !@HAVE_PTHREAD_MUTEXATTR_INIT@ +_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_init); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutexattr_init +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT +_GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_gettype +# define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict typep), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict typep)); +# else +# if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@ +_GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict typep), + _GL_ARG_NONNULL ((1, 2))); +# endif +/* Need to cast, because on FreeBSD the first parameter is + pthread_mutexattr_t *attr. */ +_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict typep)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_gettype); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutexattr_gettype +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE +_GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_settype +# define pthread_mutexattr_settype rpl_pthread_mutexattr_settype +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_settype, int, + (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutexattr_settype, int, + (pthread_mutexattr_t *attr, int type)); +# else +# if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@ +_GL_FUNCDECL_SYS (pthread_mutexattr_settype, int, + (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutexattr_settype, int, + (pthread_mutexattr_t *attr, int type)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_settype); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutexattr_settype +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE +_GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_getrobust +# define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp)); +# else +# if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@ +_GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp), + _GL_ARG_NONNULL ((1, 2))); +# endif +/* Need to cast, because on FreeBSD the first parameter is + pthread_mutexattr_t *attr. */ +_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int, + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_getrobust); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutexattr_getrobust +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST +_GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_setrobust +# define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int, + (pthread_mutexattr_t *attr, int robust), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int, + (pthread_mutexattr_t *attr, int robust)); +# else +# if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@ +_GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int, + (pthread_mutexattr_t *attr, int robust), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int, + (pthread_mutexattr_t *attr, int robust)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_setrobust); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutexattr_setrobust +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST +_GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutexattr_destroy +# define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy +# endif +_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)); +# else +# if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@ +_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutexattr_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutexattr_destroy +# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY +_GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEX_LOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_lock +# define pthread_mutex_lock rpl_pthread_mutex_lock +# endif +_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex)); +# else +# if !@HAVE_PTHREAD_MUTEX_LOCK@ +_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_lock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutex_lock +# if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK +_GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEX_TRYLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_trylock +# define pthread_mutex_trylock rpl_pthread_mutex_trylock +# endif +_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)); +# else +# if !@HAVE_PTHREAD_MUTEX_TRYLOCK@ +_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_trylock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutex_trylock +# if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK +_GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@ +# if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_timedlock +# define pthread_mutex_timedlock rpl_pthread_mutex_timedlock +# endif +_GL_FUNCDECL_RPL (pthread_mutex_timedlock, int, + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_mutex_timedlock, int, + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); +# else +# if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@ +_GL_FUNCDECL_SYS (pthread_mutex_timedlock, int, + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_timedlock, int, + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_timedlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutex_timedlock +# if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK +_GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - " + "use gnulib module pthread_mutex_timedlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEX_UNLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_unlock +# define pthread_mutex_unlock rpl_pthread_mutex_unlock +# endif +_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)); +# else +# if !@HAVE_PTHREAD_MUTEX_UNLOCK@ +_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_unlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutex_unlock +# if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK +_GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_MUTEX@ +# if @REPLACE_PTHREAD_MUTEX_DESTROY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_mutex_destroy +# define pthread_mutex_destroy rpl_pthread_mutex_destroy +# endif +_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)); +# else +# if !@HAVE_PTHREAD_MUTEX_DESTROY@ +_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_mutex_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_mutex_destroy +# if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY +_GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - " + "use gnulib module pthread-mutex for portability"); +# endif +#endif + +/* =========== Read-write lock functions =========== */ + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_INIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_init +# define pthread_rwlock_init rpl_pthread_rwlock_init +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_init, int, + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_init, int, + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr)); +# else +# if !@HAVE_PTHREAD_RWLOCK_INIT@ +_GL_FUNCDECL_SYS (pthread_rwlock_init, int, + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_init, int, + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_init); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_init +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT +_GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCKATTR_INIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlockattr_init +# define pthread_rwlockattr_init rpl_pthread_rwlockattr_init +# endif +_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)); +# else +# if !@HAVE_PTHREAD_RWLOCKATTR_INIT@ +_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlockattr_init); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlockattr_init +# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT +_GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlockattr_destroy +# define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy +# endif +_GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int, + (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int, + (pthread_rwlockattr_t *attr)); +# else +# if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@ +_GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int, + (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int, + (pthread_rwlockattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlockattr_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlockattr_destroy +# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY +_GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_RDLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_rdlock +# define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)); +# else +# if !@HAVE_PTHREAD_RWLOCK_RDLOCK@ +_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_rdlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_rdlock +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK +_GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_WRLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_wrlock +# define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)); +# else +# if !@HAVE_PTHREAD_RWLOCK_WRLOCK@ +_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_wrlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_wrlock +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK +_GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_tryrdlock +# define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)); +# else +# if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@ +_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_tryrdlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_tryrdlock +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK +_GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_trywrlock +# define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)); +# else +# if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@ +_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_trywrlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_trywrlock +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK +_GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_timedrdlock +# define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); +# else +# if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ +_GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_timedrdlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_timedrdlock +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK +_GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_timedwrlock +# define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); +# else +# if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ +_GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int, + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_timedwrlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_timedwrlock +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK +_GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_UNLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_unlock +# define pthread_rwlock_unlock rpl_pthread_rwlock_unlock +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)); +# else +# if !@HAVE_PTHREAD_RWLOCK_UNLOCK@ +_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_unlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_unlock +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK +_GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_RWLOCK@ +# if @REPLACE_PTHREAD_RWLOCK_DESTROY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_rwlock_destroy +# define pthread_rwlock_destroy rpl_pthread_rwlock_destroy +# endif +_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)); +# else +# if !@HAVE_PTHREAD_RWLOCK_DESTROY@ +_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_rwlock_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_rwlock_destroy +# if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY +_GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - " + "use gnulib module pthread-rwlock for portability"); +# endif +#endif + +/* =========== Condition variable functions =========== */ + +#if @GNULIB_PTHREAD_COND@ +# if @REPLACE_PTHREAD_COND_INIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_init +# define pthread_cond_init rpl_pthread_cond_init +# endif +_GL_FUNCDECL_RPL (pthread_cond_init, int, + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_cond_init, int, + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr)); +# else +# if !@HAVE_PTHREAD_COND_INIT@ +_GL_FUNCDECL_SYS (pthread_cond_init, int, + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_init, int, + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_init); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_cond_init +# if HAVE_RAW_DECL_PTHREAD_COND_INIT +_GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_COND@ +# if @REPLACE_PTHREAD_CONDATTR_INIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_condattr_init +# define pthread_condattr_init rpl_pthread_condattr_init +# endif +_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr)); +# else +# if !@HAVE_PTHREAD_CONDATTR_INIT@ +_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_condattr_init); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_condattr_init +# if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT +_GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_COND@ +# if @REPLACE_PTHREAD_CONDATTR_DESTROY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_condattr_destroy +# define pthread_condattr_destroy rpl_pthread_condattr_destroy +# endif +_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr)); +# else +# if !@HAVE_PTHREAD_CONDATTR_DESTROY@ +_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_condattr_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_condattr_destroy +# if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY +_GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_COND@ +# if @REPLACE_PTHREAD_COND_WAIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_wait +# define pthread_cond_wait rpl_pthread_cond_wait +# endif +_GL_FUNCDECL_RPL (pthread_cond_wait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (pthread_cond_wait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex)); +# else +# if !@HAVE_PTHREAD_COND_WAIT@ +_GL_FUNCDECL_SYS (pthread_cond_wait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_wait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_wait); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_cond_wait +# if HAVE_RAW_DECL_PTHREAD_COND_WAIT +_GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_COND@ +# if @REPLACE_PTHREAD_COND_TIMEDWAIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_timedwait +# define pthread_cond_timedwait rpl_pthread_cond_timedwait +# endif +_GL_FUNCDECL_RPL (pthread_cond_timedwait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2, 3))); +_GL_CXXALIAS_RPL (pthread_cond_timedwait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); +# else +# if !@HAVE_PTHREAD_COND_TIMEDWAIT@ +_GL_FUNCDECL_SYS (pthread_cond_timedwait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime), + _GL_ARG_NONNULL ((1, 2, 3))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_timedwait, int, + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_timedwait); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_cond_timedwait +# if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT +_GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_COND@ +# if @REPLACE_PTHREAD_COND_SIGNAL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_signal +# define pthread_cond_signal rpl_pthread_cond_signal +# endif +_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond)); +# else +# if !@HAVE_PTHREAD_COND_SIGNAL@ +_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_signal); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_cond_signal +# if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL +_GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_COND@ +# if @REPLACE_PTHREAD_COND_BROADCAST@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_broadcast +# define pthread_cond_broadcast rpl_pthread_cond_broadcast +# endif +_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond)); +# else +# if !@HAVE_PTHREAD_COND_BROADCAST@ +_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_broadcast); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_cond_broadcast +# if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST +_GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_COND@ +# if @REPLACE_PTHREAD_COND_DESTROY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_cond_destroy +# define pthread_cond_destroy rpl_pthread_cond_destroy +# endif +_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond)); +# else +# if !@HAVE_PTHREAD_COND_DESTROY@ +_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_cond_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_cond_destroy +# if HAVE_RAW_DECL_PTHREAD_COND_DESTROY +_GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - " + "use gnulib module pthread-cond for portability"); +# endif +#endif + +/* =========== Thread-specific storage functions =========== */ + +#if @GNULIB_PTHREAD_TSS@ +# if @REPLACE_PTHREAD_KEY_CREATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_key_create +# define pthread_key_create rpl_pthread_key_create +# endif +_GL_FUNCDECL_RPL (pthread_key_create, int, + (pthread_key_t *keyp, void (*destructor) (void *)), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_key_create, int, + (pthread_key_t *keyp, void (*destructor) (void *))); +# else +# if !@HAVE_PTHREAD_KEY_CREATE@ +_GL_FUNCDECL_SYS (pthread_key_create, int, + (pthread_key_t *keyp, void (*destructor) (void *)), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS_CAST (pthread_key_create, int, + (pthread_key_t *keyp, void (*destructor) (void *))); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_key_create); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_key_create +# if HAVE_RAW_DECL_PTHREAD_KEY_CREATE +_GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - " + "use gnulib module pthread-tss for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_TSS@ +# if @REPLACE_PTHREAD_SETSPECIFIC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_setspecific +# define pthread_setspecific rpl_pthread_setspecific +# endif +_GL_FUNCDECL_RPL (pthread_setspecific, int, + (pthread_key_t key, const void *value), ); +_GL_CXXALIAS_RPL (pthread_setspecific, int, + (pthread_key_t key, const void *value)); +# else +# if !@HAVE_PTHREAD_SETSPECIFIC@ +_GL_FUNCDECL_SYS (pthread_setspecific, int, + (pthread_key_t key, const void *value), ); +# endif +_GL_CXXALIAS_SYS (pthread_setspecific, int, + (pthread_key_t key, const void *value)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_setspecific); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_setspecific +# if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC +_GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - " + "use gnulib module pthread-tss for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_TSS@ +# if @REPLACE_PTHREAD_GETSPECIFIC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_getspecific +# define pthread_getspecific rpl_pthread_getspecific +# endif +_GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key), ); +_GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key)); +# else +# if !@HAVE_PTHREAD_GETSPECIFIC@ +_GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key), ); +# endif +_GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_getspecific); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_getspecific +# if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC +_GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - " + "use gnulib module pthread-tss for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_TSS@ +# if @REPLACE_PTHREAD_KEY_DELETE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_key_delete +# define pthread_key_delete rpl_pthread_key_delete +# endif +_GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key), ); +_GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key)); +# else +# if !@HAVE_PTHREAD_KEY_DELETE@ +_GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key), ); +# endif +_GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_key_delete); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_key_delete +# if HAVE_RAW_DECL_PTHREAD_KEY_DELETE +_GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - " + "use gnulib module pthread-tss for portability"); +# endif +#endif + +/* =========== Spinlock functions =========== */ + +#if @GNULIB_PTHREAD_SPIN@ +# if @REPLACE_PTHREAD_SPIN_INIT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_init +# define pthread_spin_init rpl_pthread_spin_init +# endif +_GL_FUNCDECL_RPL (pthread_spin_init, int, + (pthread_spinlock_t *lock, int shared_across_processes), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_init, int, + (pthread_spinlock_t *lock, int shared_across_processes)); +# else +# if !@HAVE_PTHREAD_SPIN_INIT@ +_GL_FUNCDECL_SYS (pthread_spin_init, int, + (pthread_spinlock_t *lock, int shared_across_processes), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_init, int, + (pthread_spinlock_t *lock, int shared_across_processes)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_init); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_spin_init +# if HAVE_RAW_DECL_PTHREAD_SPIN_INIT +_GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_SPIN@ +# if @REPLACE_PTHREAD_SPIN_LOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_lock +# define pthread_spin_lock rpl_pthread_spin_lock +# endif +_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock)); +# else +# if !@HAVE_PTHREAD_SPIN_LOCK@ +_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_lock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_spin_lock +# if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK +_GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_SPIN@ +# if @REPLACE_PTHREAD_SPIN_TRYLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_trylock +# define pthread_spin_trylock rpl_pthread_spin_trylock +# endif +_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock)); +# else +# if !@HAVE_PTHREAD_SPIN_TRYLOCK@ +_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_trylock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_spin_trylock +# if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK +_GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_SPIN@ +# if @REPLACE_PTHREAD_SPIN_UNLOCK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_unlock +# define pthread_spin_unlock rpl_pthread_spin_unlock +# endif +_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock)); +# else +# if !@HAVE_PTHREAD_SPIN_UNLOCK@ +_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_unlock); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_spin_unlock +# if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK +_GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + +#if @GNULIB_PTHREAD_SPIN@ +# if @REPLACE_PTHREAD_SPIN_DESTROY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_spin_destroy +# define pthread_spin_destroy rpl_pthread_spin_destroy +# endif +_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock)); +# else +# if !@HAVE_PTHREAD_SPIN_DESTROY@ +_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_spin_destroy); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_spin_destroy +# if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY +_GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - " + "use gnulib module pthread-spin for portability"); +# endif +#endif + + +#if defined __cplusplus && defined GNULIB_NAMESPACE && !@HAVE_PTHREAD_H@ && defined __MINGW32__ +/* Provide the symbols required by mingw's . */ +using GNULIB_NAMESPACE::pthread_create; +using GNULIB_NAMESPACE::pthread_self; +using GNULIB_NAMESPACE::pthread_equal; +using GNULIB_NAMESPACE::pthread_detach; +using GNULIB_NAMESPACE::pthread_join; +using GNULIB_NAMESPACE::pthread_once; +using GNULIB_NAMESPACE::pthread_mutex_init; +using GNULIB_NAMESPACE::pthread_mutexattr_init; +using GNULIB_NAMESPACE::pthread_mutexattr_settype; +using GNULIB_NAMESPACE::pthread_mutexattr_destroy; +using GNULIB_NAMESPACE::pthread_mutex_lock; +using GNULIB_NAMESPACE::pthread_mutex_trylock; +using GNULIB_NAMESPACE::pthread_mutex_timedlock; +using GNULIB_NAMESPACE::pthread_mutex_unlock; +using GNULIB_NAMESPACE::pthread_mutex_destroy; +using GNULIB_NAMESPACE::pthread_cond_wait; +using GNULIB_NAMESPACE::pthread_cond_timedwait; +using GNULIB_NAMESPACE::pthread_cond_signal; +using GNULIB_NAMESPACE::pthread_cond_broadcast; +using GNULIB_NAMESPACE::pthread_cond_destroy; +using GNULIB_NAMESPACE::pthread_key_create; +using GNULIB_NAMESPACE::pthread_setspecific; +using GNULIB_NAMESPACE::pthread_getspecific; +using GNULIB_NAMESPACE::pthread_key_delete; +#endif + + +#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */ +#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */ +#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 @@ /* realloc() function that is glibc compatible. - Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2024 Free Software + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify @@ -18,17 +18,21 @@ /* written by Jim Meyering and Bruno Haible */ +/* Ensure that we call the system's realloc() below. */ +#define _GL_USE_STDLIB_ALLOC 1 #include +#define _GL_REALLOC_INLINE _GL_EXTERN_INLINE #include #include +#include -#include "xalloc-oversized.h" +#ifdef __CHERI_PURE_CAPABILITY__ +# include +#endif -/* Call the system's realloc below. This file does not define - _GL_USE_STDLIB_ALLOC because it needs Gnulib's malloc if present. */ -#undef realloc +#ifndef _GL_INLINE_RPL_REALLOC /* Change the size of an allocated block of memory P to N bytes, with error checking. If P is NULL, use malloc. Otherwise if N is zero, @@ -37,27 +41,70 @@ void * rpl_realloc (void *p, size_t n) { - if (p == NULL) - return malloc (n); + size_t n1 = n; if (n == 0) { - free (p); - return NULL; +# if NEED_SANITIZED_REALLOC + /* When P is non-null, ISO C23 §7.24.3.7.(3) says realloc (P, 0) has + undefined behavior even though C17 and earlier partially defined + the behavior. Let the programmer know. + When the undefined-behaviour sanitizers report this case, i.e. when + and + + have been closed and new releases of GCC and clang have been made, + we can revisit this code. */ + if (p != NULL) + abort (); +# endif + + /* realloc (NULL, 0) acts like glibc malloc (0), i.e., like malloc (1) + except the caller cannot dereference any non-null return. + + realloc (P, 0) with non-null P is a messier situation. + As mentioned above, C23 says behavior is undefined. + POSIX.1-2024 extends C17 to say realloc (P, 0) + either fails by setting errno and returning a null pointer, + or succeeds by freeing P and then either: + (a) setting errno=EINVAL and returning a null pointer; or + (b) acting like a successful malloc (0). + glibc 1 through 2.1 realloc acted like (b), + which conforms to C17, to C23 and to POSIX.1-2024. + glibc 2.1.1+ realloc acts like (a) except it does not set errno; + this conforms to C17 and to C23 but not to POSIX.1-2024. + Quite possibly future versions of POSIX will change, + due either to C23 or to (a)'s semantics being messy. + Act like (b), as that's easy, matches GNU, BSD and V7 malloc, + matches BSD and V7 realloc, and requires no extra code at + caller sites. */ + +# if !HAVE_REALLOC_0_NONNULL + n1 = 1; +# endif } - if (xalloc_oversized (n, 1)) +# if !HAVE_MALLOC_PTRDIFF + ptrdiff_t signed_n; + if (ckd_add (&signed_n, n, 0)) { errno = ENOMEM; return NULL; } +# endif - void *result = realloc (p, n); + void *result = realloc (p, n1); -#if !HAVE_MALLOC_POSIX +# if !HAVE_REALLOC_POSIX if (result == NULL) errno = ENOMEM; -#endif +# endif + +# ifdef __CHERI_PURE_CAPABILITY__ + if (result != NULL) + result = cheri_bounds_set (result, n); +# endif return result; } + +#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 @@ /* reallocarray function that is glibc compatible. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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) return NULL; } - /* Rely on the semantics of GNU realloc. */ + /* Call realloc, setting errno to ENOMEM on failure. */ return realloc (ptr, nbytes); } 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 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -831,7 +831,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) if (table_size > pat_len) break; - dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); + dfa->state_table = calloc (table_size, sizeof (struct re_state_table_entry)); dfa->state_hash_mask = table_size - 1; dfa->mb_cur_max = MB_CUR_MAX; @@ -862,7 +862,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) { int i, j, ch; - dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); + dfa->sb_char = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t)); if (__glibc_unlikely (dfa->sb_char == NULL)) return REG_ESPACE; @@ -1001,21 +1001,25 @@ create_initial_state (re_dfa_t *dfa) Idx dest_idx = dfa->edests[node_idx].elems[0]; if (!re_node_set_contains (&init_nodes, dest_idx)) { - reg_errcode_t merge_err + err = re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx); - if (merge_err != REG_NOERROR) - return merge_err; + if (err != REG_NOERROR) + break; i = 0; } } } /* It must be the first time to invoke acquire_state. */ - dfa->init_state = re_acquire_state_context (&err, dfa, &init_nodes, 0); - /* We don't check ERR here, since the initial state must not be NULL. */ + dfa->init_state + = (err == REG_NOERROR + ? re_acquire_state_context (&err, dfa, &init_nodes, 0) + : NULL); if (__glibc_unlikely (dfa->init_state == NULL)) - return err; - if (dfa->init_state->has_constraint) + { + /* Don't check ERR here, as the initial state must not be null. */ + } + else if (dfa->init_state->has_constraint) { dfa->init_state_word = re_acquire_state_context (&err, dfa, &init_nodes, CONTEXT_WORD); @@ -1025,17 +1029,13 @@ create_initial_state (re_dfa_t *dfa) &init_nodes, CONTEXT_NEWLINE | CONTEXT_BEGBUF); - if (__glibc_unlikely (dfa->init_state_word == NULL - || dfa->init_state_nl == NULL - || dfa->init_state_begbuf == NULL)) - return err; } else dfa->init_state_word = dfa->init_state_nl = dfa->init_state_begbuf = dfa->init_state; re_node_set_free (&init_nodes); - return REG_NOERROR; + return err; } /* 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) { err = duplicate_node_closure (dfa, node, node, node, dfa->nodes[node].constraint); - if (__glibc_unlikely (err != REG_NOERROR)) - return err; } /* Expand each epsilon destination nodes. */ - if (IS_EPSILON_NODE(dfa->nodes[node].type)) + if (__glibc_likely (err == REG_NOERROR) + && IS_EPSILON_NODE (dfa->nodes[node].type)) for (i = 0; i < dfa->edests[node].nelem; ++i) { 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) { err = calc_eclosure_iter (&eclosure_elem, dfa, edest, false); if (__glibc_unlikely (err != REG_NOERROR)) - return err; + break; } else eclosure_elem = dfa->eclosures[edest]; /* Merge the epsilon closure of 'edest'. */ err = re_node_set_merge (&eclosure, &eclosure_elem); if (__glibc_unlikely (err != REG_NOERROR)) - return err; + break; /* If the epsilon closure of 'edest' is incomplete, the epsilon closure of this node is also incomplete. */ 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) } } - if (incomplete && !root) - dfa->eclosures[node].nelem = 0; + if (err != REG_NOERROR) + re_node_set_free (&eclosure); else - dfa->eclosures[node] = eclosure; - *new_set = eclosure; - return REG_NOERROR; + { + if (incomplete && !root) + dfa->eclosures[node].nelem = 0; + else + dfa->eclosures[node] = eclosure; + *new_set = eclosure; + } + + return err; } /* 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, _NL_COLLATE_SYMB_EXTRAMB); } #endif - sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); - mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); + sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t)); + mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t)); if (__glibc_unlikely (sbcset == NULL || mbcset == NULL)) { re_free (sbcset); @@ -3275,6 +3280,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, else { free_charset (mbcset); + mbcset = NULL; /* Build a tree for simple bracket. */ br_token.type = SIMPLE_BRACKET; br_token.opr.sbcset = sbcset; @@ -3288,7 +3294,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, *err = REG_ESPACE; parse_bracket_exp_free_return: re_free (sbcset); - free_charset (mbcset); + if (__glibc_likely (mbcset != NULL)) + free_charset (mbcset); return NULL; } @@ -3548,13 +3555,13 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, reg_errcode_t ret; bin_tree_t *tree; - sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); + sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t)); if (__glibc_unlikely (sbcset == NULL)) { *err = REG_ESPACE; return NULL; } - mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); + mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t)); if (__glibc_unlikely (mbcset == NULL)) { 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 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . 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 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989-2024 Free Software Foundation, Inc. + Copyright (C) 1985, 1989-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -66,15 +66,14 @@ typedef unsigned long int active_reg_t; /* The following bits are used to determine the regexp syntax we recognize. The set/not-set meanings are chosen so that Emacs syntax - remains the value 0. The bits are given in alphabetical order, and - the definitions shifted by one from the previous bit; thus, when we - add or remove a bit, only one other definition need change. */ + is the value 0 for Emacs 20 (2000) and earlier, and the value + RE_SYNTAX_EMACS for Emacs 21 (2001) and later. */ typedef unsigned long int reg_syntax_t; #ifdef __USE_GNU /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ -# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) +# define RE_BACKSLASH_ESCAPE_IN_LISTS 1ul /* If this bit is not set, then + and ? are operators, and \+ and \? are literals. @@ -215,7 +214,8 @@ extern reg_syntax_t re_syntax_options; (The [[[ comments delimit what gets put into the Texinfo file, so don't delete them!) */ /* [[[begin syntaxes]]] */ -# define RE_SYNTAX_EMACS 0 +# define RE_SYNTAX_EMACS \ + (RE_CHAR_CLASSES | RE_INTERVALS) # define RE_SYNTAX_AWK \ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ @@ -522,20 +522,6 @@ typedef struct /* Declarations for routines. */ -#ifndef _REGEX_NELTS -# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \ - && !defined __STDC_NO_VLA__) -# define _REGEX_NELTS(n) n -# else -# define _REGEX_NELTS(n) -# endif -#endif - -#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wvla" -#endif - #ifndef _Attr_access_ # ifdef __attr_access # define _Attr_access_(arg) __attr_access (arg) @@ -647,10 +633,12 @@ extern int re_exec (const char *); || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ || __clang_major__ >= 3 # define _Restrict_ __restrict -# elif 199901L <= __STDC_VERSION__ || defined restrict -# define _Restrict_ restrict # else -# define _Restrict_ +# if 199901L <= __STDC_VERSION__ || defined restrict +# define _Restrict_ restrict +# else +# define _Restrict_ +# endif # endif #endif /* For the ISO C99 syntax @@ -661,13 +649,15 @@ extern int re_exec (const char *); #ifndef _Restrict_arr_ # ifdef __restrict_arr # define _Restrict_arr_ __restrict_arr -# elif ((199901L <= __STDC_VERSION__ \ +# else +# if ((199901L <= __STDC_VERSION__ \ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ || __clang_major__ >= 3) \ && !defined __cplusplus) -# define _Restrict_arr_ _Restrict_ -# else -# define _Restrict_arr_ +# define _Restrict_arr_ _Restrict_ +# else +# define _Restrict_arr_ +# endif # endif #endif @@ -678,8 +668,7 @@ extern int regcomp (regex_t *_Restrict_ __preg, extern int regexec (const regex_t *_Restrict_ __preg, const char *_Restrict_ __String, size_t __nmatch, - regmatch_t __pmatch[_Restrict_arr_ - _REGEX_NELTS (__nmatch)], + regmatch_t __pmatch[_Restrict_arr_], int __eflags); extern 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, extern void regfree (regex_t *__preg); -#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) -# pragma GCC diagnostic pop -#endif - #ifdef __cplusplus } #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 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -937,8 +937,7 @@ re_node_set_alloc (re_node_set *set, Idx size) set->alloc = size; set->nelem = 0; set->elems = re_malloc (Idx, size); - if (__glibc_unlikely (set->elems == NULL) - && (MALLOC_0_IS_NONNULL || size != 0)) + if (__glibc_unlikely (set->elems == NULL)) return REG_ESPACE; return REG_NOERROR; } @@ -1596,7 +1595,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes, reg_errcode_t err; re_dfastate_t *newstate; - newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); + newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t)); if (__glibc_unlikely (newstate == NULL)) return NULL; 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, reg_errcode_t err; re_dfastate_t *newstate; - newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); + newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t)); if (__glibc_unlikely (newstate == NULL)) return NULL; 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 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -100,10 +100,12 @@ /* This is for other GNU distributions with internationalized messages. */ #if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include +# undef gettext # ifdef _LIBC -# undef gettext # define gettext(msgid) \ __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) +# else +# define gettext(msgid) dgettext ("gnulib", msgid) # endif #else # undef gettext @@ -436,12 +438,6 @@ typedef struct re_dfa_t re_dfa_t; #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) -#ifdef _LIBC -# define MALLOC_0_IS_NONNULL 1 -#elif !defined MALLOC_0_IS_NONNULL -# define MALLOC_0_IS_NONNULL 0 -#endif - #ifndef MAX # define MAX(a,b) ((a) < (b) ? (b) : (a)) #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 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -185,7 +185,7 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len); int regexec (const regex_t *__restrict preg, const char *__restrict string, - size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) + size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; Idx start, length; @@ -229,7 +229,7 @@ int attribute_compat_text_section __compat_regexec (const regex_t *__restrict preg, const char *__restrict string, size_t nmatch, - regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) + regmatch_t pmatch[], int eflags) { return regexec (preg, string, nmatch, pmatch, eflags & (REG_NOTBOL | REG_NOTEOL)); @@ -2271,7 +2271,7 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, these destinations and the results of the transition table. */ pstate = mctx->state_log[cur_idx]; log_nodes = pstate->entrance_nodes; - if (next_state != NULL) + if (next_state != NULL && next_state->entrance_nodes != NULL) { table_nodes = next_state->entrance_nodes; *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) continue; /* No. */ if (sub_top->path == NULL) { - sub_top->path = calloc (sizeof (state_array_t), - sl_str - sub_top->str_idx + 1); + sub_top->path = calloc (sl_str - sub_top->str_idx + 1, + sizeof (state_array_t)); if (sub_top->path == NULL) return REG_ESPACE; } @@ -3266,7 +3266,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) if (ndests == 0) { state->trtable = (re_dfastate_t **) - calloc (sizeof (re_dfastate_t *), SBC_MAX); + calloc (SBC_MAX, sizeof (re_dfastate_t *)); if (__glibc_unlikely (state->trtable == NULL)) return false; return true; @@ -3338,7 +3338,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) discern by looking at the character code: allocate a 256-entry transition table. */ trtable = state->trtable = - (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); + (re_dfastate_t **) calloc (SBC_MAX, sizeof (re_dfastate_t *)); if (__glibc_unlikely (trtable == NULL)) goto out_free; @@ -3369,7 +3369,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) transition tables, one starting at trtable[0] and one starting at trtable[SBC_MAX]. */ trtable = state->word_trtable = - (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX); + (re_dfastate_t **) calloc (2 * SBC_MAX, sizeof (re_dfastate_t *)); if (__glibc_unlikely (trtable == NULL)) goto out_free; 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* A GNU-like . + Copyright (C) 2008-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _GL_SCHED_H + +#if __GNUC__ >= 3 +#pragma GCC system_header +#endif + + +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +/* The include_next requires a split double-inclusion guard. */ +#if 1 +# if 1 +# include +# endif +# include_next +#endif + +#ifndef _GL_SCHED_H +#define _GL_SCHED_H + +/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +/* Get pid_t. + This is needed on glibc 2.11 (see + glibc bug ) + and Mac OS X 10.5. */ +#include + +#ifdef __KLIBC__ +/* On OS/2 kLIBC, struct sched_param is in spawn.h. */ +# include +#endif + +#ifdef __VMS +/* On OpenVMS, struct sched_param is in . */ +# include +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ +/* C++ compatible function declaration macros. + Copyright (C) 2010-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _GL_CXXDEFS_H +#define _GL_CXXDEFS_H + +/* Begin/end the GNULIB_NAMESPACE namespace. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { +# define _GL_END_NAMESPACE } +#else +# define _GL_BEGIN_NAMESPACE +# define _GL_END_NAMESPACE +#endif + +/* The three most frequent use cases of these macros are: + + * For providing a substitute for a function that is missing on some + platforms, but is declared and works fine on the platforms on which + it exists: + + #if @GNULIB_FOO@ + # if !@HAVE_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on all platforms, + but is broken/insufficient and needs to be replaced on some platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on some platforms + but is broken/insufficient and needs to be replaced on some of them and + is additionally either missing or undeclared on some other platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif +*/ + +/* _GL_EXTERN_C declaration; + performs the declaration with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C extern "C" +#else +# define _GL_EXTERN_C extern +#endif + +/* _GL_EXTERN_C_FUNC declaration; + performs the declaration of a function with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C_FUNC extern "C" +#else +/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax + are not allowed between 'extern' and the return type (see gnulib-common.m4). + */ +# define _GL_EXTERN_C_FUNC +#endif + +/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]); + declares a replacement function, named rpl_func, with the given prototype, + consisting of return type, parameters, and attributes. + Although attributes are optional, the comma before them is required + for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, + if needed, must be placed after the _GL_FUNCDECL_RPL invocation, + at the end of the declaration. + Examples: + _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW; + _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...), + _GL_ARG_NONNULL ((1))); + + Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front + of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's + because + [[...]] extern "C" ; + is invalid syntax in C++.) + */ +#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \ + _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__) +#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters + +/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to + parenthesized func otherwise. Parenthesization is needed in C23 if + the function is like strchr and so is a qualifier-generic macro + that expands to something more complicated. */ +#ifdef __cplusplus +# define _GL_FUNCDECL_SYS_NAME(func) func +#else +# define _GL_FUNCDECL_SYS_NAME(func) (func) +#endif + +/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); + declares the system function, named func, with the given prototype, + consisting of return type, parameters, and attributes. + Although attributes are optional, the comma before them is required + for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, + if needed, must be placed after the _GL_FUNCDECL_RPL invocation, + at the end of the declaration. + Examples: + _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW; + _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); + */ +#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters + +/* _GL_CXXALIAS_RPL (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to rpl_func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); + + Wrapping rpl_func in an object with an inline conversion operator + avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_MDA (func, rettype, parameters); + is to be used when func is a Microsoft deprecated alias, on native Windows. + It declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to _func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); + */ +#define _GL_CXXALIAS_MDA(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) + +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the "invalid conversion" error + that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::rpl_func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_MDA (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) + +/* _GL_CXXALIAS_SYS (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to the system provided function func, if GNULIB_NAMESPACE + is defined. + Example: + _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); + + Wrapping func in an object with an inline conversion operator + avoids a reference to func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function is picked among a set of overloaded functions, + namely the one with rettype2 and parameters2. Two consecutive casts + are used to silence the "cannot find a match" and "invalid conversion" + errors that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* The outer cast must be a reinterpret_cast. + The inner cast: When the function is defined as a set of overloaded + functions, it works as a static_cast<>, choosing the designated variant. + When the function is defined as a single variant, it works as a + reinterpret_cast<>. The parenthesized cast syntax works both ways. */ +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast((rettype2 (*) parameters2)(::func)); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN (func); + causes a warning to be emitted when ::func is used but not when + GNULIB_NAMESPACE::func is used. func must be defined without overloaded + variants. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN(func) \ + _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN_1(func,namespace) \ + _GL_CXXALIASWARN_2 (func, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_WARN_ON_USE (func, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN_2(func,namespace) \ + extern __typeof__ (func) func +# else +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN(func) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); + causes a warning to be emitted when the given overloaded variant of ::func + is used but not when GNULIB_NAMESPACE::func is used. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ + GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ + _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# else +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +#endif /* _GL_CXXDEFS_H */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ +/* A C macro for emitting warnings if a function is used. + Copyright (C) 2010-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* _GL_WARN_ON_USE (function, "literal string") issues a declaration + for FUNCTION which will then trigger a compiler warning containing + the text of "literal string" anywhere that function is called, if + supported by the compiler. If the compiler does not support this + feature, the macro expands to an unused extern declaration. + + _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the + attribute used in _GL_WARN_ON_USE. If the compiler does not support + this feature, it expands to empty. + + These macros are useful for marking a function as a potential + portability trap, with the intent that "literal string" include + instructions on the replacement function that should be used + instead. + _GL_WARN_ON_USE is for functions with 'extern' linkage. + _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' + linkage. + + _GL_WARN_ON_USE should not be used more than once for a given function + in a given compilation unit (because this may generate a warning even + if the function is never called). + + However, one of the reasons that a function is a portability trap is + if it has the wrong signature. Declaring FUNCTION with a different + signature in C is a compilation error, so this macro must use the + same type as any existing declaration so that programs that avoid + the problematic FUNCTION do not fail to compile merely because they + included a header that poisoned the function. But this implies that + _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already + have a declaration. Use of this macro implies that there must not + be any other macro hiding the declaration of FUNCTION; but + undefining FUNCTION first is part of the poisoning process anyway + (although for symbols that are provided only via a macro, the result + is a compilation error rather than a warning containing + "literal string"). Also note that in C++, it is only safe to use if + FUNCTION has no overloads. + + For an example, it is possible to poison 'getline' by: + - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], + [getline]) in configure.ac, which potentially defines + HAVE_RAW_DECL_GETLINE + - adding this code to a header that wraps the system : + #undef getline + #if HAVE_RAW_DECL_GETLINE + _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" + "not universally present; use the gnulib module getline"); + #endif + + It is not possible to directly poison global variables. But it is + possible to write a wrapper accessor function, and poison that + (less common usage, like &environ, will cause a compilation error + rather than issue the nice warning, but the end result of informing + the developer about their portability problem is still achieved): + #if HAVE_RAW_DECL_ENVIRON + static char *** + rpl_environ (void) { return &environ; } + _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); + # undef environ + # define environ (*rpl_environ ()) + #endif + or better (avoiding contradictory use of 'static' and 'extern'): + #if HAVE_RAW_DECL_ENVIRON + static char *** + _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") + rpl_environ (void) { return &environ; } + # undef environ + # define environ (*rpl_environ ()) + #endif + */ +#ifndef _GL_WARN_ON_USE + +# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__warning__ (message))) +# elif __clang_major__ >= 4 +/* Another compiler attribute is available in clang. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function \ + __attribute__ ((__diagnose_if__ (1, message, "warning"))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__diagnose_if__ (1, message, "warning"))) +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function +# define _GL_WARN_ON_USE_ATTRIBUTE(message) +# else /* Unsupported. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# define _GL_WARN_ON_USE_ATTRIBUTE(message) +# endif +#endif + +/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") + is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the + function is declared with the given prototype, consisting of return type, + parameters, and attributes. + This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does + not work in this case. */ +#ifndef _GL_WARN_ON_USE_CXX +# if !defined __cplusplus +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ + _GL_WARN_ON_USE (function, msg) +# else +# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes \ + __attribute__ ((__warning__ (msg))) +# elif __clang_major__ >= 4 +/* Another compiler attribute is available in clang. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_clang function parameters_and_attributes \ + __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes +# else /* Unsupported. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +# endif +#endif + +/* _GL_WARN_EXTERN_C declaration; + performs the declaration with C linkage. */ +#ifndef _GL_WARN_EXTERN_C +# if defined __cplusplus +# define _GL_WARN_EXTERN_C extern "C" +# else +# define _GL_WARN_EXTERN_C extern +# endif +#endif + +#if !1 + +# if !GNULIB_defined_struct_sched_param +struct sched_param +{ + int sched_priority; +}; +# define GNULIB_defined_struct_sched_param 1 +# endif + +#endif + +#if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER) +# define SCHED_FIFO 1 +# define SCHED_RR 2 +# define SCHED_OTHER 0 +#endif + +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sched_yield +# define sched_yield rpl_sched_yield +# endif +_GL_FUNCDECL_RPL (sched_yield, int, (void), ); +_GL_CXXALIAS_RPL (sched_yield, int, (void)); +# else +# if !1 +_GL_FUNCDECL_SYS (sched_yield, int, (void), ); +# endif +_GL_CXXALIAS_SYS (sched_yield, int, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (sched_yield); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_SCHED_YIELD +_GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - " + "use gnulib module sched_yield for portability"); +# endif +#endif + +#endif /* _GL_SCHED_H */ +#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 @@ +/* A GNU-like . + Copyright (C) 2008-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _@GUARD_PREFIX@_SCHED_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_SCHED_H@ +# if @HAVE_SYS_CDEFS_H@ +# include +# endif +# @INCLUDE_NEXT@ @NEXT_SCHED_H@ +#endif + +#ifndef _@GUARD_PREFIX@_SCHED_H +#define _@GUARD_PREFIX@_SCHED_H + +/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +/* Get pid_t. + This is needed on glibc 2.11 (see + glibc bug ) + and Mac OS X 10.5. */ +#include + +#ifdef __KLIBC__ +/* On OS/2 kLIBC, struct sched_param is in spawn.h. */ +# include +#endif + +#ifdef __VMS +/* On OpenVMS, struct sched_param is in . */ +# include +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +#if !@HAVE_STRUCT_SCHED_PARAM@ + +# if !GNULIB_defined_struct_sched_param +struct sched_param +{ + int sched_priority; +}; +# define GNULIB_defined_struct_sched_param 1 +# endif + +#endif + +#if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER) +# define SCHED_FIFO 1 +# define SCHED_RR 2 +# define SCHED_OTHER 0 +#endif + +#if @GNULIB_SCHED_YIELD@ +# if @REPLACE_SCHED_YIELD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sched_yield +# define sched_yield rpl_sched_yield +# endif +_GL_FUNCDECL_RPL (sched_yield, int, (void), ); +_GL_CXXALIAS_RPL (sched_yield, int, (void)); +# else +# if !@HAVE_SCHED_YIELD@ +_GL_FUNCDECL_SYS (sched_yield, int, (void), ); +# endif +_GL_CXXALIAS_SYS (sched_yield, int, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (sched_yield); +# endif +#elif defined GNULIB_POSIXCHECK +# undef sched_yield +# if HAVE_RAW_DECL_SCHED_YIELD +_GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - " + "use gnulib module sched_yield for portability"); +# endif +#endif + +#endif /* _@GUARD_PREFIX@_SCHED_H */ +#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 @@ -/* Copyright (C) 1992, 1995-2003, 2005-2024 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2003, 2005-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is free software: you can redistribute it and/or modify @@ -38,11 +38,23 @@ # include #endif +#if defined _WIN32 && ! defined __CYGWIN__ +# define WIN32_LEAN_AND_MEAN +# include +#endif + #if !_LIBC # include "malloca.h" #endif +#if defined _WIN32 && ! defined __CYGWIN__ +/* Don't assume that UNICODE is not defined. */ +# undef SetEnvironmentVariable +# define SetEnvironmentVariable SetEnvironmentVariableA +#endif + #if _LIBC || !HAVE_SETENV +#if !HAVE_DECL__PUTENV #if !_LIBC # define __environ environ @@ -215,8 +227,7 @@ __add_to_environ (const char *name, const char *value, const char *combined, } if (__environ != last_environ) - memcpy ((char *) new_environ, (char *) __environ, - size * sizeof (char *)); + memcpy (new_environ, __environ, size * sizeof (char *)); new_environ[size + 1] = NULL; @@ -343,6 +354,84 @@ weak_alias (__setenv, setenv) weak_alias (__clearenv, clearenv) #endif +#else /* HAVE_DECL__PUTENV */ +/* Native Windows */ + +int +setenv (const char *name, const char *value, int replace) +{ + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + errno = EINVAL; + return -1; + } + + /* The Microsoft documentation + + says: + "Don't change an environment entry directly: instead, + use _putenv or _wputenv to change it." + Note: Microsoft's _putenv updates not only the contents of _environ but + also the contents of _wenviron, so that both are in kept in sync. */ + const char *existing_value = getenv (name); + if (existing_value != NULL) + { + if (replace) + { + if (strcmp (existing_value, value) == 0) + /* No need to allocate memory. */ + return 0; + } + else + /* Keep the existing value. */ + return 0; + } + /* Allocate a new environment entry in the heap. */ + /* _putenv ("NAME=") unsets NAME, so if VALUE is the empty string, invoke + _putenv ("NAME= ") and fix up the result afterwards. */ + const char *value_ = (value[0] == '\0' ? " " : value); + size_t name_len = strlen (name); + size_t value_len = strlen (value_); + char *string = (char *) malloc (name_len + 1 + value_len + 1); + if (string == NULL) + return -1; + memcpy (string, name, name_len); + string[name_len] = '='; + memcpy (&string[name_len + 1], value_, value_len + 1); + /* Use _putenv. */ + if (_putenv (string) < 0) + return -1; + if (value[0] == '\0') + { + /* Fix up the result. */ + char *new_value = getenv (name); + if (new_value != NULL && new_value[0] == ' ' && new_value[1] == '\0') + new_value[0] = '\0'; +# if defined _WIN32 && ! defined __CYGWIN__ + /* _putenv propagated "NAME= " into the subprocess environment; + fix that by calling SetEnvironmentVariable directly. */ + /* Documentation: + */ + if (!SetEnvironmentVariable (name, "")) + { + switch (GetLastError ()) + { + case ERROR_NOT_ENOUGH_MEMORY: + case ERROR_OUTOFMEMORY: + errno = ENOMEM; + break; + default: + errno = EINVAL; + break; + } + return -1; + } +# endif + } + return 0; +} + +#endif /* HAVE_DECL__PUTENV */ #endif /* _LIBC || !HAVE_SETENV */ /* The rest of this file is called into use when replacing an existing @@ -360,7 +449,7 @@ int rpl_setenv (const char *name, const char *value, int replace) { int result; - if (!name || !*name || strchr (name, '=')) + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { errno = EINVAL; 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 @@ /* Return the internal lock used by setlocale_null_r. - Copyright (C) 2019-2024 Free Software Foundation, Inc. + Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Query the name of the current global locale, without locking. - Copyright (C) 2019-2024 Free Software Foundation, Inc. + Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Query the name of the current global locale. - Copyright (C) 2019-2024 Free Software Foundation, Inc. + Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Query the name of the current global locale. - Copyright (C) 2019-2024 Free Software Foundation, Inc. + Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or memory blocks according to the NIST specification FIPS-180-2. - Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -23,9 +23,6 @@ #include /* Specification. */ -#if HAVE_OPENSSL_SHA256 -# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE -#endif #include "sha256.h" #include @@ -136,10 +133,3 @@ sha224_stream (FILE *stream, void *resblock) return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE, sha224_init_ctx, sha224_finish_ctx); } - -/* - * Hey Emacs! - * Local Variables: - * coding: utf-8 - * End: - */ 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 @@ /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or memory blocks according to the NIST specification FIPS-180-2. - Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Declarations of functions and data types used for SHA256 and SHA224 sum library functions. - Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* size_max.h -- declare SIZE_MAX through system headers - Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2025 Free Software Foundation, Inc. Written by Simon Josefsson. 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 @@ /* Formatted output to strings. - Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc. - Written by Simon Josefsson and Paul Eggert. + Copyright (C) 2004, 2006-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -23,49 +22,25 @@ #include #include #include -#include -#include +#include -#include "vasnprintf.h" - -/* Print formatted output to string STR. Similar to sprintf, but - additional length SIZE limit how much is written into STR. Returns - string length of formatted string (which may be larger than SIZE). - STR may be NULL, in which case nothing will be written. On error, - return a negative value. */ int snprintf (char *str, size_t size, const char *format, ...) { - char *output; - size_t len; - size_t lenbuf = size; va_list args; + ptrdiff_t ret; va_start (args, format); - output = vasnprintf (str, &lenbuf, format, args); - len = lenbuf; + ret = vsnzprintf (str, size, format, args); va_end (args); - if (!output) - return -1; - - if (output != str) - { - if (size) - { - size_t pruned_len = (len < size ? len : size - 1); - memcpy (str, output, pruned_len); - str[pruned_len] = '\0'; - } - - free (output); - } - - if (INT_MAX < len) +#if PTRDIFF_MAX > INT_MAX + if (ret > INT_MAX) { errno = EOVERFLOW; return -1; } +#endif - return len; + return ret; } 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 @@ /* sockets.c --- wrappers for Windows socket functions - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* sockets.h - wrappers for Windows socket functions - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -52,7 +52,7 @@ int gl_sockets_cleanup (void) #endif -/* This function is useful it you create a socket using gnulib's +/* This function is useful if you create a socket using gnulib's Winsock wrappers but needs to pass on the socket handle to some other library that only accepts sockets. */ #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 @@ /* stat-related time functions. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* stat-related time functions. - Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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) # endif } +/* Constructs a 'struct timespec' with the given contents. + This macro / function is private to stat-time.h. */ +#if !defined __cplusplus +/* Use a C99 compound literal. + This is guaranteed to initialize also the padding bits, for example on + platforms where tv_sec is 64 bits and tv_nsec is 32 bits, thus avoiding + gcc -Wuse-of-uninitialized-value warnings. */ +# define _gl_make_timespec(sec,nsec) \ + (struct timespec) { .tv_sec = (sec), .tv_nsec = (nsec) } +#else +/* C++ does not have C99 compound literals. + A constructor invocation + timespec { (sec), (nsec) } + would make assumptions about the order of the fields of 'struct timespec', + which are not guaranteed by POSIX. So, use an inline function. */ +static inline struct timespec +_gl_make_timespec (time_t sec, long nsec) +{ + struct timespec ts; + ts.tv_sec = sec; + ts.tv_nsec = nsec; + return ts; +} +#endif + /* Return *ST's access time. */ _GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_atime (struct stat const *st) @@ -124,8 +149,7 @@ get_stat_atime (struct stat const *st) #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_atim); #else - return (struct timespec) { .tv_sec = st->st_atime, - .tv_nsec = get_stat_atime_ns (st) }; + return _gl_make_timespec (st->st_atime, get_stat_atime_ns (st)); #endif } @@ -136,8 +160,7 @@ get_stat_ctime (struct stat const *st) #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_ctim); #else - return (struct timespec) { .tv_sec = st->st_ctime, - .tv_nsec = get_stat_ctime_ns (st) }; + return _gl_make_timespec (st->st_ctime, get_stat_ctime_ns (st)); #endif } @@ -148,8 +171,7 @@ get_stat_mtime (struct stat const *st) #ifdef STAT_TIMESPEC return STAT_TIMESPEC (st, st_mtim); #else - return (struct timespec) { .tv_sec = st->st_mtime, - .tv_nsec = get_stat_mtime_ns (st) }; + return _gl_make_timespec (st->st_mtime, get_stat_mtime_ns (st)); #endif } @@ -164,8 +186,7 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC) t = STAT_TIMESPEC (st, st_birthtim); #elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC - t = (struct timespec) { .tv_sec = st->st_birthtime, - .tv_nsec = st->st_birthtimensec }; + t = _gl_make_timespec (st->st_birthtime, st->st_birthtimensec); #elif defined _WIN32 && ! defined __CYGWIN__ /* Native Windows platforms (but not Cygwin) put the "file creation time" in st_ctime (!). See @@ -173,11 +194,11 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) # if _GL_WINDOWS_STAT_TIMESPEC t = st->st_ctim; # else - t = (struct timespec) { .tv_sec = st->st_ctime }; + t = _gl_make_timespec (st->st_ctime, 0); # endif #else /* Birth time is not supported. */ - t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 }; + t = _gl_make_timespec (-1, -1); #endif #if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ @@ -189,7 +210,7 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st) sometimes returns junk in the birth time fields; work around this bug if it is detected. */ if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) - t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 }; + t = _gl_make_timespec (-1, -1); #endif 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 @@ /* Core of implementation of fstat and stat for native Windows. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Core of implementation of fstat and stat for native Windows. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Work around platform bugs in stat. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -118,6 +118,10 @@ rpl_stat (char const *name, struct stat *buf) around length limitations ? */ + /* To ease portability. Like in open.c. */ + if (strcmp (name, "/dev/null") == 0) + name = "NUL"; + /* POSIX specifies: "More than two leading characters shall be treated as a single 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 @@ /* stdckdint.h -- checked integer arithmetic - Copyright 2022-2024 Free Software Foundation, Inc. + Copyright 2022-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -15,10 +15,30 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ -#ifndef _GL_STDCKDINT_H -#define _GL_STDCKDINT_H +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ -#include "intprops-internal.h" +#ifndef _@GUARD_PREFIX@_STDCKDINT_H + +/* The include_next requires a split double-inclusion guard. */ +#if defined __cplusplus ? @HAVE_CXX_STDCKDINT_H@ : @HAVE_C_STDCKDINT_H@ +# @INCLUDE_NEXT@ @NEXT_STDCKDINT_H@ +#endif + +#ifndef _@GUARD_PREFIX@_STDCKDINT_H +#define _@GUARD_PREFIX@_STDCKDINT_H + +/* Do nothing but include the system header if it works properly. */ +# if defined __cplusplus ? !@HAVE_WORKING_CXX_STDCKDINT_H@ : !@HAVE_WORKING_C_STDCKDINT_H@ + +/* Avoid redefining macros. */ +# undef ckd_add +# undef ckd_sub +# undef ckd_mul + +# include "intprops-internal.h" /* Store into *R the low-order bits of A + B, A - B, A * B, respectively. Return 1 if the result overflows, 0 otherwise. @@ -26,10 +46,13 @@ bit-precise integer type, or an enumeration type. These are like the standard macros introduced in C23, except that - arguments should not have side effects. */ + arguments should not have side effects. The C++26 standard is + expected to add this header and it's macros. */ -#define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r)) -#define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r)) -#define ckd_mul(r, a, b) ((bool) _GL_INT_MULTIPLY_WRAPV (a, b, r)) +# define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r)) +# define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r)) +# define ckd_mul(r, a, b) ((bool) _GL_INT_MULTIPLY_WRAPV (a, b, r)) -#endif /* _GL_STDCKDINT_H */ +# endif /* defined __cplusplus ? @HAVE_WORKING_CXX_STDCKDINT_H@ : @HAVE_WORKING_C_STDCKDINT_H@ */ +#endif /* _@GUARD_PREFIX@_STDCKDINT_H */ +#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 @@ /* A substitute for POSIX 2008 , for platforms that have issues. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -27,13 +27,21 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_wchar_t || defined __need_size_t \ - || defined __need_ptrdiff_t || defined __need_NULL \ - || defined __need_wint_t +#if (defined __need_wchar_t || defined __need_size_t \ + || defined __need_ptrdiff_t || defined __need_NULL \ + || defined __need_wint_t) \ + /* Avoid warning triggered by "gcc -std=gnu23 -Wsystem-headers" \ + in GCC 13.3 and 14.2 \ + . */ \ + && !@STDDEF_NOT_IDEMPOTENT@ /* Special invocation convention inside gcc header files. In - particular, gcc provides a version of that blindly - redefines NULL even when __need_wint_t was defined, even though - wint_t is not normally provided by . Hence, we must + particular, in some ancient versions of GCC blindly + redefined NULL when __need_wint_t was defined, even though wint_t + is not normally provided by . + (FIXME: It's not clear what GCC versions those were - perhaps so + ancient that we can stop worrying about this?) + Although glibc 2.26 (2017) and later do not use __need_wint_t, + for portability to macOS, Cygwin, Haiku, and older Glibc + GCC, remember if special invocation has ever been used to obtain wint_t, in which case we need to clean up NULL yet again. */ @@ -52,6 +60,13 @@ # endif #else +/* For @STDDEF_NOT_IDEMPOTENT@. */ +# undef __need_wchar_t +# undef __need_size_t +# undef __need_ptrdiff_t +# undef __need_NULL +# undef __need_wint_t + /* Normal invocation convention. */ # ifndef _@GUARD_PREFIX@_STDDEF_H @@ -74,6 +89,12 @@ typedef long max_align_t; # endif # endif +# if !defined _GCC_NULLPTR_T && !@NULLPTR_T_NEEDS_STDDEF@ + /* Suppress unwanted nullptr_t typedef. See + . */ +# define _GCC_NULLPTR_T +# endif + /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ @@ -110,7 +131,7 @@ typedef long max_align_t; */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 +# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -128,11 +149,6 @@ typedef long max_align_t; # endif #endif -/* Some platforms lack wchar_t. */ -#if !@HAVE_WCHAR_T@ -# define wchar_t int -#endif - /* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is a hack in case the configure-time test was done with g++ even though we are currently compiling with gcc. @@ -172,38 +188,57 @@ typedef union #endif /* ISO C 23 § 7.21.1 The unreachable macro */ -#ifndef unreachable +/* This macro is only usable in C, not in C++. + There is no way to define it as a macro in C++, because that would break code + that does + #include + ... std::unreachable() ... + Similarly, there is no way to define it as an inline function in C++, because + that would break code that does + #include + using std::unreachable; + As a workaround, we define a macro gl_unreachable, that is like unreachable, + but is usable in both C and C++. */ /* Code borrowed from verify.h. */ -# ifndef _GL_HAS_BUILTIN_UNREACHABLE -# if defined __clang_major__ && __clang_major__ < 5 -# define _GL_HAS_BUILTIN_UNREACHABLE 0 -# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) -# define _GL_HAS_BUILTIN_UNREACHABLE 1 -# elif defined __has_builtin -# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) -# else -# define _GL_HAS_BUILTIN_UNREACHABLE 0 -# endif +#ifndef _GL_HAS_BUILTIN_UNREACHABLE +# if defined __clang_major__ && __clang_major__ < 5 +# define _GL_HAS_BUILTIN_UNREACHABLE 0 +# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__ +# define _GL_HAS_BUILTIN_UNREACHABLE 1 +# elif defined __has_builtin +# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) +# else +# define _GL_HAS_BUILTIN_UNREACHABLE 0 # endif +#endif -# if _GL_HAS_BUILTIN_UNREACHABLE -# define unreachable() __builtin_unreachable () -# elif 1200 <= _MSC_VER -# define unreachable() __assume (0) -# else +#if _GL_HAS_BUILTIN_UNREACHABLE +# define gl_unreachable() __builtin_unreachable () +#elif 1200 <= _MSC_VER +# define gl_unreachable() __assume (0) +#elif !defined __cplusplus && @HAVE_C_UNREACHABLE@ +# define gl_unreachable() unreachable () +#else /* Declare abort(), without including . */ extern -# if defined __cplusplus +# if defined __cplusplus "C" -# endif +# endif _Noreturn void abort (void) -# if defined __cplusplus && (__GLIBC__ >= 2) +# if defined __cplusplus && (__GLIBC__ >= 2) _GL_ATTRIBUTE_NOTHROW -# endif +# endif ; -# define unreachable() abort () +# define gl_unreachable() abort () +#endif + +#if !defined __cplusplus && !@HAVE_C_UNREACHABLE@ +/* In C, define unreachable as a macro. */ + +# ifndef unreachable +# define unreachable() gl_unreachable () # endif #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 @@ -/* Copyright (C) 2001-2002, 2004-2024 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2025 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -80,7 +80,7 @@ #define _@GUARD_PREFIX@_STDINT_H /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, - LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ + LONG_MIN, LONG_MAX, ULONG_MAX, CHAR_BIT, _GL_INTEGER_WIDTH. */ #include /* Override WINT_MIN and WINT_MAX if gnulib's or overrides @@ -189,6 +189,10 @@ typedef __int64 gl_int64_t; # define int64_t gl_int64_t # define GL_INT64_T # else +/* Verify that 'long long' has exactly 64 bits. */ +typedef _gl_verify_int64_bits[ + _STDINT_MAX (1, sizeof (long long) * CHAR_BIT, 0ll) >> 31 >> 31 == 1 + ? 1 : -1]; # undef int64_t typedef long long int gl_int64_t; # define int64_t gl_int64_t @@ -210,6 +214,11 @@ typedef unsigned __int64 gl_uint64_t; # define uint64_t gl_uint64_t # define GL_UINT64_T # else +/* Verify that 'unsigned long long' has exactly 64 bits. */ +typedef _gl_verify_uint64_bits[ + _STDINT_MAX (0, sizeof (unsigned long long) * CHAR_BIT, 0ull) + >> 31 >> 31 >> 1 == 1 + ? 1 : -1]; # undef uint64_t typedef unsigned long long int gl_uint64_t; # 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 @@ +/* msvcrt workarounds. + Copyright (C) 2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#include +#include +#include + +/* Outputs N bytes starting at S to FP. + These N bytes are known to be followed by a NUL. + Finally frees the string at S. + Returns the number of written bytes. */ +static size_t +workaround_fwrite0 (char *s, size_t n, FILE *fp) +{ + const char *ptr = s; + /* Use fputs instead of fwrite, which is buggy in msvcrt. */ + size_t written = 0; + while (n > 0) + { + size_t l = strlen (ptr); /* 0 <= l <= n */ + if (l > 0) + { + if (fputs (ptr, fp) == EOF) + break; + written += l; + n -= l; + } + if (n == 0) + break; + if (fputc ('\0', fp) == EOF) + break; + written++; + n--; + ptr += l + 1; + } + free (s); + return written; +} + +size_t +gl_consolesafe_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *fp) +{ + size_t nbytes; + if (ckd_mul (&nbytes, size, nmemb) || nbytes == 0) + /* Overflow, or nothing to do. */ + return 0; + char *tmp = malloc (nbytes + 1); + if (tmp == NULL) + return 0; + memcpy (tmp, ptr, nbytes); + tmp[nbytes] = '\0'; + size_t written = workaround_fwrite0 (tmp, nbytes, fp); + return written / size; +} + +#if defined __MINGW32__ && __USE_MINGW_ANSI_STDIO + +# include "fseterr.h" +# include + +# if !HAVE_VASPRINTF + +# include + +/* The old mingw (before mingw-w64) does not have the vasprintf function. + Define a suitable replacement here, that supports the same format + specifiers as the mingw *printf functions. */ + +static int +vasprintf (char **resultp, const char *format, va_list args) +{ + /* First try: Use a stack-allocated buffer. */ + char buf[2048]; + size_t bufsize = sizeof (buf); + int ret = __mingw_vsnprintf (buf, bufsize, format, args); + if (ret < 0) + return -1; + size_t nbytes = ret; + char *mem = (char *) malloc (nbytes + 1); + if (mem == NULL) + { + errno = ENOMEM; + return -1; + } + if (ret < bufsize) + { + /* The buffer was sufficiently large. */ + memcpy (mem, buf, nbytes + 1); + } + else + { + /* Second try: Use the heap-allocated memory. */ + ret = __mingw_vsnprintf (mem, nbytes + 1, format, args); + if (ret < 0) + { + int saved_errno = errno; + free (mem); + errno = saved_errno; + return -1; + } + if (ret != nbytes) + abort (); + } + *resultp = mem; + return nbytes; +} + +# endif + +/* Bypass the functions __mingw_[v][f]printf, that trigger a bug in msvcrt, + but without losing the support for modern format specifiers added by + __mingw_*printf. */ + +int +gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...) +{ + va_list args; + char *tmpstring; + va_start (args, format); + int result = vasprintf (&tmpstring, format, args); + va_end (args); + if (result >= 0) + { + if (workaround_fwrite0 (tmpstring, result, fp) < result) + result = -1; + } + else + fseterr (fp); + return result; +} + +int +gl_consolesafe_printf (const char *restrict format, ...) +{ + va_list args; + char *tmpstring; + va_start (args, format); + int result = vasprintf (&tmpstring, format, args); + va_end (args); + if (result >= 0) + { + if (workaround_fwrite0 (tmpstring, result, stdout) < result) + result = -1; + } + else + fseterr (stdout); + return result; +} + +int +gl_consolesafe_vfprintf (FILE *restrict fp, + const char *restrict format, va_list args) +{ + char *tmpstring; + int result = vasprintf (&tmpstring, format, args); + if (result >= 0) + { + if (workaround_fwrite0 (tmpstring, result, fp) < result) + result = -1; + } + else + fseterr (fp); + return result; +} + +int +gl_consolesafe_vprintf (const char *restrict format, va_list args) +{ + char *tmpstring; + int result = vasprintf (&tmpstring, format, args); + if (result >= 0) + { + if (workaround_fwrite0 (tmpstring, result, stdout) < result) + result = -1; + } + else + fseterr (stdout); + return result; +} + +#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 @@ /* Implementation details of FILE streams. - Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2008, 2010-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -30,6 +30,49 @@ # endif #endif +/* Haiku stdio implementation. */ +#if defined __HAIKU__ +# include +/* This FILE structure was made into an incomplete type in 2025. + See . */ +# define fp_ ((struct { int _flags; \ + char *_IO_read_ptr; \ + char *_IO_read_end; \ + char *_IO_read_base; \ + char *_IO_write_base; \ + char *_IO_write_ptr; \ + char *_IO_write_end; \ + char *_IO_buf_base; \ + char *_IO_buf_end; \ + char *_IO_save_base; \ + char *_IO_backup_base; \ + char *_IO_save_end; \ + void *_markers; \ + void *_chain; \ + int _fileno; \ + int _flags2; \ + off_t _old_offset; \ + unsigned short _cur_column; \ + signed char _vtable_offset; \ + char _shortbuf[1]; \ + void *_lock; \ + int64_t _offset; \ + /* More fields, not relevant here. */ \ + } *) fp) +# if !defined _IO_UNBUFFERED +# define _IO_UNBUFFERED 0x2 +# endif +# if !defined _IO_EOF_SEEN +# define _IO_EOF_SEEN 0x10 +# endif +# if !defined _IO_IN_BACKUP +# define _IO_IN_BACKUP 0x100 +# endif +# if !defined _IO_LINE_BUF +# define _IO_LINE_BUF 0x200 +# endif +#endif + /* BSD stdio derived implementations. */ #if defined __NetBSD__ /* NetBSD */ @@ -39,7 +82,7 @@ #include /* For detecting Plan9. */ -#if defined __sferror || defined __DragonFly__ || defined __ANDROID__ +#if defined __sferror || defined __OpenBSD__ || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __DragonFly__ /* DragonFly */ @@ -65,13 +108,59 @@ # define _flags pub._flags # define _r pub._r # define _w pub._w -# elif defined __ANDROID__ /* Android */ -# ifdef __LP64__ +# elif defined __OpenBSD__ /* OpenBSD */ +# if defined __sferror /* OpenBSD <= 7.7 */ +# define _gl_flags_file_t short +# else /* OpenBSD >= 7.8 */ +# define _gl_flags_file_t int +# endif + /* Up to this commit from 2025-07-16 + + the innards of FILE were public. After this commit, the innards of FILE + are hidden. In this commit + + they were reshuffled. */ +# if defined __sferror /* OpenBSD <= 7.7 */ +# define fp_ ((struct { unsigned char *_p; \ + int _r; \ + int _w; \ + _gl_flags_file_t _flags; \ + _gl_flags_file_t _file; \ + struct { unsigned char *_base; size_t _size; } _bf; \ + int _lbfsize; \ + void *_cookie; \ + void *_close; \ + void *_read; \ + void *_seek; \ + void *_write; \ + struct { unsigned char *_base; size_t _size; } _ext; \ + unsigned char *_up; \ + int _ur; \ + unsigned char _ubuf[3]; \ + unsigned char _nbuf[1]; \ + struct { unsigned char *_base; size_t _size; } _lb; \ + int _blksize; \ + fpos_t _offset; \ + /* More fields, not relevant here. */ \ + } *) fp) +# else /* OpenBSD >= 7.8 */ +# define fp_ ((struct { _gl_flags_file_t _flags; \ + _gl_flags_file_t _file; \ + unsigned char *_p; \ + int _r; \ + int _w; \ + struct { unsigned char *_base; size_t _size; } _bf; \ + int _lbfsize; \ + /* More fields, not relevant here. */ \ + } *) fp) +# endif +# elif defined __ANDROID__ /* Android */ +# if defined __LP64__ # define _gl_flags_file_t int # else # define _gl_flags_file_t short # endif -# ifdef __LP64__ +# if defined __LP64__ # define _gl_file_offset_t int64_t # else /* see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */ @@ -79,7 +168,7 @@ # endif /* Up to this commit from 2015-10-12 - the innards of FILE were public, and fp_ub could be defined like for OpenBSD, + the innards of FILE were public, see and . After this commit, the innards of FILE are hidden. */ @@ -109,9 +198,8 @@ # define fp_ fp # endif -# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */ - /* See - and +# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __minix /* NetBSD >= 1.5ZA, Minix 3 */ + /* See and */ struct __sfileext { @@ -119,7 +207,7 @@ /* More fields, not relevant here. */ }; # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub -# elif defined __ANDROID__ /* Android */ +# elif defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */ struct __sfileext { struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */ @@ -132,9 +220,11 @@ # define HASUB(fp) (fp_ub._base != NULL) -# if defined __ANDROID__ /* Android */ - /* Needed after this commit from 2016-01-25 - */ +# if defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */ + /* Needed after this Android commit from 2016-01-25 + + And after this OpenBSD commit from 2025-07-16 + . */ # ifndef __SEOF # define __SLBF 1 # 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 @@ /* POSIX compatible FILE stream read function. - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 @@ /* POSIX compatible FILE stream write function. - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This file is free software: you can redistribute it and/or modify @@ -162,6 +162,9 @@ vprintf (const char *format, va_list args) int vfprintf (FILE *stream, const char *format, va_list args) #undef vfprintf +#if defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# define vfprintf gl_consolesafe_vfprintf +#endif { CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF) } @@ -198,6 +201,9 @@ puts (const char *string) size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream) #undef fwrite +#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT +# define fwrite gl_consolesafe_fwrite +#endif { CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n) } 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 @@ /* A GNU-like . - Copyright (C) 2004, 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -20,7 +20,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H +#if defined __need_FILE || defined __need___FILE || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H || defined _GL_SKIP_GNULIB_STDIO_H /* Special invocation convention: - Inside glibc header files. - On OSF/1 5.1 we have a sequence of nested includes @@ -48,12 +48,12 @@ # endif #endif -#define _GL_ALREADY_INCLUDING_STDIO_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ -#undef _GL_ALREADY_INCLUDING_STDIO_H +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H #ifdef _GL_DEFINED__POSIX_C_SOURCE # undef _GL_DEFINED__POSIX_C_SOURCE @@ -64,8 +64,8 @@ #define _@GUARD_PREFIX@_STDIO_H /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT, - _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, - HAVE_RAW_DECL_*. */ + _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, + GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ #if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif @@ -77,7 +77,8 @@ /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 and eglibc 2.11.2. - May also define off_t to a 64-bit type on native Windows. */ + May also define off_t to a 64-bit type on native Windows. + Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ #include /* Solaris 10 and NetBSD 7.0 declare renameat in , not in . */ @@ -119,7 +120,7 @@ that can be freed by passing them as the Ith argument to the function F. */ #ifndef _GL_ATTRIBUTE_DEALLOC -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) # else # define _GL_ATTRIBUTE_DEALLOC(f, i) @@ -154,7 +155,7 @@ */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 +# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -177,7 +178,7 @@ standardized by ISO C99 and POSIX. _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ /* __gnu_printf__ is supported in GCC >= 4.4. */ -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +#if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4) && !defined __clang__ # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ #else # define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ @@ -279,18 +280,64 @@ #endif +#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT +/* Workarounds against msvcrt bugs. */ +_GL_FUNCDECL_SYS (gl_consolesafe_fwrite, size_t, + (const void *ptr, size_t size, size_t nmemb, FILE *fp), + _GL_ARG_NONNULL ((1, 4))); +# if defined __MINGW32__ +_GL_FUNCDECL_SYS (gl_consolesafe_fprintf, int, + (FILE *restrict fp, const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_SYS (gl_consolesafe_printf, int, + (const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (gl_consolesafe_vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_SYS (gl_consolesafe_vprintf, int, + (const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) + _GL_ARG_NONNULL ((1))); +# endif +#endif + + +#if @GNULIB_DZPRINTF@ +/* Prints formatted output to file descriptor FD. + Returns the number of bytes written to the file descriptor. Upon + failure, returns -1 with errno set. + Failure code EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure codes are ENOMEM + and the possible failure codes from write(), excluding EINTR. */ +_GL_FUNCDECL_SYS (dzprintf, off64_t, + (int fd, const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_SYS (dzprintf, off64_t, + (int fd, const char *restrict format, ...)); +#endif + #if @GNULIB_DPRINTF@ +/* Prints formatted output to file descriptor FD. + Returns the number of bytes written to the file descriptor. Upon + failure, returns a negative value. */ # if @REPLACE_DPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dprintf rpl_dprintf # endif -_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) +_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); # else # if !@HAVE_DPRINTF@ -_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) +_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((2))); # endif @@ -313,7 +360,7 @@ _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fclose rpl_fclose # endif -_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (fclose, int, (FILE *stream), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); @@ -360,9 +407,10 @@ _GL_CXXALIASWARN (fcloseall); # define fdopen rpl_fdopen # endif _GL_FUNCDECL_RPL (fdopen, FILE *, - (int fd, const char *mode) + (int fd, const char *mode), _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -371,36 +419,38 @@ _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); # endif _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); # else -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (fdopen, FILE *, - (int fd, const char *mode) - _GL_ATTRIBUTE_NOTHROW + (int fd, const char *mode), _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC + _GL_ATTRIBUTE_NODISCARD) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (fdopen, FILE *, - (int fd, const char *mode) + (int fd, const char *mode), _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC + _GL_ATTRIBUTE_NODISCARD); # endif # endif _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); # endif _GL_CXXALIASWARN (fdopen); #else -# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen +# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fdopen /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (fdopen, FILE *, - (int fd, const char *mode) - _GL_ATTRIBUTE_NOTHROW + (int fd, const char *mode), _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (fdopen, FILE *, - (int fd, const char *mode) + (int fd, const char *mode), _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) _GL_ATTRIBUTE_MALLOC); # endif @@ -438,7 +488,7 @@ _GL_CXXALIASWARN (fdopen); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fflush rpl_fflush # endif -_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); +_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream), ); _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); # else _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); @@ -459,7 +509,7 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " # undef fgetc # define fgetc rpl_fgetc # endif -_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); @@ -476,8 +526,8 @@ _GL_CXXALIASWARN (fgetc); # define fgets rpl_fgets # endif _GL_FUNCDECL_RPL (fgets, char *, - (char *restrict s, int n, FILE *restrict stream) - _GL_ARG_NONNULL ((1, 3))); + (char *restrict s, int n, FILE *restrict stream), + _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (fgets, char *, (char *restrict s, int n, FILE *restrict stream)); # else @@ -513,17 +563,18 @@ _GL_CXXALIASWARN (fileno); # define fopen rpl_fopen # endif _GL_FUNCDECL_RPL (fopen, FILE *, - (const char *restrict filename, const char *restrict mode) + (const char *restrict filename, const char *restrict mode), _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (fopen, FILE *, (const char *restrict filename, const char *restrict mode)); # else -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ _GL_FUNCDECL_SYS (fopen, FILE *, - (const char *restrict filename, const char *restrict mode) - _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); + (const char *restrict filename, const char *restrict mode), + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) + _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (fopen, FILE *, (const char *restrict filename, const char *restrict mode)); @@ -532,10 +583,10 @@ _GL_CXXALIAS_SYS (fopen, FILE *, _GL_CXXALIASWARN (fopen); # endif #else -# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen +# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fopen /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ _GL_FUNCDECL_SYS (fopen, FILE *, - (const char *restrict filename, const char *restrict mode) + (const char *restrict filename, const char *restrict mode), _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif # if defined GNULIB_POSIXCHECK @@ -546,7 +597,26 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian # endif #endif +#if @GNULIB_FZPRINTF@ +/* Prints formatted output to stream FP. + Returns the number of bytes written to the stream. Upon failure, + returns -1 with the stream's error indicator set. + Failure cause EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure causes are ENOMEM + and the possible failure causes from fwrite(). */ +_GL_FUNCDECL_SYS (fzprintf, off64_t, + (FILE *restrict fp, const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (fzprintf, off64_t, + (FILE *restrict fp, const char *restrict format, ...)); +#endif + #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ +/* Prints formatted output to stream FP. + Returns the number of bytes written to the stream. Upon failure, + returns a negative value with the stream's error indicator set. */ # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -555,12 +625,12 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian # define GNULIB_overrides_fprintf 1 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL (fprintf, int, - (FILE *restrict fp, const char *restrict format, ...) + (FILE *restrict fp, const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); # else _GL_FUNCDECL_RPL (fprintf, int, - (FILE *restrict fp, const char *restrict format, ...) + (FILE *restrict fp, const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif @@ -573,6 +643,11 @@ _GL_CXXALIAS_SYS (fprintf, int, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fprintf); # endif +#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fprintf +# define fprintf gl_consolesafe_fprintf +# endif #endif #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_fprintf @@ -595,15 +670,17 @@ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fpurge rpl_fpurge # endif -_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); # else # if !@HAVE_DECL_FPURGE@ -_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (fpurge); +# endif #elif defined GNULIB_POSIXCHECK # undef fpurge # if HAVE_RAW_DECL_FPURGE @@ -618,7 +695,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " # undef fputc # define fputc rpl_fputc # endif -_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); # else _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); @@ -635,7 +712,7 @@ _GL_CXXALIASWARN (fputc); # define fputs rpl_fputs # endif _GL_FUNCDECL_RPL (fputs, int, - (const char *restrict string, FILE *restrict stream) + (const char *restrict string, FILE *restrict stream), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (fputs, int, (const char *restrict string, FILE *restrict stream)); @@ -656,8 +733,8 @@ _GL_CXXALIASWARN (fputs); # endif _GL_FUNCDECL_RPL (fread, size_t, (void *restrict ptr, size_t s, size_t n, - FILE *restrict stream) - _GL_ARG_NONNULL ((4))); + FILE *restrict stream), + _GL_ARG_NONNULL ((4)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (fread, size_t, (void *restrict ptr, size_t s, size_t n, FILE *restrict stream)); @@ -679,8 +756,8 @@ _GL_CXXALIASWARN (fread); # endif _GL_FUNCDECL_RPL (freopen, FILE *, (const char *restrict filename, const char *restrict mode, - FILE *restrict stream) - _GL_ARG_NONNULL ((2, 3))); + FILE *restrict stream), + _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (freopen, FILE *, (const char *restrict filename, const char *restrict mode, FILE *restrict stream)); @@ -707,9 +784,9 @@ _GL_WARN_ON_USE (freopen, # define fscanf rpl_fscanf # endif _GL_FUNCDECL_RPL (fscanf, int, - (FILE *restrict stream, const char *restrict format, ...) + (FILE *restrict stream, const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) - _GL_ARG_NONNULL ((1, 2))); + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (fscanf, int, (FILE *restrict stream, const char *restrict format, ...)); # else @@ -763,7 +840,7 @@ _GL_CXXALIASWARN (fscanf); # undef fseek # define fseek rpl_fseek # endif -_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) +_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); # else @@ -786,12 +863,12 @@ _GL_CXXALIASWARN (fseek); # undef fseeko # define fseeko rpl_fseeko # endif -_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) +_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); # else # if ! @HAVE_DECL_FSEEKO@ -_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) +_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence), _GL_ARG_NONNULL ((1))); # endif _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 " # undef ftell # define ftell rpl_ftell # endif -_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (ftell, long, (FILE *fp), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); # else _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); @@ -849,11 +927,13 @@ _GL_CXXALIASWARN (ftell); # undef ftello # define ftello rpl_ftello # endif -_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); # else # if ! @HAVE_DECL_FTELLO@ -_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); # endif @@ -886,7 +966,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " # endif _GL_FUNCDECL_RPL (fwrite, size_t, (const void *restrict ptr, size_t s, size_t n, - FILE *restrict stream) + FILE *restrict stream), _GL_ARG_NONNULL ((1, 4))); _GL_CXXALIAS_RPL (fwrite, size_t, (const void *restrict ptr, size_t s, size_t n, @@ -901,9 +981,9 @@ _GL_CXXALIAS_SYS (fwrite, size_t, which sometimes causes an unwanted diagnostic for fwrite calls. This affects only function declaration attributes under certain versions of gcc and clang, and is not needed for C++. */ -# if (0 < __USE_FORTIFY_LEVEL \ +# if (0 < __USE_FORTIFY_LEVEL \ && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ - && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ + && (3 < __GNUC__ + (4 <= __GNUC_MINOR__) || defined __clang__) \ && !defined __cplusplus) # undef fwrite # undef fwrite_unlocked @@ -922,6 +1002,11 @@ _GL_EXTERN_C size_t __REDIRECT (rpl_fwrite_unlocked, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fwrite); # endif +#elif (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fwrite +# define fwrite gl_consolesafe_fwrite +# endif #endif #if @GNULIB_GETC@ @@ -930,7 +1015,7 @@ _GL_CXXALIASWARN (fwrite); # undef getc # define getc rpl_fgetc # endif -_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); # else _GL_CXXALIAS_SYS (getc, int, (FILE *stream)); @@ -946,7 +1031,7 @@ _GL_CXXALIASWARN (getc); # undef getchar # define getchar rpl_getchar # endif -_GL_FUNCDECL_RPL (getchar, int, (void)); +_GL_FUNCDECL_RPL (getchar, int, (void), ); _GL_CXXALIAS_RPL (getchar, int, (void)); # else _GL_CXXALIAS_SYS (getchar, int, (void)); @@ -971,8 +1056,8 @@ _GL_CXXALIASWARN (getchar); _GL_FUNCDECL_RPL (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, - FILE *restrict stream) - _GL_ARG_NONNULL ((1, 2, 4))); + FILE *restrict stream), + _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, @@ -982,8 +1067,8 @@ _GL_CXXALIAS_RPL (getdelim, ssize_t, _GL_FUNCDECL_SYS (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, - FILE *restrict stream) - _GL_ARG_NONNULL ((1, 2, 4))); + FILE *restrict stream), + _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, @@ -1015,8 +1100,8 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " # endif _GL_FUNCDECL_RPL (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, - FILE *restrict stream) - _GL_ARG_NONNULL ((1, 2, 3))); + FILE *restrict stream), + _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream)); @@ -1024,8 +1109,8 @@ _GL_CXXALIAS_RPL (getline, ssize_t, # if !@HAVE_DECL_GETLINE@ _GL_FUNCDECL_SYS (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, - FILE *restrict stream) - _GL_ARG_NONNULL ((1, 2, 3))); + FILE *restrict stream), + _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, @@ -1064,7 +1149,7 @@ _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream)); # if @HAVE_DECL_GETW@ # if defined __APPLE__ && defined __MACH__ /* The presence of the declaration depends on _POSIX_C_SOURCE. */ -_GL_FUNCDECL_SYS (getw, int, (FILE *restrict stream)); +_GL_FUNCDECL_SYS (getw, int, (FILE *restrict stream), ); # endif _GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); # endif @@ -1074,19 +1159,45 @@ _GL_CXXALIASWARN (getw); # endif #endif +#if @GNULIB_OBSTACK_ZPRINTF@ +struct obstack; +/* Grows an obstack with formatted output. Returns the number of + bytes added to OBS. No trailing nul byte is added, and the + object should be closed with obstack_finish before use. + Upon memory allocation error, calls obstack_alloc_failed_handler. + Upon other error, returns -1 with errno set. + + Failure code EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure code is through + obstack_alloc_failed_handler. */ +_GL_FUNCDECL_SYS (obstack_zprintf, ptrdiff_t, + (struct obstack *obs, const char *format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (obstack_zprintf, ptrdiff_t, + (struct obstack *obs, const char *format, ...)); +_GL_FUNCDECL_SYS (obstack_vzprintf, ptrdiff_t, + (struct obstack *obs, const char *format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (obstack_vzprintf, ptrdiff_t, + (struct obstack *obs, const char *format, va_list args)); +#endif + #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ struct obstack; -/* Grow an obstack with formatted output. Return the number of +/* Grows an obstack with formatted output. Returns the number of bytes added to OBS. No trailing nul byte is added, and the - object should be closed with obstack_finish before use. Upon - memory allocation error, call obstack_alloc_failed_handler. Upon - other error, return -1. */ + object should be closed with obstack_finish before use. + Upon memory allocation error, calls obstack_alloc_failed_handler. + Upon other error, returns -1. */ # if @REPLACE_OBSTACK_PRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define obstack_printf rpl_obstack_printf # endif _GL_FUNCDECL_RPL (obstack_printf, int, - (struct obstack *obs, const char *format, ...) + (struct obstack *obs, const char *format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_printf, int, @@ -1094,7 +1205,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int, # else # if !@HAVE_DECL_OBSTACK_PRINTF@ _GL_FUNCDECL_SYS (obstack_printf, int, - (struct obstack *obs, const char *format, ...) + (struct obstack *obs, const char *format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif @@ -1107,7 +1218,7 @@ _GL_CXXALIASWARN (obstack_printf); # define obstack_vprintf rpl_obstack_vprintf # endif _GL_FUNCDECL_RPL (obstack_vprintf, int, - (struct obstack *obs, const char *format, va_list args) + (struct obstack *obs, const char *format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_vprintf, int, @@ -1115,7 +1226,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int, # else # if !@HAVE_DECL_OBSTACK_PRINTF@ _GL_FUNCDECL_SYS (obstack_vprintf, int, - (struct obstack *obs, const char *format, va_list args) + (struct obstack *obs, const char *format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif @@ -1127,7 +1238,7 @@ _GL_CXXALIASWARN (obstack_vprintf); #if @GNULIB_PCLOSE@ # if !@HAVE_PCLOSE@ -_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (pclose, int, (FILE *stream), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); _GL_CXXALIASWARN (pclose); @@ -1147,7 +1258,7 @@ _GL_WARN_ON_USE (pclose, "pclose is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define perror rpl_perror # endif -_GL_FUNCDECL_RPL (perror, void, (const char *string)); +_GL_FUNCDECL_RPL (perror, void, (const char *string), ); _GL_CXXALIAS_RPL (perror, void, (const char *string)); # else _GL_CXXALIAS_SYS (perror, void, (const char *string)); @@ -1169,25 +1280,26 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " # define popen rpl_popen # endif _GL_FUNCDECL_RPL (popen, FILE *, - (const char *cmd, const char *mode) + (const char *cmd, const char *mode), _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); # else -# if !@HAVE_POPEN@ || __GNUC__ >= 11 +# if !@HAVE_POPEN@ || (__GNUC__ >= 11 && !defined __clang__) _GL_FUNCDECL_SYS (popen, FILE *, - (const char *cmd, const char *mode) + (const char *cmd, const char *mode), _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); # endif _GL_CXXALIASWARN (popen); #else -# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen +# if @GNULIB_PCLOSE@ \ + && (__GNUC__ >= 11 && !defined __clang__) && !defined popen /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ _GL_FUNCDECL_SYS (popen, FILE *, - (const char *cmd, const char *mode) + (const char *cmd, const char *mode), _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) _GL_ATTRIBUTE_MALLOC); # endif @@ -1200,7 +1312,24 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " # endif #endif +#if @GNULIB_ZPRINTF@ +/* Prints formatted output to standard output. + Returns the number of bytes written to standard output. Upon failure, + returns -1 with stdout's error indicator set. + Failure cause EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure causes are ENOMEM + and the possible failure causes from fwrite(). */ +_GL_FUNCDECL_SYS (zprintf, off64_t, (const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...)); +#endif + #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ +/* Prints formatted output to standard output. + Returns the number of bytes written to standard output. Upon failure, + returns a negative value with stdout's error indicator set. */ # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if defined __GNUC__ || defined __clang__ @@ -1212,14 +1341,14 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " _GL_FUNCDECL_RPL_1 (__printf__, int, (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ - _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) _GL_ARG_NONNULL ((1))); # else _GL_FUNCDECL_RPL_1 (__printf__, int, (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ - _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)), _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); # endif @@ -1229,7 +1358,7 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); # define printf rpl_printf # endif _GL_FUNCDECL_RPL (printf, int, - (const char *restrict format, ...) + (const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); @@ -1241,6 +1370,11 @@ _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (printf); # endif +#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef printf +# define printf gl_consolesafe_printf +# endif #endif #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_printf @@ -1258,7 +1392,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " # undef putc # define putc rpl_fputc # endif -_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); # else _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); @@ -1274,7 +1408,7 @@ _GL_CXXALIASWARN (putc); # undef putchar # define putchar rpl_putchar # endif -_GL_FUNCDECL_RPL (putchar, int, (int c)); +_GL_FUNCDECL_RPL (putchar, int, (int c), ); _GL_CXXALIAS_RPL (putchar, int, (int c)); # else _GL_CXXALIAS_SYS (putchar, int, (int c)); @@ -1290,7 +1424,7 @@ _GL_CXXALIASWARN (putchar); # undef puts # define puts rpl_puts # endif -_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (puts, int, (const char *string), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (puts, int, (const char *string)); # else _GL_CXXALIAS_SYS (puts, int, (const char *string)); @@ -1314,7 +1448,7 @@ _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream)); # if @HAVE_DECL_PUTW@ # if defined __APPLE__ && defined __MACH__ /* The presence of the declaration depends on _POSIX_C_SOURCE. */ -_GL_FUNCDECL_SYS (putw, int, (int w, FILE *restrict stream)); +_GL_FUNCDECL_SYS (putw, int, (int w, FILE *restrict stream), ); # endif _GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); # endif @@ -1330,7 +1464,7 @@ _GL_CXXALIASWARN (putw); # undef remove # define remove rpl_remove # endif -_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (remove, int, (const char *name), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (remove, int, (const char *name)); # else _GL_CXXALIAS_SYS (remove, int, (const char *name)); @@ -1352,7 +1486,7 @@ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " # define rename rpl_rename # endif _GL_FUNCDECL_RPL (rename, int, - (const char *old_filename, const char *new_filename) + (const char *old_filename, const char *new_filename), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (rename, int, (const char *old_filename, const char *new_filename)); @@ -1377,14 +1511,14 @@ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " # define renameat rpl_renameat # endif _GL_FUNCDECL_RPL (renameat, int, - (int fd1, char const *file1, int fd2, char const *file2) + (int fd1, char const *file1, int fd2, char const *file2), _GL_ARG_NONNULL ((2, 4))); _GL_CXXALIAS_RPL (renameat, int, (int fd1, char const *file1, int fd2, char const *file2)); # else # if !@HAVE_RENAMEAT@ _GL_FUNCDECL_SYS (renameat, int, - (int fd1, char const *file1, int fd2, char const *file2) + (int fd1, char const *file1, int fd2, char const *file2), _GL_ARG_NONNULL ((2, 4))); # endif _GL_CXXALIAS_SYS (renameat, int, @@ -1410,18 +1544,18 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - " _GL_FUNCDECL_RPL_1 (__scanf__, int, (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ - _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)), _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) - _GL_ARG_NONNULL ((1))); + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); # else # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef scanf # define scanf rpl_scanf # endif -_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) +_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) - _GL_ARG_NONNULL ((1))); + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); # endif # else @@ -1432,7 +1566,31 @@ _GL_CXXALIASWARN (scanf); # endif #endif +#if @GNULIB_SNZPRINTF@ +/* Prints formatted output to string STR. Similar to sprintf, but the + additional parameter SIZE limits how much is written into STR. + STR may be NULL, in which case nothing will be written. + Returns the string length of the formatted string (which may be larger + than SIZE). Upon failure, returns -1 with errno set. + Failure code EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure code is ENOMEM. */ +_GL_FUNCDECL_SYS (snzprintf, ptrdiff_t, + (char *restrict str, size_t size, + const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) + _GL_ARG_NONNULL ((3))); +_GL_CXXALIAS_SYS (snzprintf, ptrdiff_t, + (char *restrict str, size_t size, + const char *restrict format, ...)); +#endif + #if @GNULIB_SNPRINTF@ +/* Prints formatted output to string STR. Similar to sprintf, but the + additional parameter SIZE limits how much is written into STR. + STR may be NULL, in which case nothing will be written. + Returns the string length of the formatted string (which may be larger + than SIZE). Upon failure, returns a negative value. */ # if @REPLACE_SNPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define snprintf rpl_snprintf @@ -1440,7 +1598,7 @@ _GL_CXXALIASWARN (scanf); # define GNULIB_overrides_snprintf 1 _GL_FUNCDECL_RPL (snprintf, int, (char *restrict str, size_t size, - const char *restrict format, ...) + const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (snprintf, int, @@ -1450,7 +1608,7 @@ _GL_CXXALIAS_RPL (snprintf, int, # if !@HAVE_DECL_SNPRINTF@ _GL_FUNCDECL_SYS (snprintf, int, (char *restrict str, size_t size, - const char *restrict format, ...) + const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) _GL_ARG_NONNULL ((3))); # endif @@ -1469,6 +1627,23 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " # endif #endif +#if @GNULIB_SZPRINTF@ +/* Prints formatted output to string STR. + Returns the string length of the formatted string. Upon failure, + returns -1 with errno set. + Failure code EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure code is ENOMEM. */ +_GL_FUNCDECL_SYS (szprintf, ptrdiff_t, + (char *restrict str, + const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (szprintf, ptrdiff_t, + (char *restrict str, + const char *restrict format, ...)); +#endif + /* Some people would argue that all sprintf uses should be warned about (for example, OpenBSD issues a link warning for it), since it can cause security holes due to buffer overruns. @@ -1479,13 +1654,16 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " GNULIB_POSIXCHECK is defined. */ #if @GNULIB_SPRINTF_POSIX@ +/* Prints formatted output to string STR. + Returns the string length of the formatted string. Upon failure, + returns a negative value. */ # if @REPLACE_SPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define sprintf rpl_sprintf # endif # define GNULIB_overrides_sprintf 1 _GL_FUNCDECL_RPL (sprintf, int, - (char *restrict str, const char *restrict format, ...) + (char *restrict str, const char *restrict format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (sprintf, int, @@ -1526,16 +1704,18 @@ _GL_CXXALIASWARN (tempnam); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define tmpfile rpl_tmpfile # endif -_GL_FUNCDECL_RPL (tmpfile, FILE *, (void) +_GL_FUNCDECL_RPL (tmpfile, FILE *, (void), _GL_ATTRIBUTE_DEALLOC (fclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); # else -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ -_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) +_GL_FUNCDECL_SYS (tmpfile, FILE *, (void), _GL_ATTRIBUTE_DEALLOC (fclose, 1) - _GL_ATTRIBUTE_MALLOC); + _GL_ATTRIBUTE_MALLOC + _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); # endif @@ -1543,9 +1723,10 @@ _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); _GL_CXXALIASWARN (tmpfile); # endif #else -# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile +# if @GNULIB_FCLOSE@ \ + && (__GNUC__ >= 11 && !defined __clang__) && !defined tmpfile /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ -_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) +_GL_FUNCDECL_SYS (tmpfile, FILE *, (void), _GL_ATTRIBUTE_DEALLOC (fclose, 1) _GL_ATTRIBUTE_MALLOC); # endif @@ -1558,6 +1739,31 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " # endif #endif +#if @GNULIB_VASZPRINTF@ +/* Prints formatted output to a string dynamically allocated with malloc(). + If the memory allocation succeeds, it stores the address of the string in + *RESULT and returns the number of resulting bytes, excluding the trailing + NUL. Upon memory allocation error, or some other error, it returns -1 + with errno set. + Failure code EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure code is ENOMEM. */ +_GL_FUNCDECL_SYS (aszprintf, ptrdiff_t, + (char **result, const char *format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2)) + _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_SYS (aszprintf, ptrdiff_t, + (char **result, const char *format, ...)); +_GL_FUNCDECL_SYS (vaszprintf, ptrdiff_t, + (char **result, const char *format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2)) + _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_SYS (vaszprintf, ptrdiff_t, + (char **result, const char *format, va_list args)); +#endif + #if @GNULIB_VASPRINTF@ /* Write formatted output to a string dynamically allocated with malloc(). 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 - " # endif # define GNULIB_overrides_asprintf _GL_FUNCDECL_RPL (asprintf, int, - (char **result, const char *format, ...) + (char **result, const char *format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) - _GL_ARG_NONNULL ((1, 2))); + _GL_ARG_NONNULL ((1, 2)) + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (asprintf, int, (char **result, const char *format, ...)); # else # if !@HAVE_VASPRINTF@ _GL_FUNCDECL_SYS (asprintf, int, - (char **result, const char *format, ...) + (char **result, const char *format, ...), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) - _GL_ARG_NONNULL ((1, 2))); + _GL_ARG_NONNULL ((1, 2)) + _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (asprintf, int, (char **result, const char *format, ...)); @@ -1591,17 +1799,19 @@ _GL_CXXALIASWARN (asprintf); # endif # define GNULIB_overrides_vasprintf 1 _GL_FUNCDECL_RPL (vasprintf, int, - (char **result, const char *format, va_list args) + (char **result, const char *format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) - _GL_ARG_NONNULL ((1, 2))); + _GL_ARG_NONNULL ((1, 2)) + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (vasprintf, int, (char **result, const char *format, va_list args)); # else # if !@HAVE_VASPRINTF@ _GL_FUNCDECL_SYS (vasprintf, int, - (char **result, const char *format, va_list args) + (char **result, const char *format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) - _GL_ARG_NONNULL ((1, 2))); + _GL_ARG_NONNULL ((1, 2)) + _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (vasprintf, int, (char **result, const char *format, va_list args)); @@ -1609,13 +1819,32 @@ _GL_CXXALIAS_SYS (vasprintf, int, _GL_CXXALIASWARN (vasprintf); #endif +#if @GNULIB_VDZPRINTF@ +/* Prints formatted output to file descriptor FD. + Returns the number of bytes written to the file descriptor. Upon + failure, returns -1 with errno set. + Failure code EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure codes are ENOMEM + and the possible failure codes from write(), excluding EINTR. */ +_GL_FUNCDECL_SYS (vdzprintf, off64_t, + (int fd, const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_SYS (vdzprintf, off64_t, + (int fd, const char *restrict format, va_list args)); +#endif + #if @GNULIB_VDPRINTF@ +/* Prints formatted output to file descriptor FD. + Returns the number of bytes written to the file descriptor. Upon + failure, returns a negative value. */ # if @REPLACE_VDPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vdprintf rpl_vdprintf # endif _GL_FUNCDECL_RPL (vdprintf, int, - (int fd, const char *restrict format, va_list args) + (int fd, const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (vdprintf, int, @@ -1623,7 +1852,7 @@ _GL_CXXALIAS_RPL (vdprintf, int, # else # if !@HAVE_VDPRINTF@ _GL_FUNCDECL_SYS (vdprintf, int, - (int fd, const char *restrict format, va_list args) + (int fd, const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((2))); # endif @@ -1643,7 +1872,28 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " # endif #endif +#if @GNULIB_VFZPRINTF@ +/* Prints formatted output to stream FP. + Returns the number of bytes written to the stream. Upon failure, + returns -1 with the stream's error indicator set. + Failure cause EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure causes are ENOMEM + and the possible failure causes from fwrite(). */ +_GL_FUNCDECL_SYS (vfzprintf, off64_t, + (FILE *restrict fp, + const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (vfzprintf, off64_t, + (FILE *restrict fp, + const char *restrict format, va_list args)); +#endif + #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ +/* Prints formatted output to stream FP. + Returns the number of bytes written to the stream. Upon failure, + returns a negative value with the stream's error indicator set. */ # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1653,13 +1903,13 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " # if @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL (vfprintf, int, (FILE *restrict fp, - const char *restrict format, va_list args) + const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); # else _GL_FUNCDECL_RPL (vfprintf, int, (FILE *restrict fp, - const char *restrict format, va_list args) + const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif @@ -1677,6 +1927,11 @@ _GL_CXXALIAS_SYS_CAST (vfprintf, int, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vfprintf); # endif +#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vfprintf +# define vfprintf gl_consolesafe_vfprintf +# endif #endif #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vfprintf @@ -1696,9 +1951,9 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " # endif _GL_FUNCDECL_RPL (vfscanf, int, (FILE *restrict stream, - const char *restrict format, va_list args) + const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) - _GL_ARG_NONNULL ((1, 2))); + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (vfscanf, int, (FILE *restrict stream, const char *restrict format, va_list args)); @@ -1712,7 +1967,26 @@ _GL_CXXALIASWARN (vfscanf); # endif #endif +#if @GNULIB_VZPRINTF@ +/* Prints formatted output to standard output. + Returns the number of bytes written to standard output. Upon failure, + returns -1 with stdout's error indicator set. + Failure cause EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure causes are ENOMEM + and the possible failure causes from fwrite(). */ +_GL_FUNCDECL_SYS (vzprintf, off64_t, + (const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (vzprintf, off64_t, + (const char *restrict format, va_list args)); +#endif + #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ +/* Prints formatted output to standard output. + Returns the number of bytes written to standard output. Upon failure, + returns a negative value with stdout's error indicator set. */ # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1720,11 +1994,11 @@ _GL_CXXALIASWARN (vfscanf); # endif # define GNULIB_overrides_vprintf 1 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ -_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) +_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) _GL_ARG_NONNULL ((1))); # else -_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) +_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) _GL_ARG_NONNULL ((1))); # endif @@ -1739,6 +2013,11 @@ _GL_CXXALIAS_SYS_CAST (vprintf, int, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vprintf); # endif +#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vprintf +# define vprintf gl_consolesafe_vprintf +# endif #endif #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vprintf @@ -1756,9 +2035,9 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " # undef vscanf # define vscanf rpl_vscanf # endif -_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) +_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) - _GL_ARG_NONNULL ((1))); + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); # else _GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); @@ -1768,7 +2047,31 @@ _GL_CXXALIASWARN (vscanf); # endif #endif +#if @GNULIB_VSNZPRINTF@ +/* Prints formatted output to string STR. Similar to sprintf, but the + additional parameter SIZE limits how much is written into STR. + STR may be NULL, in which case nothing will be written. + Returns the string length of the formatted string (which may be larger + than SIZE). Upon failure, returns -1 with errno set. + Failure code EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure code is ENOMEM. */ +_GL_FUNCDECL_SYS (vsnzprintf, ptrdiff_t, + (char *restrict str, size_t size, + const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) + _GL_ARG_NONNULL ((3))); +_GL_CXXALIAS_SYS (vsnzprintf, ptrdiff_t, + (char *restrict str, size_t size, + const char *restrict format, va_list args)); +#endif + #if @GNULIB_VSNPRINTF@ +/* Prints formatted output to string STR. Similar to vsprintf, but the + additional parameter SIZE limits how much is written into STR. + STR may be NULL, in which case nothing will be written. + Returns the string length of the formatted string (which may be larger + than SIZE). Upon failure, returns a negative value. */ # if @REPLACE_VSNPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vsnprintf rpl_vsnprintf @@ -1776,7 +2079,7 @@ _GL_CXXALIASWARN (vscanf); # define GNULIB_overrides_vsnprintf 1 _GL_FUNCDECL_RPL (vsnprintf, int, (char *restrict str, size_t size, - const char *restrict format, va_list args) + const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (vsnprintf, int, @@ -1786,7 +2089,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int, # if !@HAVE_DECL_VSNPRINTF@ _GL_FUNCDECL_SYS (vsnprintf, int, (char *restrict str, size_t size, - const char *restrict format, va_list args) + const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3))); # endif @@ -1805,7 +2108,27 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " # endif #endif +#if @GNULIB_VSZPRINTF@ +/* Prints formatted output to string STR. + Returns the string length of the formatted string. Upon failure, + returns -1 with errno set. + Failure code EOVERFLOW can only occur when a width > INT_MAX is used. + Therefore, if the format string is valid and does not use %ls/%lc + directives nor widths, the only possible failure code is ENOMEM. */ +_GL_FUNCDECL_SYS (vszprintf, ptrdiff_t, + (char *restrict str, + const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (vszprintf, ptrdiff_t, + (char *restrict str, + const char *restrict format, va_list args)); +#endif + #if @GNULIB_VSPRINTF_POSIX@ +/* Prints formatted output to string STR. + Returns the string length of the formatted string. Upon failure, + returns a negative value. */ # if @REPLACE_VSPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vsprintf rpl_vsprintf @@ -1813,7 +2136,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " # define GNULIB_overrides_vsprintf 1 _GL_FUNCDECL_RPL (vsprintf, int, (char *restrict str, - const char *restrict format, va_list args) + const char *restrict format, va_list args), _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) _GL_ARG_NONNULL ((1, 2))); _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 @@ +/* Inline functions for . + + Copyright (C) 2024-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define _GL_STDLIB_INLINE _GL_EXTERN_INLINE +#include + +#include 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 @@ /* A GNU-like . - Copyright (C) 1995, 2001-2004, 2006-2024 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -20,12 +20,27 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc +#if ((defined __need_system_stdlib_h && !defined _GLIBCXX_STDLIB_H) \ + || defined __need_malloc_and_calloc) \ + && !defined __SUNPRO_CC /* Special invocation conventions inside some gnulib header files, - and inside some glibc header files, respectively. */ + and inside some glibc header files, respectively. + Do not recognize this special invocation convention when GCC's + c++/11/stdlib.h is being included or has been included. This is needed + to support the use of clang+llvm binaries on Ubuntu 22.04 with + CXX="$clangdir/bin/clang++ -I/usr/include/c++/11 \ + -I/usr/include/x86_64-linux-gnu/c++/11 + -L/usr/lib/gcc/x86_64-linux-gnu/11 + -Wl,-rpath,$clangdir/lib" + because in this case /usr/include/c++/11/stdlib.h (which does not support + the convention) is seen before the gnulib-generated stdlib.h. */ #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ +/* Make sure that the macros that indicate the special invocation convention + get undefined. This is needed at least on CentOS 7. */ +#undef __need_malloc_and_calloc + #else /* Normal invocation convention. */ @@ -38,8 +53,8 @@ #define _@GUARD_PREFIX@_STDLIB_H /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, - _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, - HAVE_RAW_DECL_*. */ + _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, + _GL_INLINE_HEADER_BEGIN, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ #if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif @@ -47,8 +62,9 @@ /* NetBSD 5.0 mis-defines NULL. */ #include -/* MirBSD 10 defines WEXITSTATUS in , not in . */ -#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS +/* MirBSD 10 defines WEXITSTATUS in , not in . + glibc 2.41 defines WCOREDUMP in , not in . */ +#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP) # include #endif @@ -104,11 +120,30 @@ struct random_data # include #endif +#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) +/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro + below, this may cause compilation errors later in the libstdc++ header files + (that are part of GCC), such as: + error: 'rpl_strtol' is not a member of 'std' + To avoid this, include the relevant header files here, before these symbols + get defined as macros. But do so only on Solaris 11 and AIX (where it is + needed), not on mingw (where it would cause other compilation errors). */ +# include +#endif + +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_STDLIB_INLINE +# define _GL_STDLIB_INLINE _GL_INLINE +#endif +#ifndef _GL_REALLOC_INLINE +# define _GL_REALLOC_INLINE _GL_INLINE +#endif + /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers that can be freed by passing them as the Ith argument to the function F. */ #ifndef _GL_ATTRIBUTE_DEALLOC -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) # else # define _GL_ATTRIBUTE_DEALLOC(f, i) @@ -133,11 +168,23 @@ struct random_data # endif #endif +/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP + (a pointer) must not be NULL if the argument NI (an integer) is != 0. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO +# if __GNUC__ >= 15 && !defined __clang__ +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \ + __attribute__ ((__nonnull_if_nonzero__ (np, ni))) +# else +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) +# endif +#endif + /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 +# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -188,6 +235,18 @@ struct random_data #endif +/* Declarations for ISO C N3322. */ +#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ +_GL_EXTERN_C void *bsearch (const void *__key, + const void *__base, size_t __nmemb, size_t __size, + int (*__compare) (const void *, const void *)) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5)); +_GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size, + int (*__compare) (const void *, const void *)) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ARG_NONNULL ((4)); +#endif + + #if @GNULIB__EXIT@ /* Terminate the current process with the given return code, without running the 'atexit' handlers. */ @@ -196,11 +255,11 @@ struct random_data # undef _Exit # define _Exit rpl__Exit # endif -_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status)); +_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status), ); _GL_CXXALIAS_RPL (_Exit, void, (int status)); # else # if !@HAVE__EXIT@ -_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); +_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status), ); # endif _GL_CXXALIAS_SYS (_Exit, void, (int status)); # endif @@ -216,6 +275,26 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " #endif +#if @GNULIB_ABORT_DEBUG@ +/* Terminates the current process with signal SIGABRT. + Note: While the original abort() function is safe to call in signal handlers, + the overridden abort() function is not. */ +# if @REPLACE_ABORT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef abort +# define abort rpl_abort +# endif +_GL_FUNCDECL_RPL (abort, _Noreturn void, (void), ); +_GL_CXXALIAS_RPL (abort, void, (void)); +# else +_GL_CXXALIAS_SYS (abort, void, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (abort); +# endif +#endif + + #if @GNULIB_FREE_POSIX@ # if @REPLACE_FREE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -223,9 +302,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " # define free rpl_free # endif # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) -_GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW); +_GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW; # else -_GL_FUNCDECL_RPL (free, void, (void *ptr)); +_GL_FUNCDECL_RPL (free, void, (void *ptr), ); # endif _GL_CXXALIAS_RPL (free, void, (void *ptr)); # else @@ -237,8 +316,8 @@ _GL_CXXALIASWARN (free); #elif defined GNULIB_POSIXCHECK # undef free /* Assume free is always declared. */ -_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " - "use gnulib module free for portability"); +_GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - " + "use gnulib module free-posix for portability"); #endif @@ -250,22 +329,25 @@ _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " # define aligned_alloc rpl_aligned_alloc # endif _GL_FUNCDECL_RPL (aligned_alloc, void *, - (size_t alignment, size_t size) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t alignment, size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); # else # if @HAVE_ALIGNED_ALLOC@ -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 _GL_FUNCDECL_SYS (aligned_alloc, void *, - (size_t alignment, size_t size) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t alignment, size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (aligned_alloc, void *, - (size_t alignment, size_t size) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t alignment, size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD); # endif # endif _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)); _GL_CXXALIASWARN (aligned_alloc); # endif #else -# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc +# if @GNULIB_FREE_POSIX@ \ + && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 _GL_FUNCDECL_SYS (aligned_alloc, void *, - (size_t alignment, size_t size) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t alignment, size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (aligned_alloc, void *, - (size_t alignment, size_t size) + (size_t alignment, size_t size), _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # endif @@ -301,9 +384,10 @@ _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " /* Parse a signed decimal integer. Returns the value of the integer. Errors are not detected. */ # if !@HAVE_ATOLL@ -_GL_FUNCDECL_SYS (atoll, long long, (const char *string) - _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (atoll, long long, + (const char *string), + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); _GL_CXXALIASWARN (atoll); @@ -316,28 +400,32 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - " #endif #if @GNULIB_CALLOC_POSIX@ -# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \ +# if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \ || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) # undef calloc # define calloc rpl_calloc # endif _GL_FUNCDECL_RPL (calloc, void *, - (size_t nmemb, size_t size) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t nmemb, size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); # else -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 _GL_FUNCDECL_SYS (calloc, void *, - (size_t nmemb, size_t size) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t nmemb, size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (calloc, void *, - (size_t nmemb, size_t size) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t nmemb, size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD); # endif # endif _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)); _GL_CXXALIASWARN (calloc); # endif #else -# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc +# if @GNULIB_FREE_POSIX@ \ + && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 _GL_FUNCDECL_SYS (calloc, void *, - (size_t nmemb, size_t size) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t nmemb, size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (calloc, void *, - (size_t nmemb, size_t size) + (size_t nmemb, size_t size), _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # endif @@ -373,23 +462,26 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " # define canonicalize_file_name rpl_canonicalize_file_name # endif _GL_FUNCDECL_RPL (canonicalize_file_name, char *, - (const char *name) + (const char *name), _GL_ARG_NONNULL ((1)) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); # else -# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 +# if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__) # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, - (const char *name) - _GL_ATTRIBUTE_NOTHROW + (const char *name), _GL_ARG_NONNULL ((1)) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (canonicalize_file_name, char *, - (const char *name) + (const char *name), _GL_ARG_NONNULL ((1)) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD); # endif # endif _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); @@ -400,18 +492,19 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); # endif _GL_CXXALIASWARN (canonicalize_file_name); #else -# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name +# if @GNULIB_FREE_POSIX@ \ + && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, - (const char *name) - _GL_ATTRIBUTE_NOTHROW + (const char *name), _GL_ARG_NONNULL ((1)) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (canonicalize_file_name, char *, - (const char *name) + (const char *name), _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif @@ -503,12 +596,12 @@ _GL_CXXALIASWARN (gcvt); # undef getloadavg # define getloadavg rpl_getloadavg # endif -_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem) +_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem)); # else # if !@HAVE_DECL_GETLOADAVG@ -_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) +_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); @@ -533,17 +626,17 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " # define getprogname rpl_getprogname # endif # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ -_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_RPL (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE); # else -_GL_FUNCDECL_RPL (getprogname, const char *, (void)); +_GL_FUNCDECL_RPL (getprogname, const char *, (void), ); # endif _GL_CXXALIAS_RPL (getprogname, const char *, (void)); # else # if !@HAVE_GETPROGNAME@ # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ -_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE); # else -_GL_FUNCDECL_SYS (getprogname, const char *, (void)); +_GL_FUNCDECL_SYS (getprogname, const char *, (void), ); # endif # endif _GL_CXXALIAS_SYS (getprogname, const char *, (void)); @@ -577,15 +670,15 @@ _GL_WARN_ON_USE (getprogname, "getprogname is unportable - " # define getsubopt rpl_getsubopt # endif _GL_FUNCDECL_RPL (getsubopt, int, - (char **optionp, char *const *tokens, char **valuep) - _GL_ARG_NONNULL ((1, 2, 3))); + (char **optionp, char *const *tokens, char **valuep), + _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (getsubopt, int, (char **optionp, char *const *tokens, char **valuep)); # else # if !@HAVE_GETSUBOPT@ _GL_FUNCDECL_SYS (getsubopt, int, - (char **optionp, char *const *tokens, char **valuep) - _GL_ARG_NONNULL ((1, 2, 3))); + (char **optionp, char *const *tokens, char **valuep), + _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (getsubopt, int, (char **optionp, char *const *tokens, char **valuep)); @@ -605,7 +698,7 @@ _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " /* Change the ownership and access permission of the slave side of the pseudo-terminal whose master side is specified by FD. */ # if !@HAVE_GRANTPT@ -_GL_FUNCDECL_SYS (grantpt, int, (int fd)); +_GL_FUNCDECL_SYS (grantpt, int, (int fd), ); # endif _GL_CXXALIAS_SYS (grantpt, int, (int fd)); _GL_CXXALIASWARN (grantpt); @@ -622,7 +715,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " by never specifying a zero size), so it does not need malloc or realloc to be redefined. */ #if @GNULIB_MALLOC_POSIX@ -# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \ +# if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \ || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ || _GL_USE_STDLIB_ALLOC) @@ -630,21 +723,24 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " # define malloc rpl_malloc # endif _GL_FUNCDECL_RPL (malloc, void *, - (size_t size) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); # else -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 _GL_FUNCDECL_SYS (malloc, void *, - (size_t size) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (malloc, void *, - (size_t size) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_NODISCARD); # endif # endif _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); @@ -653,16 +749,17 @@ _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); _GL_CXXALIASWARN (malloc); # endif #else -# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc +# if @GNULIB_FREE_POSIX@ \ + && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 _GL_FUNCDECL_SYS (malloc, void *, - (size_t size) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (size_t size), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (malloc, void *, - (size_t size) + (size_t size), _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # endif @@ -674,14 +771,20 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " # endif #endif -/* Return maximum number of bytes of a multibyte character. */ +/* Return maximum number of bytes in a multibyte character in the + current locale. */ #if @REPLACE_MB_CUR_MAX@ # if !GNULIB_defined_MB_CUR_MAX -static inline -int gl_MB_CUR_MAX (void) +_GL_STDLIB_INLINE size_t +gl_MB_CUR_MAX (void) { +# if 0 < @REPLACE_MB_CUR_MAX@ + return @REPLACE_MB_CUR_MAX@; +# else /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ - return MB_CUR_MAX + (MB_CUR_MAX == 3); + int gl_mb_cur_max = MB_CUR_MAX; + return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max; +# endif } # undef MB_CUR_MAX # define MB_CUR_MAX gl_MB_CUR_MAX () @@ -698,7 +801,7 @@ int gl_MB_CUR_MAX (void) # endif _GL_FUNCDECL_RPL (mbstowcs, size_t, (wchar_t *restrict dest, const char *restrict src, - size_t len) + size_t len), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mbstowcs, size_t, (wchar_t *restrict dest, const char *restrict src, @@ -727,13 +830,13 @@ _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - " # define mbtowc rpl_mbtowc # endif _GL_FUNCDECL_RPL (mbtowc, int, - (wchar_t *restrict pwc, const char *restrict s, size_t n)); + (wchar_t *restrict pwc, const char *restrict s, size_t n), ); _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *restrict pwc, const char *restrict s, size_t n)); # else # if !@HAVE_MBTOWC@ _GL_FUNCDECL_SYS (mbtowc, int, - (wchar_t *restrict pwc, const char *restrict s, size_t n)); + (wchar_t *restrict pwc, const char *restrict s, size_t n), ); # endif _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *restrict pwc, const char *restrict s, size_t n)); @@ -756,7 +859,9 @@ _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " Returns TEMPLATE, or a null pointer if it cannot get a unique name. The directory is created mode 700. */ # if !@HAVE_MKDTEMP@ -_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (mkdtemp, char *, + (char * /*template*/), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); _GL_CXXALIASWARN (mkdtemp); @@ -786,13 +891,13 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " # undef mkostemp # define mkostemp rpl_mkostemp # endif -_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); # else # if !@HAVE_MKOSTEMP@ -_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); # endif @@ -827,15 +932,15 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " # define mkostemps rpl_mkostemps # endif _GL_FUNCDECL_RPL (mkostemps, int, - (char * /*template*/, int /*suffixlen*/, int /*flags*/) - _GL_ARG_NONNULL ((1))); + (char * /*template*/, int /*suffixlen*/, int /*flags*/), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (mkostemps, int, (char * /*template*/, int /*suffixlen*/, int /*flags*/)); # else # if !@HAVE_MKOSTEMPS@ _GL_FUNCDECL_SYS (mkostemps, int, - (char * /*template*/, int /*suffixlen*/, int /*flags*/) - _GL_ARG_NONNULL ((1))); + (char * /*template*/, int /*suffixlen*/, int /*flags*/), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (mkostemps, int, (char * /*template*/, int /*suffixlen*/, int /*flags*/)); @@ -865,11 +970,13 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mkstemp rpl_mkstemp # endif -_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); # else # if ! @HAVE_MKSTEMP@ -_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); # endif @@ -894,8 +1001,8 @@ _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " Returns the open file descriptor if successful, otherwise -1 and errno set. */ # if !@HAVE_MKSTEMPS@ -_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); _GL_CXXALIASWARN (mkstemps); @@ -931,8 +1038,8 @@ _GL_CXXALIASWARN (mktemp); # define posix_memalign rpl_posix_memalign # endif _GL_FUNCDECL_RPL (posix_memalign, int, - (void **memptr, size_t alignment, size_t size) - _GL_ARG_NONNULL ((1))); + (void **memptr, size_t alignment, size_t size), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (posix_memalign, int, (void **memptr, size_t alignment, size_t size)); # else @@ -960,11 +1067,11 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " # undef posix_openpt # define posix_openpt rpl_posix_openpt # endif -_GL_FUNCDECL_RPL (posix_openpt, int, (int flags)); +_GL_FUNCDECL_RPL (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (posix_openpt, int, (int flags)); # else # if !@HAVE_POSIX_OPENPT@ -_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); +_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); # endif @@ -987,11 +1094,11 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " # undef ptsname # define ptsname rpl_ptsname # endif -_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); +_GL_FUNCDECL_RPL (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); # else # if !@HAVE_PTSNAME@ -_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); +_GL_FUNCDECL_SYS (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); # endif @@ -1013,11 +1120,11 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " # undef ptsname_r # define ptsname_r rpl_ptsname_r # endif -_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len), ); _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); # else # if !@HAVE_PTSNAME_R@ -_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len), ); # endif _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); # endif @@ -1039,7 +1146,7 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " # undef putenv # define putenv rpl_putenv # endif -_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (putenv, int, (char *string), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (putenv, int, (char *string)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1098,7 +1205,9 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *); # endif _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, _gl_qsort_r_compar_fn compare, - void *arg) _GL_ARG_NONNULL ((1, 4))); + void *arg), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) + _GL_ARG_NONNULL ((4))); _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, _gl_qsort_r_compar_fn compare, void *arg)); @@ -1106,7 +1215,9 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, # if !@HAVE_QSORT_R@ _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, _gl_qsort_r_compar_fn compare, - void *arg) _GL_ARG_NONNULL ((1, 4))); + void *arg), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) + _GL_ARG_NONNULL ((4))); # endif _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, _gl_qsort_r_compar_fn compare, @@ -1137,7 +1248,7 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " # undef rand # define rand rpl_rand # endif -_GL_FUNCDECL_RPL (rand, int, (void)); +_GL_FUNCDECL_RPL (rand, int, (void), ); _GL_CXXALIAS_RPL (rand, int, (void)); # else _GL_CXXALIAS_SYS (rand, int, (void)); @@ -1154,11 +1265,11 @@ _GL_CXXALIASWARN (rand); # undef random # define random rpl_random # endif -_GL_FUNCDECL_RPL (random, long, (void)); +_GL_FUNCDECL_RPL (random, long, (void), ); _GL_CXXALIAS_RPL (random, long, (void)); # else # if !@HAVE_RANDOM@ -_GL_FUNCDECL_SYS (random, long, (void)); +_GL_FUNCDECL_SYS (random, long, (void), ); # endif /* Need to cast, because on Haiku, the return type is int. */ @@ -1181,11 +1292,11 @@ _GL_WARN_ON_USE (random, "random is unportable - " # undef srandom # define srandom rpl_srandom # endif -_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); +_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed), ); _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); # else # if !@HAVE_RANDOM@ -_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); +_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed), ); # endif /* Need to cast, because on FreeBSD, the first parameter is unsigned long seed. */ @@ -1209,14 +1320,14 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - " # define initstate rpl_initstate # endif _GL_FUNCDECL_RPL (initstate, char *, - (unsigned int seed, char *buf, size_t buf_size) + (unsigned int seed, char *buf, size_t buf_size), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (initstate, char *, (unsigned int seed, char *buf, size_t buf_size)); # else # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ _GL_FUNCDECL_SYS (initstate, char *, - (unsigned int seed, char *buf, size_t buf_size) + (unsigned int seed, char *buf, size_t buf_size), _GL_ARG_NONNULL ((2))); # endif /* Need to cast, because on FreeBSD, the first parameter is @@ -1241,11 +1352,11 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - " # undef setstate # define setstate rpl_setstate # endif -_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); # else # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ -_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1))); # endif /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter is const char *arg_state. */ @@ -1269,12 +1380,12 @@ _GL_WARN_ON_USE (setstate, "setstate is unportable - " # undef random_r # define random_r rpl_random_r # endif -_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) +_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); # else # if !@HAVE_RANDOM_R@ -_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) +_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result), _GL_ARG_NONNULL ((1, 2))); # endif _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 - " # define srandom_r rpl_srandom_r # endif _GL_FUNCDECL_RPL (srandom_r, int, - (unsigned int seed, struct random_data *rand_state) + (unsigned int seed, struct random_data *rand_state), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (srandom_r, int, (unsigned int seed, struct random_data *rand_state)); # else # if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (srandom_r, int, - (unsigned int seed, struct random_data *rand_state) + (unsigned int seed, struct random_data *rand_state), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (srandom_r, int, @@ -1325,7 +1436,7 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " # endif _GL_FUNCDECL_RPL (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, - struct random_data *rand_state) + struct random_data *rand_state), _GL_ARG_NONNULL ((2, 4))); _GL_CXXALIAS_RPL (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, @@ -1334,7 +1445,7 @@ _GL_CXXALIAS_RPL (initstate_r, int, # if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, - struct random_data *rand_state) + struct random_data *rand_state), _GL_ARG_NONNULL ((2, 4))); # endif /* Need to cast, because on Haiku, the third parameter is @@ -1359,14 +1470,14 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " # define setstate_r rpl_setstate_r # endif _GL_FUNCDECL_RPL (setstate_r, int, - (char *arg_state, struct random_data *rand_state) + (char *arg_state, struct random_data *rand_state), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (setstate_r, int, (char *arg_state, struct random_data *rand_state)); # else # if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (setstate_r, int, - (char *arg_state, struct random_data *rand_state) + (char *arg_state, struct random_data *rand_state), _GL_ARG_NONNULL ((1, 2))); # endif /* Need to cast, because on Haiku, the first parameter is @@ -1385,28 +1496,44 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " #if @GNULIB_REALLOC_POSIX@ -# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \ - || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@) +# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ +# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2 +# define _GL_INLINE_RPL_REALLOC 1 +# ifdef __cplusplus +extern "C" { +# endif +_GL_REALLOC_INLINE void * +rpl_realloc (void *ptr, size_t size) +{ + return realloc (ptr, size ? size : 1); +} +# ifdef __cplusplus +} +# endif +# endif # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ || _GL_USE_STDLIB_ALLOC) # undef realloc # define realloc rpl_realloc # endif -_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) - _GL_ATTRIBUTE_DEALLOC_FREE); +# if !defined _GL_INLINE_RPL_REALLOC +_GL_FUNCDECL_RPL (realloc, void *, + (void *ptr, size_t size), + _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD); +# endif _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); # else -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 _GL_FUNCDECL_SYS (realloc, void *, - (void *ptr, size_t size) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_DEALLOC_FREE); + (void *ptr, size_t size), + _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (realloc, void *, - (void *ptr, size_t size) - _GL_ATTRIBUTE_DEALLOC_FREE); + (void *ptr, size_t size), + _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD); # endif # endif _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); @@ -1415,16 +1542,17 @@ _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); _GL_CXXALIASWARN (realloc); # endif #else -# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc +# if @GNULIB_FREE_POSIX@ \ + && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 _GL_FUNCDECL_SYS (realloc, void *, - (void *ptr, size_t size) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_DEALLOC_FREE); + (void *ptr, size_t size), + _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (realloc, void *, - (void *ptr, size_t size) + (void *ptr, size_t size), _GL_ATTRIBUTE_DEALLOC_FREE); # endif # endif @@ -1444,13 +1572,15 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " # define reallocarray rpl_reallocarray # endif _GL_FUNCDECL_RPL (reallocarray, void *, - (void *ptr, size_t nmemb, size_t size)); + (void *ptr, size_t nmemb, size_t size), + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (reallocarray, void *, (void *ptr, size_t nmemb, size_t size)); # else # if ! @HAVE_REALLOCARRAY@ _GL_FUNCDECL_SYS (reallocarray, void *, - (void *ptr, size_t nmemb, size_t size)); + (void *ptr, size_t nmemb, size_t size), + _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (reallocarray, void *, (void *ptr, size_t nmemb, size_t size)); @@ -1472,15 +1602,15 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " # define realpath rpl_realpath # endif _GL_FUNCDECL_RPL (realpath, char *, - (const char *restrict name, char *restrict resolved) - _GL_ARG_NONNULL ((1))); + (const char *restrict name, char *restrict resolved), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (realpath, char *, (const char *restrict name, char *restrict resolved)); # else # if !@HAVE_REALPATH@ _GL_FUNCDECL_SYS (realpath, char *, - (const char *restrict name, char *restrict resolved) - _GL_ARG_NONNULL ((1))); + (const char *restrict name, char *restrict resolved), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (realpath, char *, (const char *restrict name, char *restrict resolved)); @@ -1498,7 +1628,8 @@ _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " /* Test a user response to a question. Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ # if !@HAVE_RPMATCH@ -_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (rpmatch, int, (const char *response), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); _GL_CXXALIASWARN (rpmatch); @@ -1514,7 +1645,8 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " /* Look up NAME in the environment, returning 0 in insecure situations. */ # if !@HAVE_SECURE_GETENV@ _GL_FUNCDECL_SYS (secure_getenv, char *, - (char const *name) _GL_ARG_NONNULL ((1))); + (char const *name), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); _GL_CXXALIASWARN (secure_getenv); @@ -1535,14 +1667,14 @@ _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " # define setenv rpl_setenv # endif _GL_FUNCDECL_RPL (setenv, int, - (const char *name, const char *value, int replace) + (const char *name, const char *value, int replace), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (setenv, int, (const char *name, const char *value, int replace)); # else # if !@HAVE_DECL_SETENV@ _GL_FUNCDECL_SYS (setenv, int, - (const char *name, const char *value, int replace) + (const char *name, const char *value, int replace), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (setenv, int, @@ -1559,6 +1691,19 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " # endif #endif +#if @GNULIB_STACK_TRACE@ +/* Prints a stack trace of the current thread to standard error, + if possible. */ +# if @CAN_PRINT_STACK_TRACE@ +_GL_EXTERN_C void print_stack_trace (void); +# else +# if !GNULIB_defined_print_stack_trace +# define print_stack_trace() /* nothing */ +# define GNULIB_defined_print_stack_trace 1 +# endif +# endif +#endif + #if @GNULIB_STRTOD@ /* Parse a double from STRING, updating ENDP if appropriate. */ # if @REPLACE_STRTOD@ @@ -1567,14 +1712,14 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " # endif # define GNULIB_defined_strtod_function 1 _GL_FUNCDECL_RPL (strtod, double, - (const char *restrict str, char **restrict endp) + (const char *restrict str, char **restrict endp), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtod, double, (const char *restrict str, char **restrict endp)); # else # if !@HAVE_STRTOD@ _GL_FUNCDECL_SYS (strtod, double, - (const char *restrict str, char **restrict endp) + (const char *restrict str, char **restrict endp), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtod, double, @@ -1599,14 +1744,14 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " # endif # define GNULIB_defined_strtof_function 1 _GL_FUNCDECL_RPL (strtof, float, - (const char *restrict str, char **restrict endp) + (const char *restrict str, char **restrict endp), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtof, float, (const char *restrict str, char **restrict endp)); # else # if !@HAVE_STRTOF@ _GL_FUNCDECL_SYS (strtof, float, - (const char *restrict str, char **restrict endp) + (const char *restrict str, char **restrict endp), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtof, float, @@ -1631,14 +1776,14 @@ _GL_WARN_ON_USE (strtof, "strtof is unportable - " # endif # define GNULIB_defined_strtold_function 1 _GL_FUNCDECL_RPL (strtold, long double, - (const char *restrict str, char **restrict endp) + (const char *restrict str, char **restrict endp), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtold, long double, (const char *restrict str, char **restrict endp)); # else # if !@HAVE_STRTOLD@ _GL_FUNCDECL_SYS (strtold, long double, - (const char *restrict str, char **restrict endp) + (const char *restrict str, char **restrict endp), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtold, long double, @@ -1669,7 +1814,7 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - " # define GNULIB_defined_strtol_function 1 _GL_FUNCDECL_RPL (strtol, long, (const char *restrict string, char **restrict endptr, - int base) + int base), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtol, long, (const char *restrict string, char **restrict endptr, @@ -1678,7 +1823,7 @@ _GL_CXXALIAS_RPL (strtol, long, # if !@HAVE_STRTOL@ _GL_FUNCDECL_SYS (strtol, long, (const char *restrict string, char **restrict endptr, - int base) + int base), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtol, long, @@ -1712,7 +1857,7 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - " # define GNULIB_defined_strtoll_function 1 _GL_FUNCDECL_RPL (strtoll, long long, (const char *restrict string, char **restrict endptr, - int base) + int base), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoll, long long, (const char *restrict string, char **restrict endptr, @@ -1721,7 +1866,7 @@ _GL_CXXALIAS_RPL (strtoll, long long, # if !@HAVE_STRTOLL@ _GL_FUNCDECL_SYS (strtoll, long long, (const char *restrict string, char **restrict endptr, - int base) + int base), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoll, long long, @@ -1752,7 +1897,7 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " # define GNULIB_defined_strtoul_function 1 _GL_FUNCDECL_RPL (strtoul, unsigned long, (const char *restrict string, char **restrict endptr, - int base) + int base), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoul, unsigned long, (const char *restrict string, char **restrict endptr, @@ -1761,7 +1906,7 @@ _GL_CXXALIAS_RPL (strtoul, unsigned long, # if !@HAVE_STRTOUL@ _GL_FUNCDECL_SYS (strtoul, unsigned long, (const char *restrict string, char **restrict endptr, - int base) + int base), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoul, unsigned long, @@ -1795,7 +1940,7 @@ _GL_WARN_ON_USE (strtoul, "strtoul is unportable - " # define GNULIB_defined_strtoull_function 1 _GL_FUNCDECL_RPL (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, - int base) + int base), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, @@ -1804,7 +1949,7 @@ _GL_CXXALIAS_RPL (strtoull, unsigned long long, # if !@HAVE_STRTOULL@ _GL_FUNCDECL_SYS (strtoull, unsigned long long, (const char *restrict string, char **restrict endptr, - int base) + int base), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoull, unsigned long long, @@ -1824,7 +1969,7 @@ _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " /* Unlock the slave side of the pseudo-terminal whose master side is specified by FD, so that it can be opened. */ # if !@HAVE_UNLOCKPT@ -_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); +_GL_FUNCDECL_SYS (unlockpt, int, (int fd), ); # endif _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); _GL_CXXALIASWARN (unlockpt); @@ -1843,11 +1988,11 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " # undef unsetenv # define unsetenv rpl_unsetenv # endif -_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); # else # if !@HAVE_DECL_UNSETENV@ -_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); # endif @@ -1869,7 +2014,7 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " # undef wctomb # define wctomb rpl_wctomb # endif -_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); +_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc), ); _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); # else _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); @@ -1880,6 +2025,8 @@ _GL_CXXALIASWARN (wctomb); #endif +_GL_INLINE_HEADER_END + #endif /* _@GUARD_PREFIX@_STDLIB_H */ #endif /* _@GUARD_PREFIX@_STDLIB_H */ #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 @@ /* Byte-wise substring search, using the Two-Way algorithm. - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Eric Blake , 2008. 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 @@ -/* Case-insensitive string comparison function. - Copyright (C) 1998-1999, 2005-2007, 2009-2024 Free Software Foundation, Inc. +/* Case-insensitive string comparison function for unibyte locales. + Copyright (C) 1998-1999, 2005-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -17,7 +17,7 @@ #include /* Specification. */ -#include +#include #include #include 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 @@ /* Case-insensitive searching in a string. - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2005. 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 @@ /* Optimized string comparison. - Copyright (C) 2001-2002, 2007, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -26,7 +26,7 @@ extern "C" { #endif -/* STREQ_OPT allows to optimize string comparison with a small literal string. +/* STREQ_OPT optimizes string comparison with a small literal string. STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) is semantically equivalent to 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 @@ /* strerror-override.c --- POSIX compatible system error routine - Copyright (C) 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2010-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -298,6 +298,11 @@ strerror_override (int errnum) return "Invalid or incomplete multibyte or wide character"; # endif +# if GNULIB_defined_ESOCKTNOSUPPORT + case ESOCKTNOSUPPORT: + return "Socket type not supported"; +# endif + default: return NULL; } 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 @@ /* strerror-override.h --- POSIX compatible system error routine - Copyright (C) 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2010-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -57,7 +57,8 @@ extern "C" { || GNULIB_defined_ECANCELED \ || GNULIB_defined_EOWNERDEAD \ || GNULIB_defined_ENOTRECOVERABLE \ - || GNULIB_defined_EILSEQ + || GNULIB_defined_EILSEQ \ + || GNULIB_defined_ESOCKTNOSUPPORT extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; #else # 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 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -31,6 +31,12 @@ /* Use the system functions, not the gnulib overrides in this file. */ #undef sprintf +/* macOS 12's "warning: 'sprintf' is deprecated" is pointless, + as sprintf is used safely here. */ +#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2) +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + char * strerror (int n) #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 @@ /* A GNU-like . - Copyright (C) 1995-1996, 2001-2024 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -20,7 +20,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined _GL_ALREADY_INCLUDING_STRING_H +#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H /* Special invocation convention: - On OS X/NetBSD we have a sequence of nested includes -> -> "string.h" @@ -34,12 +34,12 @@ #ifndef _@GUARD_PREFIX@_STRING_H -#define _GL_ALREADY_INCLUDING_STRING_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ -#undef _GL_ALREADY_INCLUDING_STRING_H +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H #ifndef _@GUARD_PREFIX@_STRING_H #define _@GUARD_PREFIX@_STRING_H @@ -54,6 +54,11 @@ /* NetBSD 5.0 mis-defines NULL. */ #include +#if @GNULIB_STRERROR_L@ +/* Get locale_t. */ +# include +#endif + /* MirBSD defines mbslen as a macro. */ #if @GNULIB_MBSLEN@ && defined __MirBSD__ # include @@ -79,7 +84,7 @@ that can be freed by passing them as the Ith argument to the function F. */ #ifndef _GL_ATTRIBUTE_DEALLOC -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) # else # define _GL_ATTRIBUTE_DEALLOC(f, i) @@ -111,11 +116,23 @@ # endif #endif +/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP + (a pointer) must not be NULL if the argument NI (an integer) is != 0. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO +# if __GNUC__ >= 15 && !defined __clang__ +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \ + __attribute__ ((__nonnull_if_nonzero__ (np, ni))) +# else +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) +# endif +#endif + /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 +# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -149,6 +166,7 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ + /* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though may not have been included yet. */ #if @GNULIB_FREE_POSIX@ @@ -193,12 +211,97 @@ _GL_EXTERN_C void free (void *); # endif #endif + +/* Declarations for ISO C N3322. */ +#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ +# ifndef memcpy +_GL_EXTERN_C void *memcpy (void *__dest, const void *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +# endif +# ifndef memccpy +_GL_EXTERN_C void *memccpy (void *__dest, const void *__src, int __c, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 4) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 4); +# endif +# ifndef memmove +_GL_EXTERN_C void *memmove (void *__dest, const void *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +# endif +# ifndef strncpy +_GL_EXTERN_C char *strncpy (char *__dest, const char *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +# endif +# ifndef strndup +_GL_EXTERN_C char *strndup (const char *__s, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2); +# endif +# ifndef strncat +_GL_EXTERN_C char *strncat (char *__dest, const char *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +# endif +# ifndef memcmp +_GL_EXTERN_C int memcmp (const void *__s1, const void *__s2, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +# endif +# ifndef strncmp +_GL_EXTERN_C int strncmp (const char *__s1, const char *__s2, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +# endif +# if !defined memchr && !defined __cplusplus +_GL_EXTERN_C void *memchr (const void *__s, int __c, size_t __n) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3); +_GL_EXTERN_C void *memrchr (const void *__s, int __c, size_t __n) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3); +# endif +# ifndef memset +_GL_EXTERN_C void *memset (void *__s, int __c, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3); +# endif +# ifndef memset_explicit +_GL_EXTERN_C void *memset_explicit (void *__s, int __c, size_t __n) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3); +# endif +#endif + + /* Clear a block of memory. The compiler will not delete a call to this function, even if the block is dead after the call. */ #if @GNULIB_EXPLICIT_BZERO@ # if ! @HAVE_EXPLICIT_BZERO@ _GL_FUNCDECL_SYS (explicit_bzero, void, - (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); + (void *__dest, size_t __n), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); _GL_CXXALIASWARN (explicit_bzero); @@ -210,10 +313,11 @@ _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " # endif #endif + /* Find the index of the least-significant set bit. */ #if @GNULIB_FFSL@ # if !@HAVE_FFSL@ -_GL_FUNCDECL_SYS (ffsl, int, (long int i)); +_GL_FUNCDECL_SYS (ffsl, int, (long int i), ); # endif _GL_CXXALIAS_SYS (ffsl, int, (long int i)); _GL_CXXALIASWARN (ffsl); @@ -231,11 +335,11 @@ _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define ffsll rpl_ffsll # endif -_GL_FUNCDECL_RPL (ffsll, int, (long long int i)); +_GL_FUNCDECL_RPL (ffsll, int, (long long int i), ); _GL_CXXALIAS_RPL (ffsll, int, (long long int i)); # else # if !@HAVE_FFSLL@ -_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); +_GL_FUNCDECL_SYS (ffsll, int, (long long int i), ); # endif _GL_CXXALIAS_SYS (ffsll, int, (long long int i)); # endif @@ -274,9 +378,9 @@ _GL_CXXALIASWARN (memccpy); # undef memchr # define memchr rpl_memchr # endif -_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) +_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n), _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)); _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); # else /* On some systems, this function is defined as an overloaded function: @@ -301,8 +405,10 @@ _GL_CXXALIASWARN (memchr); #elif defined GNULIB_POSIXCHECK # undef memchr /* Assume memchr is always declared. */ -_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " - "use gnulib module memchr for portability" ); +_GL_WARN_ON_USE_CXX (memchr, + const void *, void *, (void const *, int, size_t), + "memchr has platform-specific bugs - " + "use gnulib module memchr for portability" ); #endif /* Return the first occurrence of NEEDLE in HAYSTACK. */ @@ -313,7 +419,7 @@ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " # endif _GL_FUNCDECL_RPL (memmem, void *, (void const *__haystack, size_t __haystack_len, - void const *__needle, size_t __needle_len) + void const *__needle, size_t __needle_len), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 3))); _GL_CXXALIAS_RPL (memmem, void *, @@ -323,7 +429,7 @@ _GL_CXXALIAS_RPL (memmem, void *, # if ! @HAVE_DECL_MEMMEM@ _GL_FUNCDECL_SYS (memmem, void *, (void const *__haystack, size_t __haystack_len, - void const *__needle, size_t __needle_len) + void const *__needle, size_t __needle_len), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 3))); # endif @@ -351,7 +457,7 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " # endif _GL_FUNCDECL_RPL (mempcpy, void *, (void *restrict __dest, void const *restrict __src, - size_t __n) + size_t __n), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (mempcpy, void *, (void *restrict __dest, void const *restrict __src, @@ -360,7 +466,7 @@ _GL_CXXALIAS_RPL (mempcpy, void *, # if !@HAVE_MEMPCPY@ _GL_FUNCDECL_SYS (mempcpy, void *, (void *restrict __dest, void const *restrict __src, - size_t __n) + size_t __n), _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (mempcpy, void *, @@ -381,9 +487,9 @@ _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " /* Search backwards through a block for a byte (specified as an int). */ #if @GNULIB_MEMRCHR@ # if ! @HAVE_DECL_MEMRCHR@ -_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) +_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t), _GL_ATTRIBUTE_PURE - _GL_ARG_NONNULL ((1))); + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const void * std::memrchr (const void *, int, size_t); } @@ -420,16 +526,20 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " # define memset_explicit rpl_memset_explicit # endif _GL_FUNCDECL_RPL (memset_explicit, void *, - (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); + (void *__dest, int __c, size_t __n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)); _GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n)); # else # if !@HAVE_MEMSET_EXPLICIT@ _GL_FUNCDECL_SYS (memset_explicit, void *, - (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); + (void *__dest, int __c, size_t __n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)); # endif _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (memset_explicit); +# endif #elif defined GNULIB_POSIXCHECK # undef memset_explicit # if HAVE_RAW_DECL_MEMSET_EXPLICIT @@ -443,7 +553,7 @@ _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - " occur within N bytes. */ #if @GNULIB_RAWMEMCHR@ # if ! @HAVE_RAWMEMCHR@ -_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) +_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif @@ -481,14 +591,14 @@ _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " # define stpcpy rpl_stpcpy # endif _GL_FUNCDECL_RPL (stpcpy, char *, - (char *restrict __dst, char const *restrict __src) + (char *restrict __dst, char const *restrict __src), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (stpcpy, char *, (char *restrict __dst, char const *restrict __src)); # else # if !@HAVE_STPCPY@ _GL_FUNCDECL_SYS (stpcpy, char *, - (char *restrict __dst, char const *restrict __src) + (char *restrict __dst, char const *restrict __src), _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (stpcpy, char *, @@ -515,7 +625,7 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " # endif _GL_FUNCDECL_RPL (stpncpy, char *, (char *restrict __dst, char const *restrict __src, - size_t __n) + size_t __n), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (stpncpy, char *, (char *restrict __dst, char const *restrict __src, @@ -524,7 +634,7 @@ _GL_CXXALIAS_RPL (stpncpy, char *, # if ! @HAVE_STPNCPY@ _GL_FUNCDECL_SYS (stpncpy, char *, (char *restrict __dst, char const *restrict __src, - size_t __n) + size_t __n), _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (stpncpy, char *, @@ -560,14 +670,14 @@ _GL_WARN_ON_USE_CXX (strchr, # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strchrnul rpl_strchrnul # endif -_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) +_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strchrnul, char *, (const char *str, int ch)); # else # if ! @HAVE_STRCHRNUL@ -_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) +_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif @@ -606,7 +716,7 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " # define strdup rpl_strdup # endif _GL_FUNCDECL_RPL (strdup, char *, - (char const *__s) + (char const *__s), _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); @@ -621,16 +731,17 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); /* strdup exists as a function and as a macro. Get rid of the macro. */ # undef strdup # endif -# if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup +# if (!@HAVE_DECL_STRDUP@ || (__GNUC__ >= 11 && !defined __clang__)) \ + && !defined strdup # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (strdup, char *, - (char const *__s) - _GL_ATTRIBUTE_NOTHROW + (char const *__s), _GL_ARG_NONNULL ((1)) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (strdup, char *, - (char const *__s) + (char const *__s), _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif @@ -639,17 +750,17 @@ _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); # endif _GL_CXXALIASWARN (strdup); #else -# if __GNUC__ >= 11 && !defined strdup +# if (__GNUC__ >= 11 && !defined __clang__) && !defined strdup /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (strdup, char *, - (char const *__s) - _GL_ATTRIBUTE_NOTHROW + (char const *__s), _GL_ARG_NONNULL ((1)) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (strdup, char *, - (char const *__s) + (char const *__s), _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif @@ -688,8 +799,9 @@ _GL_CXXALIASWARN (strdup); # define strncat rpl_strncat # endif _GL_FUNCDECL_RPL (strncat, char *, - (char *restrict dest, const char *restrict src, size_t n) - _GL_ARG_NONNULL ((1, 2))); + (char *restrict dest, const char *restrict src, size_t n), + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); _GL_CXXALIAS_RPL (strncat, char *, (char *restrict dest, const char *restrict src, size_t n)); # else @@ -707,6 +819,35 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - " # endif #endif +/* Copy no more than N bytes of SRC to DST, returning DST. */ +#if @GNULIB_STRNCPY@ +# if @REPLACE_STRNCPY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strncpy +# define strncpy rpl_strncpy +# endif +_GL_FUNCDECL_RPL (strncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n)); +# else +_GL_CXXALIAS_SYS (strncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strncpy); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_STRNCPY +_GL_WARN_ON_USE (strncpy, "strncpy is unportable - " + "use gnulib module strncpy for portability"); +# endif +#endif + /* Return a newly allocated copy of at most N bytes of STRING. */ #if @GNULIB_STRNDUP@ # if @REPLACE_STRNDUP@ @@ -715,22 +856,23 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - " # define strndup rpl_strndup # endif _GL_FUNCDECL_RPL (strndup, char *, - (char const *__s, size_t __n) - _GL_ARG_NONNULL ((1)) + (char const *__s, size_t __n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); # else -# if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) +# if !@HAVE_DECL_STRNDUP@ \ + || ((__GNUC__ >= 11 && !defined __clang__) && !defined strndup) # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (strndup, char *, - (char const *__s, size_t __n) - _GL_ATTRIBUTE_NOTHROW - _GL_ARG_NONNULL ((1)) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (char const *__s, size_t __n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (strndup, char *, - (char const *__s, size_t __n) - _GL_ARG_NONNULL ((1)) + (char const *__s, size_t __n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # endif @@ -738,18 +880,18 @@ _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); # endif _GL_CXXALIASWARN (strndup); #else -# if __GNUC__ >= 11 && !defined strndup +# if (__GNUC__ >= 11 && !defined __clang__) && !defined strndup /* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (strndup, char *, - (char const *__s, size_t __n) - _GL_ATTRIBUTE_NOTHROW - _GL_ARG_NONNULL ((1)) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (char const *__s, size_t __n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (strndup, char *, - (char const *__s, size_t __n) - _GL_ARG_NONNULL ((1)) + (char const *__s, size_t __n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # endif @@ -771,13 +913,13 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - " # undef strnlen # define strnlen rpl_strnlen # endif -_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) +_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); # else # if ! @HAVE_DECL_STRNLEN@ -_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) +_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif @@ -807,7 +949,7 @@ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " /* Find the first occurrence in S of any character in ACCEPT. */ #if @GNULIB_STRPBRK@ # if ! @HAVE_STRPBRK@ -_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) +_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif @@ -892,7 +1034,7 @@ _GL_WARN_ON_USE_CXX (strrchr, #if @GNULIB_STRSEP@ # if ! @HAVE_STRSEP@ _GL_FUNCDECL_SYS (strsep, char *, - (char **restrict __stringp, char const *restrict __delim) + (char **restrict __stringp, char const *restrict __delim), _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (strsep, char *, @@ -917,7 +1059,7 @@ _GL_WARN_ON_USE (strsep, "strsep is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strstr rpl_strstr # endif -_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) +_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); @@ -948,11 +1090,13 @@ _GL_CXXALIASWARN (strstr); as a sequence of bytes, not of characters. */ # undef strstr /* Assume strstr is always declared. */ -_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " - "work correctly on character strings in most " - "multibyte locales - " - "use mbsstr if you care about internationalization, " - "or use strstr if you care about speed"); +_GL_WARN_ON_USE_CXX (strstr, + const char *, char *, (const char *, const char *), + "strstr is quadratic on many systems, and cannot " + "work correctly on character strings in most " + "multibyte locales - " + "use mbsstr if you care about internationalization, " + "or use strstr if you care about speed"); #endif /* 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 " # define strcasestr rpl_strcasestr # endif _GL_FUNCDECL_RPL (strcasestr, char *, - (const char *haystack, const char *needle) + (const char *haystack, const char *needle), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strcasestr, char *, @@ -971,7 +1115,7 @@ _GL_CXXALIAS_RPL (strcasestr, char *, # else # if ! @HAVE_STRCASESTR@ _GL_FUNCDECL_SYS (strcasestr, char *, - (const char *haystack, const char *needle) + (const char *haystack, const char *needle), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif @@ -1038,7 +1182,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " # endif _GL_FUNCDECL_RPL (strtok_r, char *, (char *restrict s, char const *restrict delim, - char **restrict save_ptr) + char **restrict save_ptr), _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (strtok_r, char *, (char *restrict s, char const *restrict delim, @@ -1050,7 +1194,7 @@ _GL_CXXALIAS_RPL (strtok_r, char *, # if ! @HAVE_DECL_STRTOK_R@ _GL_FUNCDECL_SYS (strtok_r, char *, (char *restrict s, char const *restrict delim, - char **restrict save_ptr) + char **restrict save_ptr), _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (strtok_r, char *, @@ -1075,6 +1219,22 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " /* The following functions are not specified by POSIX. They are gnulib extensions. */ +#if @GNULIB_STR_STARTSWITH@ +/* Returns true if STRING starts with PREFIX. + Returns false otherwise. */ +_GL_EXTERN_C bool str_startswith (const char *string, const char *prefix) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_STR_ENDSWITH@ +/* Returns true if STRING ends with SUFFIX. + Returns false otherwise. */ +_GL_EXTERN_C bool str_endswith (const char *string, const char *prefix) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + #if @GNULIB_MBSLEN@ /* Return the number of multibyte characters in the character string STRING. This considers multibyte characters, unlike strlen, which counts bytes. */ @@ -1085,12 +1245,12 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbslen rpl_mbslen # endif -_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) +_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); # else -_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) +_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _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) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbschr rpl_mbschr /* avoid collision with HP-UX function */ # endif -_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) +_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); # else -_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) +_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); @@ -1139,12 +1299,12 @@ _GL_CXXALIASWARN (mbschr); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbsrchr rpl_mbsrchr /* avoid collision with system function */ # endif -_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) +_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); # else -_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) +_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); @@ -1160,6 +1320,33 @@ _GL_CXXALIASWARN (mbsrchr); _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); +# ifndef _GL_NO_CONST_GENERICS +/* Don't silently convert a 'const char *' to a 'char *'. Programmers want + compiler warnings for 'const' related mistakes. */ +# ifdef __cplusplus +extern "C++" { /* needed for AIX */ +template + T * mbsstr_template (T* haystack, const char *needle); +template <> + inline char * mbsstr_template (char *haystack, const char *needle) + { return mbsstr (haystack, needle); } +template <> + inline const char * mbsstr_template (const char *haystack, const char *needle) + { return mbsstr (haystack, needle); } +} +# undef mbsstr +# define mbsstr mbsstr_template +# elif !defined mbsstr +# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \ + || defined __ICC || defined __TINYC__ \ + || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__))) +# define mbsstr(h,n) \ + _Generic ((h), \ + char const *: (char const *) mbsstr ((h), (n)), \ + default : mbsstr ((h), (n))) +# endif +# endif +# endif #endif #if @GNULIB_MBSCASECMP@ @@ -1201,6 +1388,33 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); +# ifndef _GL_NO_CONST_GENERICS +/* Don't silently convert a 'const char *' to a 'char *'. Programmers want + compiler warnings for 'const' related mistakes. */ +# ifdef __cplusplus +extern "C++" { /* needed for AIX */ +template + T * mbspcasecmp_template (T* string, const char *prefix); +template <> + inline char * mbspcasecmp_template (char *string, const char *prefix) + { return mbspcasecmp (string, prefix); } +template <> + inline const char * mbspcasecmp_template (const char *string, const char *prefix) + { return mbspcasecmp (string, prefix); } +} +# undef mbspcasecmp +# define mbspcasecmp mbspcasecmp_template +# elif !defined mbspcasecmp +# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \ + || defined __ICC || defined __TINYC__ \ + || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__))) +# define mbspcasecmp(s,p) \ + _Generic ((s), \ + char const *: (char const *) mbspcasecmp ((s), (p)), \ + default : mbspcasecmp ((s), (p))) +# endif +# endif +# endif #endif #if @GNULIB_MBSCASESTR@ @@ -1212,6 +1426,33 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); +# ifndef _GL_NO_CONST_GENERICS +/* Don't silently convert a 'const char *' to a 'char *'. Programmers want + compiler warnings for 'const' related mistakes. */ +# ifdef __cplusplus +extern "C++" { /* needed for AIX */ +template + T * mbscasestr_template (T* haystack, const char *needle); +template <> + inline char * mbscasestr_template (char *haystack, const char *needle) + { return mbscasestr (haystack, needle); } +template <> + inline const char * mbscasestr_template (const char *haystack, const char *needle) + { return mbscasestr (haystack, needle); } +} +# undef mbscasestr +# define mbscasestr mbscasestr_template +# elif !defined mbscasestr +# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \ + || defined __ICC || defined __TINYC__ \ + || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__))) +# define mbscasestr(h,n) \ + _Generic ((h), \ + char const *: (char const *) mbscasestr ((h), (n)), \ + default : mbscasestr ((h), (n))) +# endif +# endif +# endif #endif #if @GNULIB_MBSCSPN@ @@ -1234,12 +1475,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ # endif -_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) +_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); # else -_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) +_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _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, _GL_ARG_NONNULL ((2, 3)); #endif +#if @GNULIB_MBS_STARTSWITH@ +/* Returns true if STRING starts with PREFIX. + Returns false otherwise. */ +_GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +/* No extra code is needed for multibyte locales for this function. */ +# define mbs_startswith str_startswith +#endif + +#if @GNULIB_MBS_ENDSWITH@ +/* Returns true if STRING ends with SUFFIX. + Returns false otherwise. + Unlike str_endswith(), this function works correctly in multibyte locales. + */ +_GL_EXTERN_C bool mbs_endswith (const char *string, const char *suffix) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + /* Map any int, typically from errno, into an error message. */ #if @GNULIB_STRERROR@ # if @REPLACE_STRERROR@ @@ -1306,7 +1567,7 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim, # undef strerror # define strerror rpl_strerror # endif -_GL_FUNCDECL_RPL (strerror, char *, (int)); +_GL_FUNCDECL_RPL (strerror, char *, (int), ); _GL_CXXALIAS_RPL (strerror, char *, (int)); # else _GL_CXXALIAS_SYS (strerror, char *, (int)); @@ -1329,12 +1590,12 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - " # undef strerror_r # define strerror_r rpl_strerror_r # endif -_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) +_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); # else # if !@HAVE_DECL_STRERROR_R@ -_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) +_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen), _GL_ARG_NONNULL ((2))); # endif _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 - " # endif #endif +/* Map any int, typically from errno, into an error message. + With locale_t argument. */ +#if @GNULIB_STRERROR_L@ +# if @REPLACE_STRERROR_L@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strerror_l +# define strerror_l rpl_strerror_l +# endif +_GL_FUNCDECL_RPL (strerror_l, char *, (int errnum, locale_t locale), + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (strerror_l, char *, (int errnum, locale_t locale)); +# else +# if !@HAVE_STRERROR_L@ +_GL_FUNCDECL_SYS (strerror_l, char *, (int errnum, locale_t locale), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strerror_l); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror_l +# if HAVE_RAW_DECL_STRERROR_L +_GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - " + "use gnulib module strerror_l for portability"); +# endif +#endif + +/* Map any int, typically from errno, into an error message. Multithread-safe, + with locale_t argument. + Not portable! Only provided by gnulib. */ +#if @GNULIB_STRERROR_L@ +_GL_FUNCDECL_SYS (strerror_l_r, int, + (int errnum, char *buf, size_t buflen, locale_t locale), + _GL_ARG_NONNULL ((2, 4))); +#endif + /* Return the name of the system error code ERRNUM. */ #if @GNULIB_STRERRORNAME_NP@ # if @REPLACE_STRERRORNAME_NP@ @@ -1357,15 +1656,17 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " # undef strerrorname_np # define strerrorname_np rpl_strerrorname_np # endif -_GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum)); +_GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum), ); _GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum)); # else # if !@HAVE_STRERRORNAME_NP@ -_GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum)); +_GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), ); # endif _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (strerrorname_np); +# endif #elif defined GNULIB_POSIXCHECK # undef strerrorname_np # if HAVE_RAW_DECL_STRERRORNAME_NP @@ -1377,7 +1678,7 @@ _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " /* Return an abbreviation string for the signal number SIG. */ #if @GNULIB_SIGABBREV_NP@ # if ! @HAVE_SIGABBREV_NP@ -_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig)); +_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig), ); # endif _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); _GL_CXXALIASWARN (sigabbrev_np); @@ -1392,7 +1693,7 @@ _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " /* Return an English description string for the signal number SIG. */ #if @GNULIB_SIGDESCR_NP@ # if ! @HAVE_SIGDESCR_NP@ -_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig)); +_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig), ); # endif _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); _GL_CXXALIASWARN (sigdescr_np); @@ -1409,11 +1710,11 @@ _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strsignal rpl_strsignal # endif -_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); +_GL_FUNCDECL_RPL (strsignal, char *, (int __sig), ); _GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); # else # if ! @HAVE_DECL_STRSIGNAL@ -_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); +_GL_FUNCDECL_SYS (strsignal, char *, (int __sig), ); # endif /* Need to cast, because on Cygwin 1.5.x systems, the return type is 'const char *'. */ @@ -1433,13 +1734,13 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strverscmp rpl_strverscmp # endif -_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *) +_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *)); # else # if !@HAVE_STRVERSCMP@ -_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) +_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *), _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # 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 @@ /* A substitute . - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -36,7 +36,7 @@ #ifndef _@GUARD_PREFIX@_STRINGS_H #define _@GUARD_PREFIX@_STRINGS_H -/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +/* This file uses _GL_ARG_NONNULL, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ #if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif @@ -46,6 +46,16 @@ # include #endif +#if @GNULIB_STRCASECMP_L@ || @GNULIB_STRNCASECMP_L@ +/* Get locale_t. */ +# include +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) \ + || (defined __APPLE__ && defined __MACH__)) +/* Get the declaration of strcasecmp_l. */ +# include +# endif +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -58,10 +68,10 @@ extern "C" { #endif - /* Find the index of the least-significant set bit. */ #if @GNULIB_FFS@ +/* Find the index of the least-significant set bit. */ # if !@HAVE_FFS@ -_GL_FUNCDECL_SYS (ffs, int, (int i)); +_GL_FUNCDECL_SYS (ffs, int, (int i), ); # endif _GL_CXXALIAS_SYS (ffs, int, (int i)); _GL_CXXALIASWARN (ffs); @@ -72,52 +82,152 @@ _GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module"); # endif #endif +#if @GNULIB_STRCASECMP@ /* Compare strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function does not work in multibyte locales. */ -#if ! @HAVE_STRCASECMP@ -extern int strcasecmp (char const *s1, char const *s2) - _GL_ARG_NONNULL ((1, 2)); -#endif -#if defined GNULIB_POSIXCHECK +# if @REPLACE_STRCASECMP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strcasecmp +# define strcasecmp rpl_strcasecmp +# endif +_GL_FUNCDECL_RPL (strcasecmp, int, (const char *, const char *), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strcasecmp, int, (const char *, const char *)); +# else +# if !@HAVE_STRCASECMP@ +_GL_FUNCDECL_SYS (strcasecmp, int, (const char *, const char *), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (strcasecmp, int, (const char *, const char *)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strcasecmp); +# endif +#elif defined GNULIB_POSIXCHECK /* strcasecmp() does not work with multibyte strings: POSIX says that it operates on "strings", and "string" in POSIX is defined as a sequence of bytes, not of characters. */ # undef strcasecmp # if HAVE_RAW_DECL_STRCASECMP _GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character " - "strings in multibyte locales - " + "strings in multibyte locales and is unportable - " "use mbscasecmp if you care about " - "internationalization, or use c_strcasecmp , " - "gnulib module c-strcase) if you want a locale " + "internationalization, or use c_strcasecmp " + "(gnulib module c-strcasecmp) if you want a locale " "independent function"); # endif #endif +#if @GNULIB_STRCASECMP_L@ +# if @REPLACE_STRCASECMP_L@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strcasecmp_l +# define strcasecmp_l rpl_strcasecmp_l +# endif +_GL_FUNCDECL_RPL (strcasecmp_l, int, + (const char *s1, const char *s2, locale_t locale), + _GL_ARG_NONNULL ((1, 2, 3))); +_GL_CXXALIAS_RPL (strcasecmp_l, int, + (const char *s1, const char *s2, locale_t locale)); +# else +# if !@HAVE_STRCASECMP_L@ +_GL_FUNCDECL_SYS (strcasecmp_l, int, + (const char *s1, const char *s2, locale_t locale), + _GL_ARG_NONNULL ((1, 2, 3))); +# endif +_GL_CXXALIAS_SYS (strcasecmp_l, int, + (const char *s1, const char *s2, locale_t locale)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strcasecmp_l); +# endif +#elif defined GNULIB_POSIXCHECK +/* strcasecmp_l() does not work with multibyte strings: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ +# undef strcasecmp_l +# if HAVE_RAW_DECL_STRCASECMP_L +_GL_WARN_ON_USE (strcasecmp_l, "strcasecmp_l cannot work correctly on " + "character strings in multibyte locales and is unportable - " + "use gnulib module strcasecmp_l for portability"); +# endif +#endif + +#if @GNULIB_STRNCASECMP@ /* Compare no more than N bytes of strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function cannot work correctly in multibyte locales. */ -#if ! @HAVE_DECL_STRNCASECMP@ -extern int strncasecmp (char const *s1, char const *s2, size_t n) - _GL_ARG_NONNULL ((1, 2)); -#endif -#if defined GNULIB_POSIXCHECK +# if @REPLACE_STRNCASECMP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strncasecmp +# define strncasecmp rpl_strncasecmp +# endif +_GL_FUNCDECL_RPL (strncasecmp, int, (const char *, const char *, size_t), + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strncasecmp, int, (const char *, const char *, size_t)); +# else +# if !@HAVE_DECL_STRNCASECMP@ +_GL_FUNCDECL_SYS (strncasecmp, int, (const char *, const char *, size_t), + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (strncasecmp, int, (const char *, const char *, size_t)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strncasecmp); +# endif +#elif defined GNULIB_POSIXCHECK /* strncasecmp() does not work with multibyte strings: POSIX says that it operates on "strings", and "string" in POSIX is defined as a sequence of bytes, not of characters. */ # undef strncasecmp # if HAVE_RAW_DECL_STRNCASECMP _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " - "strings in multibyte locales - " + "strings in multibyte locales and is unportable - " "use mbsncasecmp or mbspcasecmp if you care about " - "internationalization, or use c_strncasecmp , " - "gnulib module c-strcase) if you want a locale " + "internationalization, or use c_strncasecmp " + "(gnulib module c-strncasecmp) if you want a locale " "independent function"); # endif #endif +#if @GNULIB_STRNCASECMP_L@ +# if @REPLACE_STRNCASECMP_L@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strncasecmp_l +# define strncasecmp_l rpl_strncasecmp_l +# endif +_GL_FUNCDECL_RPL (strncasecmp_l, int, + (const char *s1, const char *s2, size_t n, locale_t locale), + _GL_ARG_NONNULL ((1, 2, 4))); +_GL_CXXALIAS_RPL (strncasecmp_l, int, + (const char *s1, const char *s2, size_t n, locale_t locale)); +# else +# if !@HAVE_STRNCASECMP_L@ +_GL_FUNCDECL_SYS (strncasecmp_l, int, + (const char *s1, const char *s2, size_t n, locale_t locale), + _GL_ARG_NONNULL ((1, 2, 4))); +# endif +_GL_CXXALIAS_SYS (strncasecmp_l, int, + (const char *s1, const char *s2, size_t n, locale_t locale)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strncasecmp_l); +# endif +#elif defined GNULIB_POSIXCHECK +/* strncasecmp_l() does not work with multibyte strings: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ +# undef strncasecmp_l +# if HAVE_RAW_DECL_STRNCASECMP_L +_GL_WARN_ON_USE (strncasecmp_l, "strncasecmp_l cannot work correctly on " + "character strings in multibyte locales and is unportable - " + "use gnulib module strncasecmp_l for portability"); +# endif +#endif + #ifdef __cplusplus } 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 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003-2006, 2009-2024 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2025 Free Software Foundation, Inc. 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 @@ -/* strncasecmp.c -- case insensitive string comparator - Copyright (C) 1998-1999, 2005-2007, 2009-2024 Free Software Foundation, Inc. +/* Case-insensitive string comparison function for unibyte locales. + Copyright (C) 1998-1999, 2005-2007, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -17,7 +17,7 @@ #include /* Specification. */ -#include +#include #include #include 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 @@ +/* Copy a size-bounded string. + Copyright (C) 1999, 2011-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 1999. */ + +#include + +/* Specification. */ +#include + +char * +strncpy (char *dest, const char *src, size_t n) +{ + char *destptr = dest; + + for (; n > 0 && (*destptr = *src) != '\0'; src++, destptr++, n--) + ; + + /* This behavior is rarely useful, but it is specified by the ISO C + standard. */ + for (; n > 0; n--) + *destptr++ = '\0'; + + return dest; +} 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 @@ -/* Copyright (C) 2004, 2007, 2009-2024 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2007, 2009-2025 Free Software Foundation, Inc. Written by Yoann Vandoorselaere . 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 @@ -/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2024 Free Software +/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 @@ /* System call limits - Copyright 2018-2024 Free Software Foundation, Inc. + Copyright 2018-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Inline functions for . - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE #include -#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE #include typedef 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 @@ /* Provide a sys/socket header file for systems lacking it (read: MinGW) and for systems where it is incomplete. - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. Written by Simon Josefsson. This file is free software: you can redistribute it and/or modify @@ -27,7 +27,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H +#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H /* Special invocation convention: - On Cygwin 1.5.x we have a sequence of nested includes -> -> -> , @@ -43,7 +43,7 @@ #if @HAVE_SYS_SOCKET_H@ -# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H +# define _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H /* On many platforms, assumes prior inclusion of . */ @@ -56,7 +56,7 @@ /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ -# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H +# undef _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H #endif @@ -202,6 +202,7 @@ struct sockaddr_storage /* Rudimentary 'struct msghdr'; this works as long as you don't try to access msg_control or msg_controllen. */ +# if !defined GNULIB_defined_struct_msghdr struct msghdr { void *msg_name; socklen_t msg_namelen; @@ -209,6 +210,8 @@ struct msghdr { int msg_iovlen; int msg_flags; }; +# define GNULIB_defined_struct_msghdr 1 +# endif #endif @@ -289,15 +292,17 @@ rpl_fd_isset (SOCKET fd, fd_set * set) # undef socket # define socket rpl_socket # endif -_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol)); +_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol), ); _GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol)); # else _GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol)); # endif _GL_CXXALIASWARN (socket); #elif @HAVE_WINSOCK2_H@ -# undef socket -# define socket socket_used_without_requesting_gnulib_module_socket +# if !GNULIB_SOCKET +# undef socket +# define socket socket_used_without_requesting_gnulib_module_socket +# endif #elif defined GNULIB_POSIXCHECK # undef socket # if HAVE_RAW_DECL_SOCKET @@ -313,7 +318,7 @@ _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - " # define connect rpl_connect # endif _GL_FUNCDECL_RPL (connect, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen) + (int fd, const struct sockaddr *addr, socklen_t addrlen), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (connect, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); @@ -326,8 +331,10 @@ _GL_CXXALIAS_SYS_CAST (connect, int, # endif _GL_CXXALIASWARN (connect); #elif @HAVE_WINSOCK2_H@ -# undef connect -# define connect socket_used_without_requesting_gnulib_module_connect +# if !GNULIB_CONNECT +# undef connect +# define connect connect_used_without_requesting_gnulib_module_connect +# endif #elif defined GNULIB_POSIXCHECK # undef connect # if HAVE_RAW_DECL_CONNECT @@ -345,7 +352,7 @@ _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " _GL_FUNCDECL_RPL (accept, int, (int fd, struct sockaddr *restrict addr, - socklen_t *restrict addrlen)); + socklen_t *restrict addrlen), ); _GL_CXXALIAS_RPL (accept, int, (int fd, struct sockaddr *restrict addr, @@ -362,8 +369,10 @@ _GL_CXXALIAS_SYS_CAST (accept, int, _GL_CXXALIASWARN (accept); # endif #elif @HAVE_WINSOCK2_H@ -# undef accept -# define accept accept_used_without_requesting_gnulib_module_accept +# if !GNULIB_ACCEPT +# undef accept +# define accept accept_used_without_requesting_gnulib_module_accept +# endif #elif defined GNULIB_POSIXCHECK # undef accept # if HAVE_RAW_DECL_ACCEPT @@ -379,7 +388,7 @@ _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - " # define bind rpl_bind # endif _GL_FUNCDECL_RPL (bind, int, - (int fd, const struct sockaddr *addr, socklen_t addrlen) + (int fd, const struct sockaddr *addr, socklen_t addrlen), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (bind, int, (int fd, const struct sockaddr *addr, socklen_t addrlen)); @@ -392,8 +401,10 @@ _GL_CXXALIAS_SYS_CAST (bind, int, # endif _GL_CXXALIASWARN (bind); #elif @HAVE_WINSOCK2_H@ -# undef bind -# define bind bind_used_without_requesting_gnulib_module_bind +# if !GNULIB_BIND +# undef bind +# define bind bind_used_without_requesting_gnulib_module_bind +# endif #elif defined GNULIB_POSIXCHECK # undef bind # if HAVE_RAW_DECL_BIND @@ -410,7 +421,7 @@ _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " # endif _GL_FUNCDECL_RPL (getpeername, int, (int fd, struct sockaddr *restrict addr, - socklen_t *restrict addrlen) + socklen_t *restrict addrlen), _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (getpeername, int, (int fd, struct sockaddr *restrict addr, @@ -426,8 +437,10 @@ _GL_CXXALIAS_SYS_CAST (getpeername, int, _GL_CXXALIASWARN (getpeername); # endif #elif @HAVE_WINSOCK2_H@ -# undef getpeername -# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername +# if !GNULIB_GETPEERNAME +# undef getpeername +# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername +# endif #elif defined GNULIB_POSIXCHECK # undef getpeername # if HAVE_RAW_DECL_GETPEERNAME @@ -444,7 +457,7 @@ _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " # endif _GL_FUNCDECL_RPL (getsockname, int, (int fd, struct sockaddr *restrict addr, - socklen_t *restrict addrlen) + socklen_t *restrict addrlen), _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (getsockname, int, (int fd, struct sockaddr *restrict addr, @@ -460,8 +473,10 @@ _GL_CXXALIAS_SYS_CAST (getsockname, int, _GL_CXXALIASWARN (getsockname); # endif #elif @HAVE_WINSOCK2_H@ -# undef getsockname -# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname +# if !GNULIB_GETSOCKNAME +# undef getsockname +# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname +# endif #elif defined GNULIB_POSIXCHECK # undef getsockname # if HAVE_RAW_DECL_GETSOCKNAME @@ -478,7 +493,7 @@ _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " # endif _GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname, - void *restrict optval, socklen_t *restrict optlen) + void *restrict optval, socklen_t *restrict optlen), _GL_ARG_NONNULL ((4, 5))); _GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname, @@ -492,8 +507,10 @@ _GL_CXXALIAS_SYS_CAST (getsockopt, int, # endif _GL_CXXALIASWARN (getsockopt); #elif @HAVE_WINSOCK2_H@ -# undef getsockopt -# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt +# if !GNULIB_GETSOCKOPT +# undef getsockopt +# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt +# endif #elif defined GNULIB_POSIXCHECK # undef getsockopt # if HAVE_RAW_DECL_GETSOCKOPT @@ -508,15 +525,17 @@ _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - " # undef listen # define listen rpl_listen # endif -_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog)); +_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog), ); _GL_CXXALIAS_RPL (listen, int, (int fd, int backlog)); # else _GL_CXXALIAS_SYS (listen, int, (int fd, int backlog)); # endif _GL_CXXALIASWARN (listen); #elif @HAVE_WINSOCK2_H@ -# undef listen -# define listen listen_used_without_requesting_gnulib_module_listen +# if !GNULIB_LISTEN +# undef listen +# define listen listen_used_without_requesting_gnulib_module_listen +# endif #elif defined GNULIB_POSIXCHECK # undef listen # if HAVE_RAW_DECL_LISTEN @@ -531,7 +550,7 @@ _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - " # undef recv # define recv rpl_recv # endif -_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) +_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); # else @@ -542,8 +561,10 @@ _GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags) # endif _GL_CXXALIASWARN (recv); #elif @HAVE_WINSOCK2_H@ -# undef recv -# define recv recv_used_without_requesting_gnulib_module_recv +# if !GNULIB_RECV +# undef recv +# define recv recv_used_without_requesting_gnulib_module_recv +# endif #elif defined GNULIB_POSIXCHECK # undef recv # if HAVE_RAW_DECL_RECV @@ -559,7 +580,7 @@ _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - " # define send rpl_send # endif _GL_FUNCDECL_RPL (send, ssize_t, - (int fd, const void *buf, size_t len, int flags) + (int fd, const void *buf, size_t len, int flags), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (send, ssize_t, (int fd, const void *buf, size_t len, int flags)); @@ -572,8 +593,10 @@ _GL_CXXALIAS_SYS_CAST (send, ssize_t, # endif _GL_CXXALIASWARN (send); #elif @HAVE_WINSOCK2_H@ -# undef send -# define send send_used_without_requesting_gnulib_module_send +# if !GNULIB_SEND +# undef send +# define send send_used_without_requesting_gnulib_module_send +# endif #elif defined GNULIB_POSIXCHECK # undef send # if HAVE_RAW_DECL_SEND @@ -591,7 +614,7 @@ _GL_WARN_ON_USE (send, "send is not always POSIX compliant - " _GL_FUNCDECL_RPL (recvfrom, ssize_t, (int fd, void *restrict buf, size_t len, int flags, struct sockaddr *restrict from, - socklen_t *restrict fromlen) + socklen_t *restrict fromlen), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (recvfrom, ssize_t, (int fd, void *restrict buf, size_t len, int flags, @@ -609,8 +632,10 @@ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t, _GL_CXXALIASWARN (recvfrom); # endif #elif @HAVE_WINSOCK2_H@ -# undef recvfrom -# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom +# if !GNULIB_RECVFROM +# undef recvfrom +# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom +# endif #elif defined GNULIB_POSIXCHECK # undef recvfrom # if HAVE_RAW_DECL_RECVFROM @@ -627,7 +652,7 @@ _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - " # endif _GL_FUNCDECL_RPL (sendto, ssize_t, (int fd, const void *buf, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen) + const struct sockaddr *to, socklen_t tolen), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (sendto, ssize_t, (int fd, const void *buf, size_t len, int flags, @@ -641,8 +666,10 @@ _GL_CXXALIAS_SYS_CAST (sendto, ssize_t, # endif _GL_CXXALIASWARN (sendto); #elif @HAVE_WINSOCK2_H@ -# undef sendto -# define sendto sendto_used_without_requesting_gnulib_module_sendto +# if !GNULIB_SENDTO +# undef sendto +# define sendto sendto_used_without_requesting_gnulib_module_sendto +# endif #elif defined GNULIB_POSIXCHECK # undef sendto # if HAVE_RAW_DECL_SENDTO @@ -658,7 +685,7 @@ _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - " # define setsockopt rpl_setsockopt # endif _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, - const void * optval, socklen_t optlen) + const void * optval, socklen_t optlen), _GL_ARG_NONNULL ((4))); _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, const void * optval, socklen_t optlen)); @@ -671,8 +698,10 @@ _GL_CXXALIAS_SYS_CAST (setsockopt, int, # endif _GL_CXXALIASWARN (setsockopt); #elif @HAVE_WINSOCK2_H@ -# undef setsockopt -# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt +# if !GNULIB_SETSOCKOPT +# undef setsockopt +# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt +# endif #elif defined GNULIB_POSIXCHECK # undef setsockopt # if HAVE_RAW_DECL_SETSOCKOPT @@ -687,15 +716,17 @@ _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - " # undef shutdown # define shutdown rpl_shutdown # endif -_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how)); +_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how), ); _GL_CXXALIAS_RPL (shutdown, int, (int fd, int how)); # else _GL_CXXALIAS_SYS (shutdown, int, (int fd, int how)); # endif _GL_CXXALIASWARN (shutdown); #elif @HAVE_WINSOCK2_H@ -# undef shutdown -# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown +# if !GNULIB_SHUTDOWN +# undef shutdown +# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown +# endif #elif defined GNULIB_POSIXCHECK # undef shutdown # if HAVE_RAW_DECL_SHUTDOWN @@ -716,14 +747,14 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " # endif _GL_FUNCDECL_RPL (accept4, int, (int sockfd, struct sockaddr *addr, socklen_t *addrlen, - int flags)); + int flags), ); _GL_CXXALIAS_RPL (accept4, int, (int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)); # else _GL_FUNCDECL_SYS (accept4, int, (int sockfd, struct sockaddr *addr, socklen_t *addrlen, - int flags)); + int flags), ); _GL_CXXALIAS_SYS (accept4, int, (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 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 @@ /* Provide a more complete sys/stat.h header file. - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -55,7 +55,8 @@ #ifndef _@GUARD_PREFIX@_SYS_STAT_H #define _@GUARD_PREFIX@_SYS_STAT_H -/* This file uses _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, + GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ #if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif @@ -65,7 +66,7 @@ */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 +# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -122,9 +123,11 @@ # if @GNULIB_STAT@ # define stat rpl_stat # else - /* Provoke a clear link error if stat() is used as a function and - module 'stat' is not in use. */ -# define stat stat_used_without_requesting_gnulib_module_stat +# if !GNULIB_STAT + /* Provoke a clear link error if stat() is used as a function and + module 'stat' is not in use. */ +# define stat stat_used_without_requesting_gnulib_module_stat +# endif # endif # if !GNULIB_defined_struct_stat @@ -433,7 +436,7 @@ struct stat # undef chmod # define chmod rpl_chmod # endif -_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode) +_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode)); # elif defined _WIN32 && !defined __CYGWIN__ @@ -478,15 +481,15 @@ _GL_CXXALIASWARN (chmod); # define fchmodat rpl_fchmodat # endif _GL_FUNCDECL_RPL (fchmodat, int, - (int fd, char const *file, mode_t mode, int flag) - _GL_ARG_NONNULL ((2))); + (int fd, char const *file, mode_t mode, int flag), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (fchmodat, int, (int fd, char const *file, mode_t mode, int flag)); # else # if !@HAVE_FCHMODAT@ _GL_FUNCDECL_SYS (fchmodat, int, - (int fd, char const *file, mode_t mode, int flag) - _GL_ARG_NONNULL ((2))); + (int fd, char const *file, mode_t mode, int flag), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (fchmodat, int, (int fd, char const *file, mode_t mode, int flag)); @@ -507,7 +510,8 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " # undef fstat # define fstat rpl_fstat # endif -_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf), + _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); # else _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); @@ -516,8 +520,10 @@ _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); _GL_CXXALIASWARN (fstat); # endif #elif @GNULIB_OVERRIDES_STRUCT_STAT@ -# undef fstat -# define fstat fstat_used_without_requesting_gnulib_module_fstat +# if !GNULIB_FSTAT +# undef fstat +# define fstat fstat_used_without_requesting_gnulib_module_fstat +# endif #elif @WINDOWS_64_BIT_ST_SIZE@ /* Above, we define stat to _stati64. */ # define fstat _fstati64 @@ -538,7 +544,7 @@ _GL_WARN_ON_USE (fstat, "fstat has portability problems - " # endif _GL_FUNCDECL_RPL (fstatat, int, (int fd, char const *restrict name, struct stat *restrict st, - int flags) + int flags), _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (fstatat, int, (int fd, char const *restrict name, struct stat *restrict st, @@ -547,7 +553,7 @@ _GL_CXXALIAS_RPL (fstatat, int, # if !@HAVE_FSTATAT@ _GL_FUNCDECL_SYS (fstatat, int, (int fd, char const *restrict name, struct stat *restrict st, - int flags) + int flags), _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (fstatat, int, @@ -556,8 +562,10 @@ _GL_CXXALIAS_SYS (fstatat, int, # endif _GL_CXXALIASWARN (fstatat); #elif @GNULIB_OVERRIDES_STRUCT_STAT@ -# undef fstatat -# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat +# if !GNULIB_FSTATAT +# undef fstatat +# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat +# endif #elif defined GNULIB_POSIXCHECK # undef fstatat # if HAVE_RAW_DECL_FSTATAT @@ -577,11 +585,11 @@ _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " # undef futimens # define futimens rpl_futimens # endif -_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); +_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]), ); _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); # else # if !@HAVE_FUTIMENS@ -_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); +_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]), ); # endif _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); # endif @@ -600,9 +608,9 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - " #if @GNULIB_GETUMASK@ # if !@HAVE_GETUMASK@ # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 -_GL_FUNCDECL_SYS (getumask, mode_t, (void) _GL_ATTRIBUTE_NOTHROW); +_GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW; # else -_GL_FUNCDECL_SYS (getumask, mode_t, (void)); +_GL_FUNCDECL_SYS (getumask, mode_t, (void), ); # endif # endif _GL_CXXALIAS_SYS (getumask, mode_t, (void)); @@ -622,7 +630,7 @@ _GL_WARN_ON_USE (getumask, "getumask is not portable - " /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME denotes a symbolic link. */ # if !@HAVE_LCHMOD@ || defined __hpux -_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) +_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); @@ -642,7 +650,7 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " # undef mkdir # define mkdir rpl_mkdir # endif -_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) +_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); # elif defined _WIN32 && !defined __CYGWIN__ @@ -667,12 +675,6 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); -#elif defined GNULIB_POSIXCHECK -# undef mkdir -# if HAVE_RAW_DECL_MKDIR -_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " - "use gnulib module mkdir for portability"); -# endif #elif @GNULIB_MDA_MKDIR@ /* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between @@ -695,12 +697,18 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); +#elif defined GNULIB_POSIXCHECK +# undef mkdir +# if HAVE_RAW_DECL_MKDIR +_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " + "use gnulib module mkdir for portability"); +# endif #endif #if @GNULIB_MKDIRAT@ # if !@HAVE_MKDIRAT@ -_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) +_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode), _GL_ARG_NONNULL ((2))); # endif _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 - " # undef mkfifo # define mkfifo rpl_mkfifo # endif -_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) +_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); # else # if !@HAVE_MKFIFO@ -_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) +_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); @@ -746,12 +754,12 @@ _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " # undef mkfifoat # define mkfifoat rpl_mkfifoat # endif -_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode) +_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)); # else # if !@HAVE_MKFIFOAT@ -_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) +_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode), _GL_ARG_NONNULL ((2))); # endif _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 - " # undef mknod # define mknod rpl_mknod # endif -_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) +_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); # else # if !@HAVE_MKNOD@ -_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) +_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev), _GL_ARG_NONNULL ((1))); # endif /* 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 - " # define mknodat rpl_mknodat # endif _GL_FUNCDECL_RPL (mknodat, int, - (int fd, char const *file, mode_t mode, dev_t dev) + (int fd, char const *file, mode_t mode, dev_t dev), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mknodat, int, (int fd, char const *file, mode_t mode, dev_t dev)); # else # if !@HAVE_MKNODAT@ _GL_FUNCDECL_SYS (mknodat, int, - (int fd, char const *file, mode_t mode, dev_t dev) + (int fd, char const *file, mode_t mode, dev_t dev), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mknodat, int, @@ -841,7 +849,11 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " # elif @WINDOWS_64_BIT_ST_SIZE@ /* Above, we define stat to _stati64. */ # if defined __MINGW32__ && defined _stati64 -# ifndef _USE_32BIT_TIME_T +# ifdef _USE_32BIT_TIME_T + /* The system headers possibly define _stati64 to _stat32i64. */ +# undef _stat32i64 +# define _stat32i64(name, st) rpl_stat (name, st) +# else /* The system headers define _stati64 to _stat64. */ # undef _stat64 # define _stat64(name, st) rpl_stat (name, st) @@ -916,7 +928,7 @@ _GL_CXXALIAS_RPL_1 (lstat, stat, int, # define lstat rpl_lstat # endif _GL_FUNCDECL_RPL (lstat, int, - (const char *restrict name, struct stat *restrict buf) + (const char *restrict name, struct stat *restrict buf), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (lstat, int, (const char *restrict name, struct stat *restrict buf)); @@ -928,8 +940,10 @@ _GL_CXXALIAS_SYS (lstat, int, _GL_CXXALIASWARN (lstat); # endif #elif @GNULIB_OVERRIDES_STRUCT_STAT@ -# undef lstat -# define lstat lstat_used_without_requesting_gnulib_module_lstat +# if !GNULIB_LSTAT +# undef lstat +# define lstat lstat_used_without_requesting_gnulib_module_lstat +# endif #elif defined GNULIB_POSIXCHECK # undef lstat # if HAVE_RAW_DECL_LSTAT @@ -968,14 +982,14 @@ _GL_CXXALIASWARN (umask); # define utimensat rpl_utimensat # endif _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, - struct timespec const times[2], int flag) + struct timespec const times[2], int flag), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, struct timespec const times[2], int flag)); # else # if !@HAVE_UTIMENSAT@ _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, - struct timespec const times[2], int flag) + struct timespec const times[2], int flag), _GL_ARG_NONNULL ((2))); # endif _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 @@ /* Provide a more complete sys/types.h. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -60,6 +60,15 @@ # define _GL_WINDOWS_64_BIT_OFF_T 1 #endif +/* Define the off64_t type. */ +#if !@HAVE_OFF64_T@ +# if !GNULIB_defined_off64_t +/* Define off64_t to int64_t always. */ +typedef long long off64_t; +# define GNULIB_defined_off64_t 1 +# endif +#endif + /* Override dev_t and ino_t if distinguishable inodes support is requested on native Windows. */ #if @WINDOWS_STAT_INODES@ @@ -108,6 +117,22 @@ typedef unsigned long long int rpl_ino_t; # include #endif +/* Define blksize_t, required by POSIX:2024. */ +#if !@HAVE_BLKSIZE_T@ +# if !defined GNULIB_defined_blksize_t +typedef int blksize_t; +# define GNULIB_defined_blksize_t 1 +# endif +#endif + +/* Define blkcnt_t, required by POSIX:2024. */ +#if !@HAVE_BLKCNT_T@ +# if !defined GNULIB_defined_blkcnt_t +typedef long long blkcnt_t; +# define GNULIB_defined_blkcnt_t 1 +# endif +#endif + #endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ #endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ #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 @@ /* Substitute for . - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* A more-standard . - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -122,6 +122,23 @@ struct __time_t_must_be_integral { # endif # endif +# if @GNULIB_TZNAME@ +/* tzname[0..1]: Abbreviated time zone names, set by the tzset() function. */ +# if NEED_DECL_TZNAME +extern +# ifdef __cplusplus + "C" +# endif + char *tzname[]; +# endif +# if defined _WIN32 && !defined __CYGWIN__ +/* On native Windows, map 'tzname' to '_tzname' etc., so that -loldnames is not + required. */ +# undef tzname +# define tzname _tzname +# endif +# endif + /* Set *TS to the current time, and return BASE. Upon failure, return 0. */ # if @GNULIB_TIMESPEC_GET@ @@ -130,12 +147,12 @@ struct __time_t_must_be_integral { # undef timespec_get # define timespec_get rpl_timespec_get # endif -_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base) +_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base)); # else # if !@HAVE_TIMESPEC_GET@ -_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) +_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base), _GL_ARG_NONNULL ((1))); # endif _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 - " # undef timespec_getres # define timespec_getres rpl_timespec_getres # endif -_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base) +_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base)); # else # if !@HAVE_TIMESPEC_GETRES@ -_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) +_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (timespec_getres); +# endif # elif defined GNULIB_POSIXCHECK # undef timespec_getres # if HAVE_RAW_DECL_TIMESPEC_GETRES @@ -184,7 +203,7 @@ _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define time rpl_time # endif -_GL_FUNCDECL_RPL (time, time_t, (time_t *__tp)); +_GL_FUNCDECL_RPL (time, time_t, (time_t *__tp), ); _GL_CXXALIAS_RPL (time, time_t, (time_t *__tp)); # else _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); @@ -209,14 +228,14 @@ _GL_WARN_ON_USE (time, "time has consistency problems - " # define nanosleep rpl_nanosleep # endif _GL_FUNCDECL_RPL (nanosleep, int, - (struct timespec const *__rqtp, struct timespec *__rmtp) + (struct timespec const *__rqtp, struct timespec *__rmtp), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp)); # else # if ! @HAVE_NANOSLEEP@ _GL_FUNCDECL_SYS (nanosleep, int, - (struct timespec const *__rqtp, struct timespec *__rmtp) + (struct timespec const *__rqtp, struct timespec *__rmtp), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (nanosleep, int, @@ -238,7 +257,7 @@ _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " # undef tzset # define tzset rpl_tzset # endif -_GL_FUNCDECL_RPL (tzset, void, (void)); +_GL_FUNCDECL_RPL (tzset, void, (void), ); _GL_CXXALIAS_RPL (tzset, void, (void)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -278,7 +297,7 @@ _GL_WARN_ON_USE (tzset, "tzset has portability problems - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mktime rpl_mktime # endif -_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); # else _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); @@ -304,14 +323,14 @@ _GL_WARN_ON_USE (mktime, "mktime has portability problems - " # define localtime_r rpl_localtime_r # endif _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result) + struct tm *restrict __result), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # else # if ! @HAVE_DECL_LOCALTIME_R@ _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result) + struct tm *restrict __result), _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, @@ -326,14 +345,14 @@ _GL_CXXALIASWARN (localtime_r); # define gmtime_r rpl_gmtime_r # endif _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result) + struct tm *restrict __result), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, struct tm *restrict __result)); # else # if ! @HAVE_DECL_LOCALTIME_R@ _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, - struct tm *restrict __result) + struct tm *restrict __result), _GL_ARG_NONNULL ((1, 2))); # endif _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 - " # undef localtime # define localtime rpl_localtime # endif -_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) +_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); # else @@ -387,7 +406,7 @@ _GL_WARN_ON_USE (localtime, "localtime has portability problems - " # undef gmtime # define gmtime rpl_gmtime # endif -_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) +_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); # else @@ -403,7 +422,7 @@ _GL_CXXALIASWARN (gmtime); # if ! @HAVE_STRPTIME@ _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, char const *restrict __format, - struct tm *restrict __tm) + struct tm *restrict __tm), _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, @@ -428,7 +447,7 @@ _GL_WARN_ON_USE (strptime, "strptime is unportable - " # ifndef __cplusplus _GL_ATTRIBUTE_DEPRECATED # endif -_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) +_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); # else @@ -450,7 +469,7 @@ _GL_CXXALIASWARN (ctime); # endif _GL_FUNCDECL_RPL (strftime, size_t, (char *restrict __buf, size_t __bufsize, - const char *restrict __fmt, const struct tm *restrict __tp) + const char *restrict __fmt, const struct tm *restrict __tp), _GL_ARG_NONNULL ((1, 3, 4))); _GL_CXXALIAS_RPL (strftime, size_t, (char *restrict __buf, size_t __bufsize, @@ -471,14 +490,24 @@ _GL_WARN_ON_USE (strftime, "strftime has portability problems - " # endif # endif -# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ +# if @GNULIB_TIME_RZ@ /* Functions that use a first-class time zone data type, instead of relying on an implicit global time zone. Inspired by NetBSD. */ /* Represents a time zone. (timezone_t) NULL stands for UTC. */ +# if !@HAVE_TZALLOC@ +# if !GNULIB_defined_timezone_t +# if !@HAVE_TIMEZONE_T@ typedef struct tm_zone *timezone_t; +# else +typedef struct tm_zone *rpl_timezone_t; +# define timezone_t rpl_timezone_t +# endif +# define GNULIB_defined_timezone_t 1 +# endif +# endif /* tzalloc (name) Returns a time zone object for the given time zone NAME. This object @@ -488,37 +517,72 @@ typedef struct tm_zone *timezone_t; would use it the TZ environment variable was unset. May return NULL if NAME is invalid (this is platform dependent) or upon memory allocation failure. */ -_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); +# if !@HAVE_TZALLOC@ +_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name), ); _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); +# endif /* tzfree (tz) Frees a time zone object. The argument must have been returned by tzalloc(). */ -_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); +# if !@HAVE_TZALLOC@ +_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz), ); _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); +# endif /* localtime_rz (tz, &t, &result) Converts an absolute time T to a broken-down time RESULT, assuming the time zone TZ. This function is like 'localtime_r', but relies on the argument TZ instead of an implicit global time zone. */ +# if @REPLACE_LOCALTIME_RZ@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef localtime_rz +# define localtime_rz rpl_localtime_rz +# endif +_GL_FUNCDECL_RPL (localtime_rz, struct tm *, + (timezone_t __tz, time_t const *restrict __timer, + struct tm *restrict __result), + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (localtime_rz, struct tm *, + (timezone_t __tz, time_t const *restrict __timer, + struct tm *restrict __result)); +# else +# if !@HAVE_TZALLOC@ _GL_FUNCDECL_SYS (localtime_rz, struct tm *, (timezone_t __tz, time_t const *restrict __timer, - struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); + struct tm *restrict __result), + _GL_ARG_NONNULL ((2, 3))); +# endif _GL_CXXALIAS_SYS (localtime_rz, struct tm *, (timezone_t __tz, time_t const *restrict __timer, struct tm *restrict __result)); +# endif /* mktime_z (tz, &tm) Normalizes the broken-down time TM and converts it to an absolute time, assuming the time zone TZ. Returns the absolute time. This function is like 'mktime', but relies on the argument TZ instead of an implicit global time zone. */ +# if @REPLACE_MKTIME_Z@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mktime_z +# define mktime_z rpl_mktime_z +# endif +_GL_FUNCDECL_RPL (mktime_z, time_t, + (timezone_t __tz, struct tm *restrict __tm), + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (mktime_z, time_t, + (timezone_t __tz, struct tm *restrict __tm)); +# else +# if !@HAVE_TZALLOC@ _GL_FUNCDECL_SYS (mktime_z, time_t, - (timezone_t __tz, struct tm *restrict __tm) + (timezone_t __tz, struct tm *restrict __tm), _GL_ARG_NONNULL ((2))); +# endif _GL_CXXALIAS_SYS (mktime_z, time_t, (timezone_t __tz, struct tm *restrict __tm)); +# endif /* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' in the 'tm_zone' member of 'struct tm') are valid as long as @@ -535,11 +599,11 @@ _GL_CXXALIAS_SYS (mktime_z, time_t, # undef timegm # define timegm rpl_timegm # endif -_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); # else # if ! @HAVE_TIMEGM@ -_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); # 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 @@ /* Reentrant time functions like localtime_r. - Copyright (C) 2003, 2006-2007, 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2010-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Convert UTC calendar time to simple time. Like mktime but assumes UTC. - Copyright (C) 1994-2024 Free Software Foundation, Inc. + Copyright (C) 1994-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,8 +30,7 @@ __time64_t __timegm64 (struct tm *tmp) { static mktime_offset_t gmtime_offset; - tmp->tm_isdst = 0; - return __mktime_internal (tmp, __gmtime64_r, &gmtime_offset); + return __mktime_internal (tmp, false, &gmtime_offset); } #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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* substitute - 16-bit and 32-bit wide character types. + Copyright (C) 2019-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2019. */ + +/* + * ISO C 23 for platforms that lack it. + */ + +#ifndef _GL_UCHAR_H + +#if __GNUC__ >= 3 +#pragma GCC system_header +#endif + + +/* The include_next requires a split double-inclusion guard. */ +#if (defined __cplusplus ? 0 : 1) +# if defined __HAIKU__ +/* Work around . */ +# include +# endif +/* On AIX 7.2 with xlclang++, /usr/include/uchar.h produces compilation errors + because it contains typedef definitions of char16_t and char32_t, however + char16_t and char32_t are keywords in this situation. To work around it, + define char16_t and char32_t as macros. */ +# if defined __cplusplus && defined _AIX && defined __ibmxl__ && defined __clang__ +# define char16_t gl_char16_t +# define char32_t gl_char32_t +# endif +# include_next +#endif + +#ifndef _GL_UCHAR_H +#define _GL_UCHAR_H + +/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_BEGIN_C_LINKAGE, + _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +/* Get uint_least16_t, uint_least32_t. */ +#include + +/* Get mbstate_t, size_t. */ +#include + +/* For the inline functions. */ +#include +#include + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ +/* C++ compatible function declaration macros. + Copyright (C) 2010-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _GL_CXXDEFS_H +#define _GL_CXXDEFS_H + +/* Begin/end the GNULIB_NAMESPACE namespace. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { +# define _GL_END_NAMESPACE } +#else +# define _GL_BEGIN_NAMESPACE +# define _GL_END_NAMESPACE +#endif + +/* The three most frequent use cases of these macros are: + + * For providing a substitute for a function that is missing on some + platforms, but is declared and works fine on the platforms on which + it exists: + + #if @GNULIB_FOO@ + # if !@HAVE_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on all platforms, + but is broken/insufficient and needs to be replaced on some platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on some platforms + but is broken/insufficient and needs to be replaced on some of them and + is additionally either missing or undeclared on some other platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif +*/ + +/* _GL_EXTERN_C declaration; + performs the declaration with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C extern "C" +#else +# define _GL_EXTERN_C extern +#endif + +/* _GL_EXTERN_C_FUNC declaration; + performs the declaration of a function with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C_FUNC extern "C" +#else +/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax + are not allowed between 'extern' and the return type (see gnulib-common.m4). + */ +# define _GL_EXTERN_C_FUNC +#endif + +/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]); + declares a replacement function, named rpl_func, with the given prototype, + consisting of return type, parameters, and attributes. + Although attributes are optional, the comma before them is required + for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, + if needed, must be placed after the _GL_FUNCDECL_RPL invocation, + at the end of the declaration. + Examples: + _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW; + _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...), + _GL_ARG_NONNULL ((1))); + + Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front + of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's + because + [[...]] extern "C" ; + is invalid syntax in C++.) + */ +#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \ + _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__) +#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters + +/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to + parenthesized func otherwise. Parenthesization is needed in C23 if + the function is like strchr and so is a qualifier-generic macro + that expands to something more complicated. */ +#ifdef __cplusplus +# define _GL_FUNCDECL_SYS_NAME(func) func +#else +# define _GL_FUNCDECL_SYS_NAME(func) (func) +#endif + +/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); + declares the system function, named func, with the given prototype, + consisting of return type, parameters, and attributes. + Although attributes are optional, the comma before them is required + for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW, + if needed, must be placed after the _GL_FUNCDECL_RPL invocation, + at the end of the declaration. + Examples: + _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW; + _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); + */ +#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters + +/* _GL_CXXALIAS_RPL (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to rpl_func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); + + Wrapping rpl_func in an object with an inline conversion operator + avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_MDA (func, rettype, parameters); + is to be used when func is a Microsoft deprecated alias, on native Windows. + It declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to _func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); + */ +#define _GL_CXXALIAS_MDA(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) + +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the "invalid conversion" error + that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::rpl_func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_MDA (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) + +/* _GL_CXXALIAS_SYS (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to the system provided function func, if GNULIB_NAMESPACE + is defined. + Example: + _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); + + Wrapping func in an object with an inline conversion operator + avoids a reference to func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function is picked among a set of overloaded functions, + namely the one with rettype2 and parameters2. Two consecutive casts + are used to silence the "cannot find a match" and "invalid conversion" + errors that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* The outer cast must be a reinterpret_cast. + The inner cast: When the function is defined as a set of overloaded + functions, it works as a static_cast<>, choosing the designated variant. + When the function is defined as a single variant, it works as a + reinterpret_cast<>. The parenthesized cast syntax works both ways. */ +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast((rettype2 (*) parameters2)(::func)); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN (func); + causes a warning to be emitted when ::func is used but not when + GNULIB_NAMESPACE::func is used. func must be defined without overloaded + variants. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN(func) \ + _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN_1(func,namespace) \ + _GL_CXXALIASWARN_2 (func, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_WARN_ON_USE (func, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN_2(func,namespace) \ + extern __typeof__ (func) func +# else +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN(func) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); + causes a warning to be emitted when the given overloaded variant of ::func + is used but not when GNULIB_NAMESPACE::func is used. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ + GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ + _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# else +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +#endif /* _GL_CXXDEFS_H */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ +/* A C macro for declaring that specific arguments must not be NULL. + Copyright (C) 2009-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools + that the values passed as arguments n, ..., m must be non-NULL pointers. + n = 1 stands for the first argument, n = 2 for the second argument etc. */ +#ifndef _GL_ARG_NONNULL +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ +# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) +# else +# define _GL_ARG_NONNULL(params) +# endif +#endif + +/* The definition of _GL_WARN_ON_USE is copied here. */ +/* A C macro for emitting warnings if a function is used. + Copyright (C) 2010-2025 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* _GL_WARN_ON_USE (function, "literal string") issues a declaration + for FUNCTION which will then trigger a compiler warning containing + the text of "literal string" anywhere that function is called, if + supported by the compiler. If the compiler does not support this + feature, the macro expands to an unused extern declaration. + + _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the + attribute used in _GL_WARN_ON_USE. If the compiler does not support + this feature, it expands to empty. + + These macros are useful for marking a function as a potential + portability trap, with the intent that "literal string" include + instructions on the replacement function that should be used + instead. + _GL_WARN_ON_USE is for functions with 'extern' linkage. + _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' + linkage. + + _GL_WARN_ON_USE should not be used more than once for a given function + in a given compilation unit (because this may generate a warning even + if the function is never called). + + However, one of the reasons that a function is a portability trap is + if it has the wrong signature. Declaring FUNCTION with a different + signature in C is a compilation error, so this macro must use the + same type as any existing declaration so that programs that avoid + the problematic FUNCTION do not fail to compile merely because they + included a header that poisoned the function. But this implies that + _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already + have a declaration. Use of this macro implies that there must not + be any other macro hiding the declaration of FUNCTION; but + undefining FUNCTION first is part of the poisoning process anyway + (although for symbols that are provided only via a macro, the result + is a compilation error rather than a warning containing + "literal string"). Also note that in C++, it is only safe to use if + FUNCTION has no overloads. + + For an example, it is possible to poison 'getline' by: + - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], + [getline]) in configure.ac, which potentially defines + HAVE_RAW_DECL_GETLINE + - adding this code to a header that wraps the system : + #undef getline + #if HAVE_RAW_DECL_GETLINE + _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" + "not universally present; use the gnulib module getline"); + #endif + + It is not possible to directly poison global variables. But it is + possible to write a wrapper accessor function, and poison that + (less common usage, like &environ, will cause a compilation error + rather than issue the nice warning, but the end result of informing + the developer about their portability problem is still achieved): + #if HAVE_RAW_DECL_ENVIRON + static char *** + rpl_environ (void) { return &environ; } + _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); + # undef environ + # define environ (*rpl_environ ()) + #endif + or better (avoiding contradictory use of 'static' and 'extern'): + #if HAVE_RAW_DECL_ENVIRON + static char *** + _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") + rpl_environ (void) { return &environ; } + # undef environ + # define environ (*rpl_environ ()) + #endif + */ +#ifndef _GL_WARN_ON_USE + +# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__warning__ (message))) +# elif __clang_major__ >= 4 +/* Another compiler attribute is available in clang. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function \ + __attribute__ ((__diagnose_if__ (1, message, "warning"))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__diagnose_if__ (1, message, "warning"))) +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C __typeof__ (function) function +# define _GL_WARN_ON_USE_ATTRIBUTE(message) +# else /* Unsupported. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# define _GL_WARN_ON_USE_ATTRIBUTE(message) +# endif +#endif + +/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") + is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the + function is declared with the given prototype, consisting of return type, + parameters, and attributes. + This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does + not work in this case. */ +#ifndef _GL_WARN_ON_USE_CXX +# if !defined __cplusplus +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ + _GL_WARN_ON_USE (function, msg) +# else +# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes \ + __attribute__ ((__warning__ (msg))) +# elif __clang_major__ >= 4 +/* Another compiler attribute is available in clang. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_clang function parameters_and_attributes \ + __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes +# else /* Unsupported. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +# endif +#endif + +/* _GL_WARN_EXTERN_C declaration; + performs the declaration with C linkage. */ +#ifndef _GL_WARN_EXTERN_C +# if defined __cplusplus +# define _GL_WARN_EXTERN_C extern "C" +# else +# define _GL_WARN_EXTERN_C extern +# endif +#endif + + +_GL_INLINE_HEADER_BEGIN + + +#if !(defined __cplusplus ? 0 || 0 : 1) + +/* An 8-bit variant of wchar_t. + Note: This type is only mandated by ISO C 23 or newer, and it does + denote UTF-8 units. */ +typedef unsigned char char8_t; + +#elif 0 + +typedef unsigned char gl_char8_t; +# define char8_t gl_char8_t + +#endif + +#if !(defined __cplusplus ? 0 || 0 : 1) + +/* A 16-bit variant of wchar_t. + Note: This type is only mandated by ISO C 11 or newer. In ISO C 23 + and newer, it denotes UTF-16 units; in older versions of ISO C it did + so only on platforms on which __STDC_UTF_16__ was defined. */ +typedef uint_least16_t char16_t; + +#elif 0 + +typedef uint_least16_t gl_char16_t; +# define char16_t gl_char16_t + +#endif + +#if !(defined __cplusplus ? 0 || 0 : 1) + +/* A 32-bit variant of wchar_t. + Note: This type is only mandated by ISO C 11 or newer. In ISO C 23 + and newer, it denotes UTF-32 code points; in older versions of ISO C + it did so only on platforms on which __STDC_UTF_32__ was defined. + In gnulib, we guarantee that it denotes UTF-32 code points if and + only if the module 'uchar-h-c23' is in use. */ +typedef uint_least32_t char32_t; + +#elif 0 + +typedef uint_least32_t gl_char32_t; +# define char32_t gl_char32_t + +#endif + +/* Define if a 'char32_t' can hold more characters than a 'wchar_t'. */ +#if 0 /* 32-bit AIX, Cygwin, native Windows */ +# define _GL_SMALL_WCHAR_T 1 +#endif + +/* Define if 'wchar_t', like 'char32_t', + - is a 32-bit type, and + - represents Unicode code points. + For this test, we can use __STDC_ISO_10646__ (defined by glibc, musl libc, + Cygwin) but need to consider _GL_SMALL_WCHAR_T, so as to exclude Cygwin. + We cannot use __STDC_UTF_16__ or __STDC_UTF_32__ + - because these macros provide info about char16_t and char32_t (not + wchar_t!), and + - because GCC >= 4.9 defines these macros on all platforms, even on + FreeBSD and Solaris. + We should better not use __STD_UTF_16__, __STD_UTF_32__ either, because + these macros are misspellings, only defined by Android's . */ +#if defined __STDC_ISO_10646__ && !_GL_SMALL_WCHAR_T +/* glibc, musl libc */ +# define _GL_WCHAR_T_IS_UCS4 1 +#endif +#if _GL_WCHAR_T_IS_UCS4 +static_assert (sizeof (char32_t) == sizeof (wchar_t)); +#endif + + +/* Convert a single-byte character to a 32-bit wide character. */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_BTOC32 +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ATTRIBUTE_PURE wint_t +btoc32 (int c) +{ + return +# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + btowc (c); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (btoc32, wint_t, (int c), _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (btoc32, wint_t, (int c)); +_GL_CXXALIASWARN (btoc32); +#endif + + +/* Test a specific property of a 32-bit wide character. */ +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALNUM +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isalnum (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswalnum (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isalnum, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isalnum, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isalnum); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALPHA +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isalpha (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswalpha (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isalpha, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isalpha, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isalpha); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISBLANK +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isblank (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswblank (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isblank, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isblank, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isblank); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISCNTRL +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32iscntrl (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswcntrl (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32iscntrl, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32iscntrl, int, (wint_t wc)); +_GL_CXXALIASWARN (c32iscntrl); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISDIGIT +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isdigit (wint_t wc) +{ + return +# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswdigit (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isdigit, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isdigit, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isdigit); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISGRAPH +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isgraph (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswgraph (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isgraph, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isgraph, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isgraph); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISLOWER +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32islower (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswlower (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32islower, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32islower, int, (wint_t wc)); +_GL_CXXALIASWARN (c32islower); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPRINT +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isprint (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswprint (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isprint, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isprint, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isprint); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPUNCT +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32ispunct (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswpunct (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32ispunct, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32ispunct, int, (wint_t wc)); +_GL_CXXALIASWARN (c32ispunct); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISSPACE +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isspace (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswspace (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isspace, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isspace, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isspace); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISUPPER +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isupper (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswupper (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isupper, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isupper, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isupper); +#endif +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISXDIGIT +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isxdigit (wint_t wc) +{ + return +# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswxdigit (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isxdigit, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isxdigit, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isxdigit); +#endif + + +/* Case mapping of a 32-bit wide character. */ +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOLOWER +_GL_BEGIN_C_LINKAGE +_GL_INLINE wint_t +c32tolower (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + towlower (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32tolower, wint_t, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32tolower, wint_t, (wint_t wc)); +_GL_CXXALIASWARN (c32tolower); +#endif +#if 0 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOUPPER +_GL_BEGIN_C_LINKAGE +_GL_INLINE wint_t +c32toupper (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + towupper (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32toupper, wint_t, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32toupper, wint_t, (wint_t wc)); +_GL_CXXALIASWARN (c32toupper); +#endif + + +/* Number of screen columns needed for a 32-bit wide character. */ +#if 1 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32WIDTH +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32width (char32_t wc) +{ + return +# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcwidth (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32width, int, (char32_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32width, int, (char32_t wc)); +_GL_CXXALIASWARN (c32width); +#endif + + +/* Converts a 32-bit wide character to a multibyte character. */ +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef c32rtomb +# define c32rtomb rpl_c32rtomb +# endif +_GL_FUNCDECL_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), ); +_GL_CXXALIAS_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps)); +# else +# if !1 +_GL_FUNCDECL_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), ); +# endif +_GL_CXXALIAS_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps)); +# endif +# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 +_GL_CXXALIASWARN (c32rtomb); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_C32RTOMB +_GL_WARN_ON_USE (c32rtomb, "c32rtomb is not portable - " + "use gnulib module c32rtomb for portability"); +# endif +#endif + + +/* Convert a 32-bit wide string to a string. */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SNRTOMBS +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len, + mbstate_t *ps) +{ + return +# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32snrtombs, size_t, + (char *dest, const char32_t **srcp, size_t srclen, size_t len, + mbstate_t *ps), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32snrtombs, size_t, + (char *dest, const char32_t **srcp, size_t srclen, size_t len, + mbstate_t *ps)); +_GL_CXXALIASWARN (c32snrtombs); +#endif + + +/* Convert a 32-bit wide string to a string. */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SRTOMBS +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps) +{ + return +# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcsrtombs (dest, (const wchar_t **) srcp, len, ps); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32srtombs, size_t, + (char *dest, const char32_t **srcp, size_t len, + mbstate_t *ps), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32srtombs, size_t, + (char *dest, const char32_t **srcp, size_t len, + mbstate_t *ps)); +_GL_CXXALIASWARN (c32srtombs); +#endif + + +/* Convert a 32-bit wide string to a string. */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32STOMBS +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +c32stombs (char *dest, const char32_t *src, size_t len) +{ + mbstate_t state; + + mbszero (&state); + return c32srtombs (dest, &src, len, &state); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32stombs, size_t, + (char *dest, const char32_t *src, size_t len), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32stombs, size_t, + (char *dest, const char32_t *src, size_t len)); +_GL_CXXALIASWARN (c32stombs); +#endif + + +/* Number of screen columns needed for a size-bounded 32-bit wide string. */ +#if 0 +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32SWIDTH +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((1)) int +c32swidth (const char32_t *s, size_t n) +{ + return +# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcswidth ((const wchar_t *) s, n); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (c32swidth, int, (const char32_t *s, size_t n)); +_GL_CXXALIASWARN (c32swidth); +#endif + + +/* Converts a 32-bit wide character to unibyte character. + Returns the single-byte representation of WC if it exists, + or EOF otherwise. */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32TOB +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32tob (wint_t wc) +{ + return +# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wctob (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32tob, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32tob, int, (wint_t wc)); +_GL_CXXALIASWARN (c32tob); +#endif + + +/* Converts a multibyte character to a 32-bit wide character. */ +#if 1 +# if 1 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbrtoc32 +# define mbrtoc32 rpl_mbrtoc32 +# endif +_GL_FUNCDECL_RPL (mbrtoc32, size_t, + (char32_t *pc, const char *s, size_t n, mbstate_t *ps), ); +_GL_CXXALIAS_RPL (mbrtoc32, size_t, + (char32_t *pc, const char *s, size_t n, mbstate_t *ps)); +# else +# if !1 +_GL_FUNCDECL_SYS (mbrtoc32, size_t, + (char32_t *pc, const char *s, size_t n, mbstate_t *ps), ); +# endif +_GL_CXXALIAS_SYS (mbrtoc32, size_t, + (char32_t *pc, const char *s, size_t n, mbstate_t *ps)); +# endif +# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 +_GL_CXXALIASWARN (mbrtoc32); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_MBRTOC32 +_GL_WARN_ON_USE (mbrtoc32, "mbrtoc32 is not portable - " + "use gnulib module mbrtoc32 for portability"); +# endif +#endif + + +/* Converts a multibyte character and returns the next 16-bit wide + character. */ +#if 0 +# if 0 +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbrtoc16 +# define mbrtoc16 rpl_mbrtoc16 +# endif +_GL_FUNCDECL_RPL (mbrtoc16, size_t, + (char16_t *pc, const char *s, size_t n, mbstate_t *ps), ); +_GL_CXXALIAS_RPL (mbrtoc16, size_t, + (char16_t *pc, const char *s, size_t n, mbstate_t *ps)); +# else +# if !1 +_GL_FUNCDECL_SYS (mbrtoc16, size_t, + (char16_t *pc, const char *s, size_t n, mbstate_t *ps), ); +# endif +_GL_CXXALIAS_SYS (mbrtoc16, size_t, + (char16_t *pc, const char *s, size_t n, mbstate_t *ps)); +# endif +# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 +_GL_CXXALIASWARN (mbrtoc16); +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_MBRTOC16 +_GL_WARN_ON_USE (mbrtoc16, "mbrtoc16 is not portable - " + "use gnulib module mbrtoc16 for portability"); +# endif +#endif + + +/* Convert a string to a 32-bit wide string. */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSNRTOC32S +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps) +{ + return +# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (mbsnrtoc32s, size_t, + (char32_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mbsnrtoc32s, size_t, + (char32_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps)); +_GL_CXXALIASWARN (mbsnrtoc32s); +#endif + + +/* Convert a string to a 32-bit wide string. */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSRTOC32S +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps) +{ + return +# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + mbsrtowcs ((wchar_t *) dest, srcp, len, ps); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (mbsrtoc32s, size_t, + (char32_t *dest, const char **srcp, size_t len, + mbstate_t *ps), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mbsrtoc32s, size_t, + (char32_t *dest, const char **srcp, size_t len, + mbstate_t *ps)); +_GL_CXXALIASWARN (mbsrtoc32s); +#endif + + +/* Convert a string to a 32-bit wide string. */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSTOC32S +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +mbstoc32s (char32_t *dest, const char *src, size_t len) +{ + mbstate_t state; + + mbszero (&state); + return mbsrtoc32s (dest, &src, len, &state); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (mbstoc32s, size_t, + (char32_t *dest, const char *src, size_t len), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mbstoc32s, size_t, + (char32_t *dest, const char *src, size_t len)); +_GL_CXXALIASWARN (mbstoc32s); +#endif + + +#if 0 || 0 +/* A scalar type. Instances of this type, other than (c32_type_test_t) 0, + represent a character property, sometimes also viewed as a "character class". + It can be applied to 32-bit wide characters. It is the counterpart of + type 'wctype_t' for wide characters. + To test whether a given character has a certain property, use the function + 'c32_apply_type_test'. */ +# if _GL_WCHAR_T_IS_UCS4 +typedef wctype_t c32_type_test_t; +# else +typedef /*bool*/int (*c32_type_test_t) (wint_t wc); +# endif +#endif + +/* Return a character property with the given name, or (c32_type_test_t) 0 + if the designated property does not exist. + This function is the counterpart of function 'wctype' for wide characters. + */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_TYPE_TEST +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t +c32_get_type_test (const char *name) +{ + return +# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wctype (name); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name)); +_GL_CXXALIASWARN (c32_get_type_test); +#endif + +/* Test whether a given 32-bit wide character has the specified character + property. + Return non-zero if true, zero if false or if the argument is WEOF. + This function is the counterpart of function 'iswctype' for wide characters. + */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 +# if !defined IN_C32_APPLY_TYPE_TEST +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32_apply_type_test (wint_t wc, c32_type_test_t property) +{ + return +# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswctype (wc, property); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32_apply_type_test, int, + (wint_t wc, c32_type_test_t property), ); +# endif +# else +_GL_FUNCDECL_SYS (c32_apply_type_test, int, + (wint_t wc, c32_type_test_t property), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32_apply_type_test, int, + (wint_t wc, c32_type_test_t property)); +_GL_CXXALIASWARN (c32_apply_type_test); +#endif + + +#if 0 || 0 +/* A scalar type. Instances of this type, other than (c32_mapping_t) 0, + represent a character mapping. It can be applied to 32-bit wide characters. + It is the counterpart of type 'wctrans_t' for wide characters. + To apply a certain mapping to a given character, use the function + 'c32_apply_mapping'. */ +# if _GL_WCHAR_T_IS_UCS4 +typedef wctrans_t c32_mapping_t; +# else +typedef wint_t (*c32_mapping_t) (wint_t wc); +# endif +#endif + +/* Return a character mapping with the given name, or (c32_mapping_t) 0 + if the designated mapping does not exist. + This function is the counterpart of function 'wctrans' for wide characters. + */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_MAPPING +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((1)) c32_mapping_t +c32_get_mapping (const char *name) +{ + return +# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wctrans (name); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (c32_get_mapping, c32_mapping_t, (const char *name)); +_GL_CXXALIASWARN (c32_get_mapping); +#endif + +/* Apply the specified character mapping to a given 32-bit wide character. + Return the result of this mapping. Return the WC argument unchanged if it is + WEOF. + This function is the counterpart of function 'towctrans' for wide characters. + */ +#if 0 +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_APPLY_MAPPING +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) wint_t +c32_apply_mapping (wint_t wc, c32_mapping_t mapping) +{ + return +# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + towctrans (wc, mapping); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32_apply_mapping, wint_t, + (wint_t wc, c32_mapping_t mapping), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32_apply_mapping, wint_t, + (wint_t wc, c32_mapping_t mapping)); +_GL_CXXALIASWARN (c32_apply_mapping); +#endif + + +_GL_INLINE_HEADER_END + +#endif /* _GL_UCHAR_H */ +#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 @@ +/* substitute - 16-bit and 32-bit wide character types. + Copyright (C) 2019-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2019. */ + +/* + * ISO C 23 for platforms that lack it. + */ + +#ifndef _@GUARD_PREFIX@_UCHAR_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* The include_next requires a split double-inclusion guard. */ +#if (defined __cplusplus ? @CXX_HAVE_UCHAR_H@ : @HAVE_UCHAR_H@) +# if defined __HAIKU__ +/* Work around . */ +# include +# endif +/* On AIX 7.2 with xlclang++, /usr/include/uchar.h produces compilation errors + because it contains typedef definitions of char16_t and char32_t, however + char16_t and char32_t are keywords in this situation. To work around it, + define char16_t and char32_t as macros. */ +# if defined __cplusplus && defined _AIX && defined __ibmxl__ && defined __clang__ +# define char16_t gl_char16_t +# define char32_t gl_char32_t +# endif +# @INCLUDE_NEXT@ @NEXT_UCHAR_H@ +#endif + +#ifndef _@GUARD_PREFIX@_UCHAR_H +#define _@GUARD_PREFIX@_UCHAR_H + +/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_BEGIN_C_LINKAGE, + _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +/* Get uint_least16_t, uint_least32_t. */ +#include + +/* Get mbstate_t, size_t. */ +#include + +/* For the inline functions. */ +#include +#include + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +_GL_INLINE_HEADER_BEGIN + + +#if !(defined __cplusplus ? @CXX_HAVE_UCHAR_H@ || @CXX_HAS_CHAR8_TYPE@ : @HAVE_UCHAR_H@) + +/* An 8-bit variant of wchar_t. + Note: This type is only mandated by ISO C 23 or newer, and it does + denote UTF-8 units. */ +typedef unsigned char char8_t; + +#elif @GNULIBHEADERS_OVERRIDE_CHAR8_T@ + +typedef unsigned char gl_char8_t; +# define char8_t gl_char8_t + +#endif + +#if !(defined __cplusplus ? @CXX_HAVE_UCHAR_H@ || @CXX_HAS_UCHAR_TYPES@ : @HAVE_UCHAR_H@) + +/* A 16-bit variant of wchar_t. + Note: This type is only mandated by ISO C 11 or newer. In ISO C 23 + and newer, it denotes UTF-16 units; in older versions of ISO C it did + so only on platforms on which __STDC_UTF_16__ was defined. */ +typedef uint_least16_t char16_t; + +#elif @GNULIBHEADERS_OVERRIDE_CHAR16_T@ + +typedef uint_least16_t gl_char16_t; +# define char16_t gl_char16_t + +#endif + +#if !(defined __cplusplus ? @CXX_HAVE_UCHAR_H@ || @CXX_HAS_UCHAR_TYPES@ : @HAVE_UCHAR_H@) + +/* A 32-bit variant of wchar_t. + Note: This type is only mandated by ISO C 11 or newer. In ISO C 23 + and newer, it denotes UTF-32 code points; in older versions of ISO C + it did so only on platforms on which __STDC_UTF_32__ was defined. + In gnulib, we guarantee that it denotes UTF-32 code points if and + only if the module 'uchar-h-c23' is in use. */ +typedef uint_least32_t char32_t; + +#elif @GNULIBHEADERS_OVERRIDE_CHAR32_T@ + +typedef uint_least32_t gl_char32_t; +# define char32_t gl_char32_t + +#endif + +/* Define if a 'char32_t' can hold more characters than a 'wchar_t'. */ +#if @SMALL_WCHAR_T@ /* 32-bit AIX, Cygwin, native Windows */ +# define _GL_SMALL_WCHAR_T 1 +#endif + +/* Define if 'wchar_t', like 'char32_t', + - is a 32-bit type, and + - represents Unicode code points. + For this test, we can use __STDC_ISO_10646__ (defined by glibc, musl libc, + Cygwin) but need to consider _GL_SMALL_WCHAR_T, so as to exclude Cygwin. + We cannot use __STDC_UTF_16__ or __STDC_UTF_32__ + - because these macros provide info about char16_t and char32_t (not + wchar_t!), and + - because GCC >= 4.9 defines these macros on all platforms, even on + FreeBSD and Solaris. + We should better not use __STD_UTF_16__, __STD_UTF_32__ either, because + these macros are misspellings, only defined by Android's . */ +#if defined __STDC_ISO_10646__ && !_GL_SMALL_WCHAR_T +/* glibc, musl libc */ +# define _GL_WCHAR_T_IS_UCS4 1 +#endif +#if _GL_WCHAR_T_IS_UCS4 +static_assert (sizeof (char32_t) == sizeof (wchar_t)); +#endif + + +/* Convert a single-byte character to a 32-bit wide character. */ +#if @GNULIB_BTOC32@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_BTOC32 +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ATTRIBUTE_PURE wint_t +btoc32 (int c) +{ + return +# if @GNULIB_BTOWC@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + btowc (c); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (btoc32, wint_t, (int c), _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (btoc32, wint_t, (int c)); +_GL_CXXALIASWARN (btoc32); +#endif + + +/* Test a specific property of a 32-bit wide character. */ +#if @GNULIB_C32ISALNUM@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALNUM +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isalnum (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswalnum (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isalnum, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isalnum, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isalnum); +#endif +#if @GNULIB_C32ISALPHA@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALPHA +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isalpha (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswalpha (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isalpha, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isalpha, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isalpha); +#endif +#if @GNULIB_C32ISBLANK@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISBLANK +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isblank (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswblank (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isblank, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isblank, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isblank); +#endif +#if @GNULIB_C32ISCNTRL@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISCNTRL +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32iscntrl (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswcntrl (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32iscntrl, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32iscntrl, int, (wint_t wc)); +_GL_CXXALIASWARN (c32iscntrl); +#endif +#if @GNULIB_C32ISDIGIT@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISDIGIT +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isdigit (wint_t wc) +{ + return +# if @GNULIB_ISWDIGIT@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswdigit (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isdigit, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isdigit, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isdigit); +#endif +#if @GNULIB_C32ISGRAPH@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISGRAPH +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isgraph (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswgraph (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isgraph, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isgraph, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isgraph); +#endif +#if @GNULIB_C32ISLOWER@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISLOWER +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32islower (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswlower (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32islower, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32islower, int, (wint_t wc)); +_GL_CXXALIASWARN (c32islower); +#endif +#if @GNULIB_C32ISPRINT@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPRINT +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isprint (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswprint (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isprint, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isprint, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isprint); +#endif +#if @GNULIB_C32ISPUNCT@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPUNCT +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32ispunct (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswpunct (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32ispunct, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32ispunct, int, (wint_t wc)); +_GL_CXXALIASWARN (c32ispunct); +#endif +#if @GNULIB_C32ISSPACE@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISSPACE +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isspace (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswspace (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isspace, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isspace, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isspace); +#endif +#if @GNULIB_C32ISUPPER@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISUPPER +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isupper (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswupper (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isupper, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isupper, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isupper); +#endif +#if @GNULIB_C32ISXDIGIT@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISXDIGIT +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32isxdigit (wint_t wc) +{ + return +# if @GNULIB_ISWXDIGIT@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswxdigit (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32isxdigit, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32isxdigit, int, (wint_t wc)); +_GL_CXXALIASWARN (c32isxdigit); +#endif + + +/* Case mapping of a 32-bit wide character. */ +#if @GNULIB_C32TOLOWER@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOLOWER +_GL_BEGIN_C_LINKAGE +_GL_INLINE wint_t +c32tolower (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + towlower (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32tolower, wint_t, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32tolower, wint_t, (wint_t wc)); +_GL_CXXALIASWARN (c32tolower); +#endif +#if @GNULIB_C32TOUPPER@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOUPPER +_GL_BEGIN_C_LINKAGE +_GL_INLINE wint_t +c32toupper (wint_t wc) +{ + return +# if defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + towupper (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32toupper, wint_t, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32toupper, wint_t, (wint_t wc)); +_GL_CXXALIASWARN (c32toupper); +#endif + + +/* Number of screen columns needed for a 32-bit wide character. */ +#if @GNULIB_C32WIDTH@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32WIDTH +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32width (char32_t wc) +{ + return +# if @GNULIB_WCWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcwidth (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32width, int, (char32_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32width, int, (char32_t wc)); +_GL_CXXALIASWARN (c32width); +#endif + + +/* Converts a 32-bit wide character to a multibyte character. */ +#if @GNULIB_C32RTOMB@ +# if @REPLACE_C32RTOMB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef c32rtomb +# define c32rtomb rpl_c32rtomb +# endif +_GL_FUNCDECL_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), ); +_GL_CXXALIAS_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps)); +# else +# if !@HAVE_C32RTOMB@ +_GL_FUNCDECL_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), ); +# endif +_GL_CXXALIAS_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps)); +# endif +# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 +_GL_CXXALIASWARN (c32rtomb); +# endif +#elif defined GNULIB_POSIXCHECK +# undef c32rtomb +# if HAVE_RAW_DECL_C32RTOMB +_GL_WARN_ON_USE (c32rtomb, "c32rtomb is not portable - " + "use gnulib module c32rtomb for portability"); +# endif +#endif + + +/* Convert a 32-bit wide string to a string. */ +#if @GNULIB_C32SNRTOMBS@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SNRTOMBS +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len, + mbstate_t *ps) +{ + return +# if @GNULIB_WCSNRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32snrtombs, size_t, + (char *dest, const char32_t **srcp, size_t srclen, size_t len, + mbstate_t *ps), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32snrtombs, size_t, + (char *dest, const char32_t **srcp, size_t srclen, size_t len, + mbstate_t *ps)); +_GL_CXXALIASWARN (c32snrtombs); +#endif + + +/* Convert a 32-bit wide string to a string. */ +#if @GNULIB_C32SRTOMBS@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SRTOMBS +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps) +{ + return +# if @GNULIB_WCSRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcsrtombs (dest, (const wchar_t **) srcp, len, ps); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32srtombs, size_t, + (char *dest, const char32_t **srcp, size_t len, + mbstate_t *ps), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32srtombs, size_t, + (char *dest, const char32_t **srcp, size_t len, + mbstate_t *ps)); +_GL_CXXALIASWARN (c32srtombs); +#endif + + +/* Convert a 32-bit wide string to a string. */ +#if @GNULIB_C32STOMBS@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32STOMBS +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +c32stombs (char *dest, const char32_t *src, size_t len) +{ + mbstate_t state; + + mbszero (&state); + return c32srtombs (dest, &src, len, &state); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32stombs, size_t, + (char *dest, const char32_t *src, size_t len), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32stombs, size_t, + (char *dest, const char32_t *src, size_t len)); +_GL_CXXALIASWARN (c32stombs); +#endif + + +/* Number of screen columns needed for a size-bounded 32-bit wide string. */ +#if @GNULIB_C32SWIDTH@ +# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32SWIDTH +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((1)) int +c32swidth (const char32_t *s, size_t n) +{ + return +# if @GNULIB_WCSWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wcswidth ((const wchar_t *) s, n); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (c32swidth, int, (const char32_t *s, size_t n)); +_GL_CXXALIASWARN (c32swidth); +#endif + + +/* Converts a 32-bit wide character to unibyte character. + Returns the single-byte representation of WC if it exists, + or EOF otherwise. */ +#if @GNULIB_C32TOB@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32TOB +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32tob (wint_t wc) +{ + return +# if @GNULIB_WCTOB@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wctob (wc); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32tob, int, (wint_t wc), ); +# endif +_GL_CXXALIAS_SYS (c32tob, int, (wint_t wc)); +_GL_CXXALIASWARN (c32tob); +#endif + + +/* Converts a multibyte character to a 32-bit wide character. */ +#if @GNULIB_MBRTOC32@ +# if @REPLACE_MBRTOC32@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbrtoc32 +# define mbrtoc32 rpl_mbrtoc32 +# endif +_GL_FUNCDECL_RPL (mbrtoc32, size_t, + (char32_t *pc, const char *s, size_t n, mbstate_t *ps), ); +_GL_CXXALIAS_RPL (mbrtoc32, size_t, + (char32_t *pc, const char *s, size_t n, mbstate_t *ps)); +# else +# if !@HAVE_MBRTOC32@ +_GL_FUNCDECL_SYS (mbrtoc32, size_t, + (char32_t *pc, const char *s, size_t n, mbstate_t *ps), ); +# endif +_GL_CXXALIAS_SYS (mbrtoc32, size_t, + (char32_t *pc, const char *s, size_t n, mbstate_t *ps)); +# endif +# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 +_GL_CXXALIASWARN (mbrtoc32); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbrtoc32 +# if HAVE_RAW_DECL_MBRTOC32 +_GL_WARN_ON_USE (mbrtoc32, "mbrtoc32 is not portable - " + "use gnulib module mbrtoc32 for portability"); +# endif +#endif + + +/* Converts a multibyte character and returns the next 16-bit wide + character. */ +#if @GNULIB_MBRTOC16@ +# if @REPLACE_MBRTOC16@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbrtoc16 +# define mbrtoc16 rpl_mbrtoc16 +# endif +_GL_FUNCDECL_RPL (mbrtoc16, size_t, + (char16_t *pc, const char *s, size_t n, mbstate_t *ps), ); +_GL_CXXALIAS_RPL (mbrtoc16, size_t, + (char16_t *pc, const char *s, size_t n, mbstate_t *ps)); +# else +# if !@HAVE_MBRTOC16@ +_GL_FUNCDECL_SYS (mbrtoc16, size_t, + (char16_t *pc, const char *s, size_t n, mbstate_t *ps), ); +# endif +_GL_CXXALIAS_SYS (mbrtoc16, size_t, + (char16_t *pc, const char *s, size_t n, mbstate_t *ps)); +# endif +# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 +_GL_CXXALIASWARN (mbrtoc16); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbrtoc16 +# if HAVE_RAW_DECL_MBRTOC16 +_GL_WARN_ON_USE (mbrtoc16, "mbrtoc16 is not portable - " + "use gnulib module mbrtoc16 for portability"); +# endif +#endif + + +/* Convert a string to a 32-bit wide string. */ +#if @GNULIB_MBSNRTOC32S@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSNRTOC32S +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps) +{ + return +# if @GNULIB_MBSNRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (mbsnrtoc32s, size_t, + (char32_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mbsnrtoc32s, size_t, + (char32_t *dest, const char **srcp, size_t srclen, size_t len, + mbstate_t *ps)); +_GL_CXXALIASWARN (mbsnrtoc32s); +#endif + + +/* Convert a string to a 32-bit wide string. */ +#if @GNULIB_MBSRTOC32S@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSRTOC32S +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps) +{ + return +# if @GNULIB_MBSRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + mbsrtowcs ((wchar_t *) dest, srcp, len, ps); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (mbsrtoc32s, size_t, + (char32_t *dest, const char **srcp, size_t len, + mbstate_t *ps), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mbsrtoc32s, size_t, + (char32_t *dest, const char **srcp, size_t len, + mbstate_t *ps)); +_GL_CXXALIASWARN (mbsrtoc32s); +#endif + + +/* Convert a string to a 32-bit wide string. */ +#if @GNULIB_MBSTOC32S@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSTOC32S +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) size_t +mbstoc32s (char32_t *dest, const char *src, size_t len) +{ + mbstate_t state; + + mbszero (&state); + return mbsrtoc32s (dest, &src, len, &state); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (mbstoc32s, size_t, + (char32_t *dest, const char *src, size_t len), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mbstoc32s, size_t, + (char32_t *dest, const char *src, size_t len)); +_GL_CXXALIASWARN (mbstoc32s); +#endif + + +#if @GNULIB_C32_GET_TYPE_TEST@ || @GNULIB_C32_APPLY_TYPE_TEST@ +/* A scalar type. Instances of this type, other than (c32_type_test_t) 0, + represent a character property, sometimes also viewed as a "character class". + It can be applied to 32-bit wide characters. It is the counterpart of + type 'wctype_t' for wide characters. + To test whether a given character has a certain property, use the function + 'c32_apply_type_test'. */ +# if _GL_WCHAR_T_IS_UCS4 +typedef wctype_t c32_type_test_t; +# else +typedef /*bool*/int (*c32_type_test_t) (wint_t wc); +# endif +#endif + +/* Return a character property with the given name, or (c32_type_test_t) 0 + if the designated property does not exist. + This function is the counterpart of function 'wctype' for wide characters. + */ +#if @GNULIB_C32_GET_TYPE_TEST@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_TYPE_TEST +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t +c32_get_type_test (const char *name) +{ + return +# if @GNULIB_WCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wctype (name); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name)); +_GL_CXXALIASWARN (c32_get_type_test); +#endif + +/* Test whether a given 32-bit wide character has the specified character + property. + Return non-zero if true, zero if false or if the argument is WEOF. + This function is the counterpart of function 'iswctype' for wide characters. + */ +#if @GNULIB_C32_APPLY_TYPE_TEST@ +# if _GL_WCHAR_T_IS_UCS4 +# if !defined IN_C32_APPLY_TYPE_TEST +_GL_BEGIN_C_LINKAGE +_GL_INLINE int +c32_apply_type_test (wint_t wc, c32_type_test_t property) +{ + return +# if @GNULIB_ISWCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + iswctype (wc, property); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32_apply_type_test, int, + (wint_t wc, c32_type_test_t property), ); +# endif +# else +_GL_FUNCDECL_SYS (c32_apply_type_test, int, + (wint_t wc, c32_type_test_t property), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32_apply_type_test, int, + (wint_t wc, c32_type_test_t property)); +_GL_CXXALIASWARN (c32_apply_type_test); +#endif + + +#if @GNULIB_C32_GET_MAPPING@ || @GNULIB_C32_APPLY_MAPPING@ +/* A scalar type. Instances of this type, other than (c32_mapping_t) 0, + represent a character mapping. It can be applied to 32-bit wide characters. + It is the counterpart of type 'wctrans_t' for wide characters. + To apply a certain mapping to a given character, use the function + 'c32_apply_mapping'. */ +# if _GL_WCHAR_T_IS_UCS4 +typedef wctrans_t c32_mapping_t; +# else +typedef wint_t (*c32_mapping_t) (wint_t wc); +# endif +#endif + +/* Return a character mapping with the given name, or (c32_mapping_t) 0 + if the designated mapping does not exist. + This function is the counterpart of function 'wctrans' for wide characters. + */ +#if @GNULIB_C32_GET_MAPPING@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_MAPPING +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((1)) c32_mapping_t +c32_get_mapping (const char *name) +{ + return +# if @GNULIB_WCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + wctrans (name); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name), + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (c32_get_mapping, c32_mapping_t, (const char *name)); +_GL_CXXALIASWARN (c32_get_mapping); +#endif + +/* Apply the specified character mapping to a given 32-bit wide character. + Return the result of this mapping. Return the WC argument unchanged if it is + WEOF. + This function is the counterpart of function 'towctrans' for wide characters. + */ +#if @GNULIB_C32_APPLY_MAPPING@ +# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_APPLY_MAPPING +_GL_BEGIN_C_LINKAGE +_GL_INLINE _GL_ARG_NONNULL ((2)) wint_t +c32_apply_mapping (wint_t wc, c32_mapping_t mapping) +{ + return +# if @GNULIB_TOWCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE + GNULIB_NAMESPACE:: +# endif + towctrans (wc, mapping); +} +_GL_END_C_LINKAGE +# else +_GL_FUNCDECL_SYS (c32_apply_mapping, wint_t, + (wint_t wc, c32_mapping_t mapping), + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (c32_apply_mapping, wint_t, + (wint_t wc, c32_mapping_t mapping)); +_GL_CXXALIASWARN (c32_apply_mapping); +#endif + + +_GL_INLINE_HEADER_END + +#endif /* _@GUARD_PREFIX@_UCHAR_H */ +#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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Unicode character case mappings. + Copyright (C) 2002, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNICASE_H +#define _UNICASE_H + +#include "unitypes.h" + +/* Get bool. */ +#include + +/* Get size_t. */ +#include + +/* Get uninorm_t. */ +#include "uninorm.h" + +#if 0 +# include +#else +# define LIBUNISTRING_DLL_VARIABLE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* ========================================================================= */ + +/* Character case mappings. + These mappings are locale and context independent. + WARNING! These functions are not sufficient for languages such as German. + Better use the functions below that treat an entire string at once and are + language aware. */ + +/* Return the uppercase mapping of a Unicode character. */ +extern ucs4_t + uc_toupper (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the lowercase mapping of a Unicode character. */ +extern ucs4_t + uc_tolower (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the titlecase mapping of a Unicode character. */ +extern ucs4_t + uc_totitle (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* String case mappings. */ + +/* These functions are locale dependent. The iso639_language argument + identifies the language (e.g. "tr" for Turkish). NULL means to use + locale independent case mappings. */ + +/* Return the ISO 639 language code of the current locale. + Return "" if it is unknown, or in the "C" locale. */ +extern const char * + uc_locale_language (void) + _UC_ATTRIBUTE_PURE; + +/* Conventions: + + All functions prefixed with u8_ operate on UTF-8 encoded strings. + Their unit is an uint8_t (1 byte). + + All functions prefixed with u16_ operate on UTF-16 encoded strings. + Their unit is an uint16_t (a 2-byte word). + + All functions prefixed with u32_ operate on UCS-4 encoded strings. + Their unit is an uint32_t (a 4-byte word). + + All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly + n units. + + Functions returning a string result take a (resultbuf, lengthp) argument + pair. If resultbuf is not NULL and the result fits into *lengthp units, + it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly + allocated string is returned. In both cases, *lengthp is set to the + length (number of units) of the returned string. In case of error, + NULL is returned and errno is set. */ + +/* Return the uppercase mapping of a string. + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. */ +extern uint8_t * + u8_toupper (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_toupper (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_toupper (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the lowercase mapping of a string. + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. */ +extern uint8_t * + u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_tolower (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_tolower (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the titlecase mapping of a string. + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. */ +extern uint8_t * + u8_totitle (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_totitle (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_totitle (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* The case-mapping context given by a prefix string. */ +typedef struct casing_prefix_context + { + /* These fields are private, undocumented. */ + uint32_t last_char_except_ignorable; + uint32_t last_char_normal_or_above; + } + casing_prefix_context_t; +/* The case-mapping context of the empty prefix string. */ +extern LIBUNISTRING_DLL_VARIABLE const casing_prefix_context_t unicase_empty_prefix_context; +/* Return the case-mapping context of a given prefix string. */ +extern casing_prefix_context_t + u8_casing_prefix_context (const uint8_t *s, size_t n); +extern casing_prefix_context_t + u16_casing_prefix_context (const uint16_t *s, size_t n); +extern casing_prefix_context_t + u32_casing_prefix_context (const uint32_t *s, size_t n); +/* Return the case-mapping context of the prefix concat(A, S), given the + case-mapping context of the prefix A. */ +extern casing_prefix_context_t + u8_casing_prefixes_context (const uint8_t *s, size_t n, + casing_prefix_context_t a_context); +extern casing_prefix_context_t + u16_casing_prefixes_context (const uint16_t *s, size_t n, + casing_prefix_context_t a_context); +extern casing_prefix_context_t + u32_casing_prefixes_context (const uint32_t *s, size_t n, + casing_prefix_context_t a_context); + +/* The case-mapping context given by a suffix string. */ +typedef struct casing_suffix_context + { + /* These fields are private, undocumented. */ + uint32_t first_char_except_ignorable; + uint32_t bits; + } + casing_suffix_context_t; +/* The case-mapping context of the empty suffix string. */ +extern LIBUNISTRING_DLL_VARIABLE const casing_suffix_context_t unicase_empty_suffix_context; +/* Return the case-mapping context of a given suffix string. */ +extern casing_suffix_context_t + u8_casing_suffix_context (const uint8_t *s, size_t n); +extern casing_suffix_context_t + u16_casing_suffix_context (const uint16_t *s, size_t n); +extern casing_suffix_context_t + u32_casing_suffix_context (const uint32_t *s, size_t n); +/* Return the case-mapping context of the suffix concat(S, A), given the + case-mapping context of the suffix A. */ +extern casing_suffix_context_t + u8_casing_suffixes_context (const uint8_t *s, size_t n, + casing_suffix_context_t a_context); +extern casing_suffix_context_t + u16_casing_suffixes_context (const uint16_t *s, size_t n, + casing_suffix_context_t a_context); +extern casing_suffix_context_t + u32_casing_suffixes_context (const uint32_t *s, size_t n, + casing_suffix_context_t a_context); + +/* Return the uppercase mapping of a string that is surrounded by a prefix + and a suffix. */ +extern uint8_t * + u8_ct_toupper (const uint8_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_ct_toupper (const uint16_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_ct_toupper (const uint32_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the lowercase mapping of a string that is surrounded by a prefix + and a suffix. */ +extern uint8_t * + u8_ct_tolower (const uint8_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_ct_tolower (const uint16_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_ct_tolower (const uint32_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the titlecase mapping of a string that is surrounded by a prefix + and a suffix. */ +extern uint8_t * + u8_ct_totitle (const uint8_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_ct_totitle (const uint16_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_ct_totitle (const uint32_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the case folded string. + Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equivalent + to comparing S1 and S2 with uN_casecmp(). + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. */ +extern uint8_t * + u8_casefold (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_casefold (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_casefold (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); +/* Likewise, for a string that is surrounded by a prefix and a suffix. */ +extern uint8_t * + u8_ct_casefold (const uint8_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_ct_casefold (const uint16_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_ct_casefold (const uint32_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Compare S1 and S2, ignoring differences in case and normalization. + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. + If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and + return 0. Upon failure, return -1 with errno set. */ +extern int + u8_casecmp (const uint8_t *s1, size_t n1, + const uint8_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + u16_casecmp (const uint16_t *s1, size_t n1, + const uint16_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + u32_casecmp (const uint32_t *s1, size_t n1, + const uint32_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + ulc_casecmp (const char *s1, size_t n1, + const char *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); + +/* Convert the string S of length N to a NUL-terminated byte sequence, in such + a way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with the gnulib + function memcmp2() is equivalent to comparing S1 and S2 with uN_casecoll(). + NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalization. */ +extern char * + u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + char *_UC_RESTRICT resultbuf, size_t *lengthp); +extern char * + u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + char *_UC_RESTRICT resultbuf, size_t *lengthp); +extern char * + u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + char *_UC_RESTRICT resultbuf, size_t *lengthp); +extern char * + ulc_casexfrm (const char *s, size_t n, const char *iso639_language, + uninorm_t nf, + char *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Compare S1 and S2, ignoring differences in case and normalization, using the + collation rules of the current locale. + The nf argument identifies the normalization form to apply after the + case-mapping. It must be either UNINORM_NFC or UNINORM_NFKC. It can also + be NULL, for no normalization. + If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and + return 0. Upon failure, return -1 with errno set. */ +extern int + u8_casecoll (const uint8_t *s1, size_t n1, + const uint8_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + u16_casecoll (const uint16_t *s1, size_t n1, + const uint16_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + u32_casecoll (const uint32_t *s1, size_t n1, + const uint32_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + ulc_casecoll (const char *s1, size_t n1, + const char *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); + + +/* Set *RESULTP to true if mapping NFD(S) to upper case is a no-op, or to false + otherwise, and return 0. Upon failure, return -1 with errno set. */ +extern int + u8_is_uppercase (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_uppercase (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_uppercase (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + +/* Set *RESULTP to true if mapping NFD(S) to lower case is a no-op, or to false + otherwise, and return 0. Upon failure, return -1 with errno set. */ +extern int + u8_is_lowercase (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_lowercase (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_lowercase (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + +/* Set *RESULTP to true if mapping NFD(S) to title case is a no-op, or to false + otherwise, and return 0. Upon failure, return -1 with errno set. */ +extern int + u8_is_titlecase (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_titlecase (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_titlecase (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + +/* Set *RESULTP to true if applying case folding to NFD(S) is a no-op, or to + false otherwise, and return 0. Upon failure, return -1 with errno set. */ +extern int + u8_is_casefolded (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_casefolded (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_casefolded (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + +/* Set *RESULTP to true if case matters for S, that is, if mapping NFD(S) to + either upper case or lower case or title case is not a no-op. + Set *RESULTP to false if NFD(S) maps to itself under the upper case mapping, + under the lower case mapping, and under the title case mapping; in other + words, when NFD(S) consists entirely of caseless characters. + Upon failure, return -1 with errno set. */ +extern int + u8_is_cased (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_cased (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_cased (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + + +/* ========================================================================= */ + +#ifdef __cplusplus +} +#endif + +#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 @@ +/* Unicode character case mappings. + Copyright (C) 2002, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNICASE_H +#define _UNICASE_H + +#include "unitypes.h" + +/* Get bool. */ +#include + +/* Get size_t. */ +#include + +/* Get uninorm_t. */ +#include "uninorm.h" + +#if @HAVE_UNISTRING_WOE32DLL_H@ +# include +#else +# define LIBUNISTRING_DLL_VARIABLE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* ========================================================================= */ + +/* Character case mappings. + These mappings are locale and context independent. + WARNING! These functions are not sufficient for languages such as German. + Better use the functions below that treat an entire string at once and are + language aware. */ + +/* Return the uppercase mapping of a Unicode character. */ +extern ucs4_t + uc_toupper (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the lowercase mapping of a Unicode character. */ +extern ucs4_t + uc_tolower (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the titlecase mapping of a Unicode character. */ +extern ucs4_t + uc_totitle (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* String case mappings. */ + +/* These functions are locale dependent. The iso639_language argument + identifies the language (e.g. "tr" for Turkish). NULL means to use + locale independent case mappings. */ + +/* Return the ISO 639 language code of the current locale. + Return "" if it is unknown, or in the "C" locale. */ +extern const char * + uc_locale_language (void) + _UC_ATTRIBUTE_PURE; + +/* Conventions: + + All functions prefixed with u8_ operate on UTF-8 encoded strings. + Their unit is an uint8_t (1 byte). + + All functions prefixed with u16_ operate on UTF-16 encoded strings. + Their unit is an uint16_t (a 2-byte word). + + All functions prefixed with u32_ operate on UCS-4 encoded strings. + Their unit is an uint32_t (a 4-byte word). + + All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly + n units. + + Functions returning a string result take a (resultbuf, lengthp) argument + pair. If resultbuf is not NULL and the result fits into *lengthp units, + it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly + allocated string is returned. In both cases, *lengthp is set to the + length (number of units) of the returned string. In case of error, + NULL is returned and errno is set. */ + +/* Return the uppercase mapping of a string. + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. */ +extern uint8_t * + u8_toupper (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_toupper (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_toupper (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the lowercase mapping of a string. + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. */ +extern uint8_t * + u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_tolower (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_tolower (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the titlecase mapping of a string. + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. */ +extern uint8_t * + u8_totitle (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_totitle (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_totitle (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* The case-mapping context given by a prefix string. */ +typedef struct casing_prefix_context + { + /* These fields are private, undocumented. */ + uint32_t last_char_except_ignorable; + uint32_t last_char_normal_or_above; + } + casing_prefix_context_t; +/* The case-mapping context of the empty prefix string. */ +extern @GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE@ const casing_prefix_context_t unicase_empty_prefix_context; +/* Return the case-mapping context of a given prefix string. */ +extern casing_prefix_context_t + u8_casing_prefix_context (const uint8_t *s, size_t n); +extern casing_prefix_context_t + u16_casing_prefix_context (const uint16_t *s, size_t n); +extern casing_prefix_context_t + u32_casing_prefix_context (const uint32_t *s, size_t n); +/* Return the case-mapping context of the prefix concat(A, S), given the + case-mapping context of the prefix A. */ +extern casing_prefix_context_t + u8_casing_prefixes_context (const uint8_t *s, size_t n, + casing_prefix_context_t a_context); +extern casing_prefix_context_t + u16_casing_prefixes_context (const uint16_t *s, size_t n, + casing_prefix_context_t a_context); +extern casing_prefix_context_t + u32_casing_prefixes_context (const uint32_t *s, size_t n, + casing_prefix_context_t a_context); + +/* The case-mapping context given by a suffix string. */ +typedef struct casing_suffix_context + { + /* These fields are private, undocumented. */ + uint32_t first_char_except_ignorable; + uint32_t bits; + } + casing_suffix_context_t; +/* The case-mapping context of the empty suffix string. */ +extern @GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE@ const casing_suffix_context_t unicase_empty_suffix_context; +/* Return the case-mapping context of a given suffix string. */ +extern casing_suffix_context_t + u8_casing_suffix_context (const uint8_t *s, size_t n); +extern casing_suffix_context_t + u16_casing_suffix_context (const uint16_t *s, size_t n); +extern casing_suffix_context_t + u32_casing_suffix_context (const uint32_t *s, size_t n); +/* Return the case-mapping context of the suffix concat(S, A), given the + case-mapping context of the suffix A. */ +extern casing_suffix_context_t + u8_casing_suffixes_context (const uint8_t *s, size_t n, + casing_suffix_context_t a_context); +extern casing_suffix_context_t + u16_casing_suffixes_context (const uint16_t *s, size_t n, + casing_suffix_context_t a_context); +extern casing_suffix_context_t + u32_casing_suffixes_context (const uint32_t *s, size_t n, + casing_suffix_context_t a_context); + +/* Return the uppercase mapping of a string that is surrounded by a prefix + and a suffix. */ +extern uint8_t * + u8_ct_toupper (const uint8_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_ct_toupper (const uint16_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_ct_toupper (const uint32_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the lowercase mapping of a string that is surrounded by a prefix + and a suffix. */ +extern uint8_t * + u8_ct_tolower (const uint8_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_ct_tolower (const uint16_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_ct_tolower (const uint32_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the titlecase mapping of a string that is surrounded by a prefix + and a suffix. */ +extern uint8_t * + u8_ct_totitle (const uint8_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_ct_totitle (const uint16_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_ct_totitle (const uint32_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Return the case folded string. + Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equivalent + to comparing S1 and S2 with uN_casecmp(). + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. */ +extern uint8_t * + u8_casefold (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_casefold (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_casefold (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); +/* Likewise, for a string that is surrounded by a prefix and a suffix. */ +extern uint8_t * + u8_ct_casefold (const uint8_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_ct_casefold (const uint16_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_ct_casefold (const uint32_t *s, size_t n, + casing_prefix_context_t prefix_context, + casing_suffix_context_t suffix_context, + const char *iso639_language, + uninorm_t nf, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Compare S1 and S2, ignoring differences in case and normalization. + The nf argument identifies the normalization form to apply after the + case-mapping. It can also be NULL, for no normalization. + If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and + return 0. Upon failure, return -1 with errno set. */ +extern int + u8_casecmp (const uint8_t *s1, size_t n1, + const uint8_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + u16_casecmp (const uint16_t *s1, size_t n1, + const uint16_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + u32_casecmp (const uint32_t *s1, size_t n1, + const uint32_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + ulc_casecmp (const char *s1, size_t n1, + const char *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); + +/* Convert the string S of length N to a NUL-terminated byte sequence, in such + a way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with the gnulib + function memcmp2() is equivalent to comparing S1 and S2 with uN_casecoll(). + NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalization. */ +extern char * + u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + char *_UC_RESTRICT resultbuf, size_t *lengthp); +extern char * + u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + char *_UC_RESTRICT resultbuf, size_t *lengthp); +extern char * + u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_language, + uninorm_t nf, + char *_UC_RESTRICT resultbuf, size_t *lengthp); +extern char * + ulc_casexfrm (const char *s, size_t n, const char *iso639_language, + uninorm_t nf, + char *_UC_RESTRICT resultbuf, size_t *lengthp); + +/* Compare S1 and S2, ignoring differences in case and normalization, using the + collation rules of the current locale. + The nf argument identifies the normalization form to apply after the + case-mapping. It must be either UNINORM_NFC or UNINORM_NFKC. It can also + be NULL, for no normalization. + If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and + return 0. Upon failure, return -1 with errno set. */ +extern int + u8_casecoll (const uint8_t *s1, size_t n1, + const uint8_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + u16_casecoll (const uint16_t *s1, size_t n1, + const uint16_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + u32_casecoll (const uint32_t *s1, size_t n1, + const uint32_t *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); +extern int + ulc_casecoll (const char *s1, size_t n1, + const char *s2, size_t n2, + const char *iso639_language, uninorm_t nf, int *resultp); + + +/* Set *RESULTP to true if mapping NFD(S) to upper case is a no-op, or to false + otherwise, and return 0. Upon failure, return -1 with errno set. */ +extern int + u8_is_uppercase (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_uppercase (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_uppercase (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + +/* Set *RESULTP to true if mapping NFD(S) to lower case is a no-op, or to false + otherwise, and return 0. Upon failure, return -1 with errno set. */ +extern int + u8_is_lowercase (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_lowercase (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_lowercase (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + +/* Set *RESULTP to true if mapping NFD(S) to title case is a no-op, or to false + otherwise, and return 0. Upon failure, return -1 with errno set. */ +extern int + u8_is_titlecase (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_titlecase (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_titlecase (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + +/* Set *RESULTP to true if applying case folding to NFD(S) is a no-op, or to + false otherwise, and return 0. Upon failure, return -1 with errno set. */ +extern int + u8_is_casefolded (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_casefolded (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_casefolded (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + +/* Set *RESULTP to true if case matters for S, that is, if mapping NFD(S) to + either upper case or lower case or title case is not a no-op. + Set *RESULTP to false if NFD(S) maps to itself under the upper case mapping, + under the lower case mapping, and under the title case mapping; in other + words, when NFD(S) consists entirely of caseless characters. + Upon failure, return -1 with errno set. */ +extern int + u8_is_cased (const uint8_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u16_is_cased (const uint16_t *s, size_t n, + const char *iso639_language, + bool *resultp); +extern int + u32_is_cased (const uint32_t *s, size_t n, + const char *iso639_language, + bool *resultp); + + +/* ========================================================================= */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UNICASE_H */ diff --git a/gl/unicase/.deps/.dirstamp b/gl/unicase/.deps/.dirstamp new file mode 100644 index 00000000..e69de29b 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 @@ +unicase/libgnu_a-tolower.o: unicase/tolower.c /usr/include/stdc-predef.h \ + ../config.h unicase.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h uninorm.h \ + unicase/tolower.h unicase/simple-mapping.h +/usr/include/stdc-predef.h: +../config.h: +unicase.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +uninorm.h: +unicase/tolower.h: +unicase/simple-mapping.h: diff --git a/gl/unicase/.dirstamp b/gl/unicase/.dirstamp new file mode 100644 index 00000000..e69de29b 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 @@ +/* Simple case mapping for Unicode characters. + Copyright (C) 2002, 2006, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2009. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +ucs4_t +FUNC (ucs4_t uc) +{ + unsigned int index1 = uc >> mapping_header_0; + if (index1 < mapping_header_1) + { + int lookup1 = u_mapping.level1[index1]; + if (lookup1 >= 0) + { + unsigned int index2 = (uc >> mapping_header_2) & mapping_header_3; + int lookup2 = u_mapping.level2[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc & mapping_header_4); + int lookup3 = u_mapping.level3[lookup2 + index3]; + + return uc + lookup3; + } + } + } + return uc; +} 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 @@ +/* Lowercase mapping for Unicode characters (locale and context independent). + Copyright (C) 2002, 2006, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2009. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unicase.h" + +/* Define u_mapping table. */ +#include "tolower.h" + +#define FUNC uc_tolower +#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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Simple character mapping of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define mapping_header_0 16 +#define mapping_header_1 2 +#define mapping_header_2 7 +#define mapping_header_3 511 +#define mapping_header_4 127 +static const +struct + { + int level1[2]; + short level2[2 << 9]; + int level3[36 << 7]; + } +u_mapping = +{ + { 0, 512 }, + { + 0, 128, 256, 384, 512, -1, 640, 768, + 896, 1024, 1152, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1280, -1, -1, -1, -1, -1, 1408, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1536, -1, -1, 1664, 1792, 1920, 2048, + -1, -1, 2176, 2304, -1, -1, -1, -1, + -1, 2432, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + 2560, 2688, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 2816, 2944, 3072, 3200, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 3328, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + 3456, 3584, 3712, 3840, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, 3968, 4096, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, 4224, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 4352, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 4480, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 0, + 32, 32, 32, 32, 32, 32, 32, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + -199, 0, 1, 0, 1, 0, 1, 0, + 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + -121, 1, 0, 1, 0, 1, 0, 0, + 0, 210, 1, 0, 1, 0, 206, 1, + 0, 205, 205, 1, 0, 0, 79, 202, + 203, 1, 0, 205, 207, 0, 211, 209, + 1, 0, 0, 0, 211, 213, 0, 214, + 1, 0, 1, 0, 1, 0, 218, 1, + 0, 218, 0, 0, 1, 0, 218, 1, + 0, 217, 217, 1, 0, 1, 0, 219, + 1, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 2, 1, 0, 2, + 1, 0, 2, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 0, 2, 1, 0, 1, 0, -97, -56, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + -130, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 10795, 1, 0, -163, 10792, 0, + 0, 1, 0, -195, 69, 71, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 116, + 0, 0, 0, 0, 0, 0, 38, 0, + 37, 37, 37, 0, 64, 0, 63, 63, + 0, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 0, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 0, 0, 0, 0, -60, 0, 0, 1, + 0, -7, 1, 0, 0, -130, -130, -130, + 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 15, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 0, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 7264, 7264, 7264, 7264, 7264, 7264, 7264, 7264, + 7264, 7264, 7264, 7264, 7264, 7264, 7264, 7264, + 7264, 7264, 7264, 7264, 7264, 7264, 7264, 7264, + 7264, 7264, 7264, 7264, 7264, 7264, 7264, 7264, + 7264, 7264, 7264, 7264, 7264, 7264, 0, 7264, + 0, 0, 0, 0, 0, 7264, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864, + 8, 8, 8, 8, 8, 8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008, + -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008, + -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008, + -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008, + -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008, + -3008, -3008, -3008, 0, 0, -3008, -3008, -3008, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -7615, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, -8, -8, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, -8, -8, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, -8, -8, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -8, 0, -8, 0, -8, 0, -8, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, -8, -8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, -8, -8, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, -8, -8, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -8, -8, -8, -8, -8, -8, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -74, -74, -9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -86, -86, -86, -86, -9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -100, -100, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -8, -8, -112, -112, -7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -128, -128, -126, -126, -9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -7517, 0, + 0, 0, -8383, -8262, 0, 0, 0, 0, + 0, 0, 28, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, -10743, -3814, -10727, 0, 0, 1, + 0, 1, 0, 1, 0, -10780, -10749, -10783, + -10782, 0, 1, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, -10815, -10815, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 1, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 0, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 1, 0, -35332, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 0, 0, 0, 1, 0, -42280, 0, 0, + 1, 0, 1, 0, 0, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, -42308, -42319, -42315, -42305, -42308, 0, + -42258, -42282, -42261, 928, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, -48, -42307, -35384, 1, + 0, 1, 0, -42343, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 1, 0, + 1, 0, 1, 0, -42561, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 0, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 0, 39, 39, 39, 39, + 39, 39, 39, 0, 39, 39, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 + } +}; 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Unicode character classification and properties. + Copyright (C) 2002, 2005-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNICTYPE_H +#define _UNICTYPE_H + +#include "unitypes.h" + +/* Get bool. */ +#include + +/* Get size_t. */ +#include + +#if 0 +# include +#else +# define LIBUNISTRING_DLL_VARIABLE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* ========================================================================= */ + +/* Field 1 of Unicode Character Database: Character name. + See "uniname.h". */ + +/* ========================================================================= */ + +/* Field 2 of Unicode Character Database: General category. */ + +/* Data type denoting a General category value. This is not just a bitmask, + but rather a bitmask and a pointer to the lookup table, so that programs + that use only the predefined bitmasks (i.e. don't combine bitmasks with & + and |) don't have a link-time dependency towards the big general table. */ +typedef struct +{ + uint32_t bitmask : 31; + /*bool*/ unsigned int generic : 1; + union + { + const void *table; /* when generic is 0 */ + bool (*lookup_fn) (ucs4_t uc, uint32_t bitmask); /* when generic is 1 */ + } lookup; +} +uc_general_category_t; + +/* Bits and bit masks denoting General category values. UnicodeData-3.2.0.html + says a 32-bit integer will always suffice to represent them. + These bit masks can only be used with the uc_is_general_category_withtable + function. */ +enum +{ + UC_CATEGORY_MASK_L = 0x0000001f, + UC_CATEGORY_MASK_LC = 0x00000007, + UC_CATEGORY_MASK_Lu = 0x00000001, + UC_CATEGORY_MASK_Ll = 0x00000002, + UC_CATEGORY_MASK_Lt = 0x00000004, + UC_CATEGORY_MASK_Lm = 0x00000008, + UC_CATEGORY_MASK_Lo = 0x00000010, + UC_CATEGORY_MASK_M = 0x000000e0, + UC_CATEGORY_MASK_Mn = 0x00000020, + UC_CATEGORY_MASK_Mc = 0x00000040, + UC_CATEGORY_MASK_Me = 0x00000080, + UC_CATEGORY_MASK_N = 0x00000700, + UC_CATEGORY_MASK_Nd = 0x00000100, + UC_CATEGORY_MASK_Nl = 0x00000200, + UC_CATEGORY_MASK_No = 0x00000400, + UC_CATEGORY_MASK_P = 0x0003f800, + UC_CATEGORY_MASK_Pc = 0x00000800, + UC_CATEGORY_MASK_Pd = 0x00001000, + UC_CATEGORY_MASK_Ps = 0x00002000, + UC_CATEGORY_MASK_Pe = 0x00004000, + UC_CATEGORY_MASK_Pi = 0x00008000, + UC_CATEGORY_MASK_Pf = 0x00010000, + UC_CATEGORY_MASK_Po = 0x00020000, + UC_CATEGORY_MASK_S = 0x003c0000, + UC_CATEGORY_MASK_Sm = 0x00040000, + UC_CATEGORY_MASK_Sc = 0x00080000, + UC_CATEGORY_MASK_Sk = 0x00100000, + UC_CATEGORY_MASK_So = 0x00200000, + UC_CATEGORY_MASK_Z = 0x01c00000, + UC_CATEGORY_MASK_Zs = 0x00400000, + UC_CATEGORY_MASK_Zl = 0x00800000, + UC_CATEGORY_MASK_Zp = 0x01000000, + UC_CATEGORY_MASK_C = 0x3e000000, + UC_CATEGORY_MASK_Cc = 0x02000000, + UC_CATEGORY_MASK_Cf = 0x04000000, + UC_CATEGORY_MASK_Cs = 0x08000000, + UC_CATEGORY_MASK_Co = 0x10000000, + UC_CATEGORY_MASK_Cn = 0x20000000 +}; + +/* Predefined General category values. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_L; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_LC; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Lu; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Ll; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Lt; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Lm; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Lo; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_M; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Mn; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Mc; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Me; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_N; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Nd; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Nl; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_No; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_P; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pc; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pd; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Ps; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pe; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pi; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pf; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Po; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_S; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Sm; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Sc; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Sk; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_So; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Z; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Zs; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Zl; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Zp; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_C; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Cc; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Cf; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Cs; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Co; +extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Cn; +/* Non-public. */ +extern const uc_general_category_t _UC_CATEGORY_NONE; + +/* Alias names for predefined General category values. */ +#define UC_LETTER UC_CATEGORY_L +#define UC_CASED_LETTER UC_CATEGORY_LC +#define UC_UPPERCASE_LETTER UC_CATEGORY_Lu +#define UC_LOWERCASE_LETTER UC_CATEGORY_Ll +#define UC_TITLECASE_LETTER UC_CATEGORY_Lt +#define UC_MODIFIER_LETTER UC_CATEGORY_Lm +#define UC_OTHER_LETTER UC_CATEGORY_Lo +#define UC_MARK UC_CATEGORY_M +#define UC_NON_SPACING_MARK UC_CATEGORY_Mn +#define UC_COMBINING_SPACING_MARK UC_CATEGORY_Mc +#define UC_ENCLOSING_MARK UC_CATEGORY_Me +#define UC_NUMBER UC_CATEGORY_N +#define UC_DECIMAL_DIGIT_NUMBER UC_CATEGORY_Nd +#define UC_LETTER_NUMBER UC_CATEGORY_Nl +#define UC_OTHER_NUMBER UC_CATEGORY_No +#define UC_PUNCTUATION UC_CATEGORY_P +#define UC_CONNECTOR_PUNCTUATION UC_CATEGORY_Pc +#define UC_DASH_PUNCTUATION UC_CATEGORY_Pd +#define UC_OPEN_PUNCTUATION UC_CATEGORY_Ps /* a.k.a. UC_START_PUNCTUATION */ +#define UC_CLOSE_PUNCTUATION UC_CATEGORY_Pe /* a.k.a. UC_END_PUNCTUATION */ +#define UC_INITIAL_QUOTE_PUNCTUATION UC_CATEGORY_Pi +#define UC_FINAL_QUOTE_PUNCTUATION UC_CATEGORY_Pf +#define UC_OTHER_PUNCTUATION UC_CATEGORY_Po +#define UC_SYMBOL UC_CATEGORY_S +#define UC_MATH_SYMBOL UC_CATEGORY_Sm +#define UC_CURRENCY_SYMBOL UC_CATEGORY_Sc +#define UC_MODIFIER_SYMBOL UC_CATEGORY_Sk +#define UC_OTHER_SYMBOL UC_CATEGORY_So +#define UC_SEPARATOR UC_CATEGORY_Z +#define UC_SPACE_SEPARATOR UC_CATEGORY_Zs +#define UC_LINE_SEPARATOR UC_CATEGORY_Zl +#define UC_PARAGRAPH_SEPARATOR UC_CATEGORY_Zp +#define UC_OTHER UC_CATEGORY_C +#define UC_CONTROL UC_CATEGORY_Cc +#define UC_FORMAT UC_CATEGORY_Cf +#define UC_SURROGATE UC_CATEGORY_Cs /* all of them are invalid characters */ +#define UC_PRIVATE_USE UC_CATEGORY_Co +#define UC_UNASSIGNED UC_CATEGORY_Cn /* some of them are invalid characters */ + +/* Return the union of two general categories. + This corresponds to the unions of the two sets of characters. */ +extern uc_general_category_t + uc_general_category_or (uc_general_category_t category1, + uc_general_category_t category2); + +/* Return the intersection of two general categories as bit masks. + This *does*not* correspond to the intersection of the two sets of + characters. */ +extern uc_general_category_t + uc_general_category_and (uc_general_category_t category1, + uc_general_category_t category2); + +/* Return the intersection of a general category with the complement of a + second general category, as bit masks. + This *does*not* correspond to the intersection with complement, when + viewing the categories as sets of characters. */ +extern uc_general_category_t + uc_general_category_and_not (uc_general_category_t category1, + uc_general_category_t category2); + +/* Return the name of a general category. */ +extern const char * + uc_general_category_name (uc_general_category_t category) + _UC_ATTRIBUTE_PURE; + +/* Return the long name of a general category. */ +extern const char * + uc_general_category_long_name (uc_general_category_t category) + _UC_ATTRIBUTE_PURE; + +/* Return the general category given by name, e.g. "Lu", or by long name, + e.g. "Uppercase Letter". */ +extern uc_general_category_t + uc_general_category_byname (const char *category_name) + _UC_ATTRIBUTE_PURE; + +/* Return the general category of a Unicode character. */ +extern uc_general_category_t + uc_general_category (ucs4_t uc) + _UC_ATTRIBUTE_PURE; + +/* Test whether a Unicode character belongs to a given category. + The CATEGORY argument can be the combination of several predefined + general categories. */ +extern bool + uc_is_general_category (ucs4_t uc, uc_general_category_t category) + _UC_ATTRIBUTE_PURE; +/* Likewise. This function uses a big table comprising all categories. */ +extern bool + uc_is_general_category_withtable (ucs4_t uc, uint32_t bitmask) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 3 of Unicode Character Database: Canonical combining class. */ + +/* The possible results of uc_combining_class (0..255) are described in + UCD.html. The list here is not definitive; more values can be added + in future versions. */ +enum +{ + UC_CCC_NR = 0, /* Not Reordered */ + UC_CCC_OV = 1, /* Overlay */ + UC_CCC_NK = 7, /* Nukta */ + UC_CCC_KV = 8, /* Kana Voicing */ + UC_CCC_VR = 9, /* Virama */ + UC_CCC_ATBL = 200, /* Attached Below Left */ + UC_CCC_ATB = 202, /* Attached Below */ + UC_CCC_ATA = 214, /* Attached Above */ + UC_CCC_ATAR = 216, /* Attached Above Right */ + UC_CCC_BL = 218, /* Below Left */ + UC_CCC_B = 220, /* Below */ + UC_CCC_BR = 222, /* Below Right */ + UC_CCC_L = 224, /* Left */ + UC_CCC_R = 226, /* Right */ + UC_CCC_AL = 228, /* Above Left */ + UC_CCC_A = 230, /* Above */ + UC_CCC_AR = 232, /* Above Right */ + UC_CCC_DB = 233, /* Double Below */ + UC_CCC_DA = 234, /* Double Above */ + UC_CCC_IS = 240 /* Iota Subscript */ +}; + +/* Return the canonical combining class of a Unicode character. */ +extern int + uc_combining_class (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the name of a canonical combining class. */ +extern const char * + uc_combining_class_name (int ccc) + _UC_ATTRIBUTE_CONST; + +/* Return the long name of a canonical combining class. */ +extern const char * + uc_combining_class_long_name (int ccc) + _UC_ATTRIBUTE_CONST; + +/* Return the canonical combining class given by name, e.g. "BL", or by long + name, e.g. "Below Left". */ +extern int + uc_combining_class_byname (const char *ccc_name) + _UC_ATTRIBUTE_PURE; + +/* ========================================================================= */ + +/* Field 4 of Unicode Character Database: Bidi class. + Before Unicode 4.0, this field was called "Bidirectional category". */ + +enum +{ + UC_BIDI_L, /* Left-to-Right */ + UC_BIDI_LRE, /* Left-to-Right Embedding */ + UC_BIDI_LRO, /* Left-to-Right Override */ + UC_BIDI_R, /* Right-to-Left */ + UC_BIDI_AL, /* Right-to-Left Arabic */ + UC_BIDI_RLE, /* Right-to-Left Embedding */ + UC_BIDI_RLO, /* Right-to-Left Override */ + UC_BIDI_PDF, /* Pop Directional Format */ + UC_BIDI_EN, /* European Number */ + UC_BIDI_ES, /* European Number Separator */ + UC_BIDI_ET, /* European Number Terminator */ + UC_BIDI_AN, /* Arabic Number */ + UC_BIDI_CS, /* Common Number Separator */ + UC_BIDI_NSM, /* Non-Spacing Mark */ + UC_BIDI_BN, /* Boundary Neutral */ + UC_BIDI_B, /* Paragraph Separator */ + UC_BIDI_S, /* Segment Separator */ + UC_BIDI_WS, /* Whitespace */ + UC_BIDI_ON, /* Other Neutral */ + UC_BIDI_LRI, /* Left-to-Right Isolate */ + UC_BIDI_RLI, /* Right-to-Left Isolate */ + UC_BIDI_FSI, /* First Strong Isolate */ + UC_BIDI_PDI /* Pop Directional Isolate */ +}; + +/* Return the name of a bidi class. */ +extern const char * + uc_bidi_class_name (int bidi_class) + _UC_ATTRIBUTE_CONST; +/* Same; obsolete function name. */ +extern const char * + uc_bidi_category_name (int category) + _UC_ATTRIBUTE_CONST; + +/* Return the long name of a bidi class. */ +extern const char * + uc_bidi_class_long_name (int bidi_class) + _UC_ATTRIBUTE_CONST; + +/* Return the bidi class given by name, e.g. "LRE", or by long name, e.g. + "Left-to-Right Embedding". */ +extern int + uc_bidi_class_byname (const char *bidi_class_name) + _UC_ATTRIBUTE_PURE; +/* Same; obsolete function name. */ +extern int + uc_bidi_category_byname (const char *category_name) + _UC_ATTRIBUTE_PURE; + +/* Return the bidi class of a Unicode character. */ +extern int + uc_bidi_class (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +/* Same; obsolete function name. */ +extern int + uc_bidi_category (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test whether a Unicode character belongs to a given bidi class. */ +extern bool + uc_is_bidi_class (ucs4_t uc, int bidi_class) + _UC_ATTRIBUTE_CONST; +/* Same; obsolete function name. */ +extern bool + uc_is_bidi_category (ucs4_t uc, int category) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 5 of Unicode Character Database: Character decomposition mapping. + See "uninorm.h". */ + +/* ========================================================================= */ + +/* Field 6 of Unicode Character Database: Decimal digit value. */ + +/* Return the decimal digit value of a Unicode character. */ +extern int + uc_decimal_value (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 7 of Unicode Character Database: Digit value. */ + +/* Return the digit value of a Unicode character. */ +extern int + uc_digit_value (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 8 of Unicode Character Database: Numeric value. */ + +/* Return the numeric value of a Unicode character. */ +typedef struct +{ + int numerator; + int denominator; +} +uc_fraction_t; +extern uc_fraction_t + uc_numeric_value (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 9 of Unicode Character Database: Mirrored. */ + +/* Return the mirrored character of a Unicode character UC in *PUC. */ +extern bool + uc_mirror_char (ucs4_t uc, ucs4_t *puc); + +/* ========================================================================= */ + +/* Field 10 of Unicode Character Database: Unicode 1.0 Name. + Not available in this library. */ + +/* ========================================================================= */ + +/* Field 11 of Unicode Character Database: ISO 10646 comment. + Not available in this library. */ + +/* ========================================================================= */ + +/* Field 12, 13, 14 of Unicode Character Database: Uppercase mapping, + lowercase mapping, titlecase mapping. See "unicase.h". */ + +/* ========================================================================= */ + +/* Field 2 of the file ArabicShaping.txt in the Unicode Character Database. */ + +/* Possible joining types. */ +enum +{ + UC_JOINING_TYPE_U, /* Non_Joining */ + UC_JOINING_TYPE_T, /* Transparent */ + UC_JOINING_TYPE_C, /* Join_Causing */ + UC_JOINING_TYPE_L, /* Left_Joining */ + UC_JOINING_TYPE_R, /* Right_Joining */ + UC_JOINING_TYPE_D /* Dual_Joining */ +}; + +/* Return the name of a joining type. */ +extern const char * + uc_joining_type_name (int joining_type) + _UC_ATTRIBUTE_CONST; + +/* Return the long name of a joining type. */ +extern const char * + uc_joining_type_long_name (int joining_type) + _UC_ATTRIBUTE_CONST; + +/* Return the joining type given by name, e.g. "D", or by long name, e.g. + "Dual Joining". */ +extern int + uc_joining_type_byname (const char *joining_type_name) + _UC_ATTRIBUTE_PURE; + +/* Return the joining type of a Unicode character. */ +extern int + uc_joining_type (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 3 of the file ArabicShaping.txt in the Unicode Character Database. */ + +/* Possible joining groups. + This enumeration may be extended in the future. */ +enum +{ + UC_JOINING_GROUP_NONE, /* No_Joining_Group */ + UC_JOINING_GROUP_AIN, /* Ain */ + UC_JOINING_GROUP_ALAPH, /* Alaph */ + UC_JOINING_GROUP_ALEF, /* Alef */ + UC_JOINING_GROUP_BEH, /* Beh */ + UC_JOINING_GROUP_BETH, /* Beth */ + UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, /* Burushaski_Yeh_Barree */ + UC_JOINING_GROUP_DAL, /* Dal */ + UC_JOINING_GROUP_DALATH_RISH, /* Dalath_Rish */ + UC_JOINING_GROUP_E, /* E */ + UC_JOINING_GROUP_FARSI_YEH, /* Farsi_Yeh */ + UC_JOINING_GROUP_FE, /* Fe */ + UC_JOINING_GROUP_FEH, /* Feh */ + UC_JOINING_GROUP_FINAL_SEMKATH, /* Final_Semkath */ + UC_JOINING_GROUP_GAF, /* Gaf */ + UC_JOINING_GROUP_GAMAL, /* Gamal */ + UC_JOINING_GROUP_HAH, /* Hah */ + UC_JOINING_GROUP_HE, /* He */ + UC_JOINING_GROUP_HEH, /* Heh */ + UC_JOINING_GROUP_HEH_GOAL, /* Heh_Goal */ + UC_JOINING_GROUP_HETH, /* Heth */ + UC_JOINING_GROUP_KAF, /* Kaf */ + UC_JOINING_GROUP_KAPH, /* Kaph */ + UC_JOINING_GROUP_KHAPH, /* Khaph */ + UC_JOINING_GROUP_KNOTTED_HEH, /* Knotted_Heh */ + UC_JOINING_GROUP_LAM, /* Lam */ + UC_JOINING_GROUP_LAMADH, /* Lamadh */ + UC_JOINING_GROUP_MEEM, /* Meem */ + UC_JOINING_GROUP_MIM, /* Mim */ + UC_JOINING_GROUP_NOON, /* Noon */ + UC_JOINING_GROUP_NUN, /* Nun */ + UC_JOINING_GROUP_NYA, /* Nya */ + UC_JOINING_GROUP_PE, /* Pe */ + UC_JOINING_GROUP_QAF, /* Qaf */ + UC_JOINING_GROUP_QAPH, /* Qaph */ + UC_JOINING_GROUP_REH, /* Reh */ + UC_JOINING_GROUP_REVERSED_PE, /* Reversed_Pe */ + UC_JOINING_GROUP_SAD, /* Sad */ + UC_JOINING_GROUP_SADHE, /* Sadhe */ + UC_JOINING_GROUP_SEEN, /* Seen */ + UC_JOINING_GROUP_SEMKATH, /* Semkath */ + UC_JOINING_GROUP_SHIN, /* Shin */ + UC_JOINING_GROUP_SWASH_KAF, /* Swash_Kaf */ + UC_JOINING_GROUP_SYRIAC_WAW, /* Syriac_Waw */ + UC_JOINING_GROUP_TAH, /* Tah */ + UC_JOINING_GROUP_TAW, /* Taw */ + UC_JOINING_GROUP_TEH_MARBUTA, /* Teh_Marbuta */ + UC_JOINING_GROUP_TEH_MARBUTA_GOAL, /* Teh_Marbuta_Goal */ + UC_JOINING_GROUP_TETH, /* Teth */ + UC_JOINING_GROUP_WAW, /* Waw */ + UC_JOINING_GROUP_YEH, /* Yeh */ + UC_JOINING_GROUP_YEH_BARREE, /* Yeh_Barree */ + UC_JOINING_GROUP_YEH_WITH_TAIL, /* Yeh_With_Tail */ + UC_JOINING_GROUP_YUDH, /* Yudh */ + UC_JOINING_GROUP_YUDH_HE, /* Yudh_He */ + UC_JOINING_GROUP_ZAIN, /* Zain */ + UC_JOINING_GROUP_ZHAIN, /* Zhain */ + UC_JOINING_GROUP_ROHINGYA_YEH, /* Rohingya_Yeh */ + UC_JOINING_GROUP_STRAIGHT_WAW, /* Straight_Waw */ + UC_JOINING_GROUP_MANICHAEAN_ALEPH, /* Manichaean_Aleph */ + UC_JOINING_GROUP_MANICHAEAN_BETH, /* Manichaean_Beth */ + UC_JOINING_GROUP_MANICHAEAN_GIMEL, /* Manichaean_Gimel */ + UC_JOINING_GROUP_MANICHAEAN_DALETH, /* Manichaean_Daleth */ + UC_JOINING_GROUP_MANICHAEAN_WAW, /* Manichaean_Waw */ + UC_JOINING_GROUP_MANICHAEAN_ZAYIN, /* Manichaean_Zayin */ + UC_JOINING_GROUP_MANICHAEAN_HETH, /* Manichaean_Heth */ + UC_JOINING_GROUP_MANICHAEAN_TETH, /* Manichaean_Teth */ + UC_JOINING_GROUP_MANICHAEAN_YODH, /* Manichaean_Yodh */ + UC_JOINING_GROUP_MANICHAEAN_KAPH, /* Manichaean_Kaph */ + UC_JOINING_GROUP_MANICHAEAN_LAMEDH, /* Manichaean_Lamedh */ + UC_JOINING_GROUP_MANICHAEAN_DHAMEDH, /* Manichaean_Dhamedh */ + UC_JOINING_GROUP_MANICHAEAN_THAMEDH, /* Manichaean_Thamedh */ + UC_JOINING_GROUP_MANICHAEAN_MEM, /* Manichaean_Mem */ + UC_JOINING_GROUP_MANICHAEAN_NUN, /* Manichaean_Nun */ + UC_JOINING_GROUP_MANICHAEAN_SAMEKH, /* Manichaean_Aleph */ + UC_JOINING_GROUP_MANICHAEAN_AYIN, /* Manichaean_Ayin */ + UC_JOINING_GROUP_MANICHAEAN_PE, /* Manichaean_Pe */ + UC_JOINING_GROUP_MANICHAEAN_SADHE, /* Manichaean_Sadhe */ + UC_JOINING_GROUP_MANICHAEAN_QOPH, /* Manichaean_Qoph */ + UC_JOINING_GROUP_MANICHAEAN_RESH, /* Manichaean_Resh */ + UC_JOINING_GROUP_MANICHAEAN_TAW, /* Manichaean_Taw */ + UC_JOINING_GROUP_MANICHAEAN_ONE, /* Manichaean_One */ + UC_JOINING_GROUP_MANICHAEAN_FIVE, /* Manichaean_Five */ + UC_JOINING_GROUP_MANICHAEAN_TEN, /* Manichaean_Ten */ + UC_JOINING_GROUP_MANICHAEAN_TWENTY, /* Manichaean_Twenty */ + UC_JOINING_GROUP_MANICHAEAN_HUNDRED, /* Manichaean_Hundred */ + UC_JOINING_GROUP_AFRICAN_FEH, /* African_Feh */ + UC_JOINING_GROUP_AFRICAN_QAF, /* African_Qaf */ + UC_JOINING_GROUP_AFRICAN_NOON, /* African_Noon */ + UC_JOINING_GROUP_MALAYALAM_NGA, /* Malayalam_Nga */ + UC_JOINING_GROUP_MALAYALAM_JA, /* Malayalam_Ja */ + UC_JOINING_GROUP_MALAYALAM_NYA, /* Malayalam_Nya */ + UC_JOINING_GROUP_MALAYALAM_TTA, /* Malayalam_Tta */ + UC_JOINING_GROUP_MALAYALAM_NNA, /* Malayalam_Nna */ + UC_JOINING_GROUP_MALAYALAM_NNNA, /* Malayalam_Nnna */ + UC_JOINING_GROUP_MALAYALAM_BHA, /* Malayalam_Bha */ + UC_JOINING_GROUP_MALAYALAM_RA, /* Malayalam_Ra */ + UC_JOINING_GROUP_MALAYALAM_LLA, /* Malayalam_Lla */ + UC_JOINING_GROUP_MALAYALAM_LLLA, /* Malayalam_Llla */ + UC_JOINING_GROUP_MALAYALAM_SSA, /* Malayalam_Ssa */ + UC_JOINING_GROUP_HANIFI_ROHINGYA_PA, /* Hanifi_Rohingya_Pa */ + UC_JOINING_GROUP_HANIFI_ROHINGYA_KINNA_YA, /* Hanifi_Rohingya_Kinna_Ya */ + UC_JOINING_GROUP_THIN_YEH, /* Thin_Yeh */ + UC_JOINING_GROUP_VERTICAL_TAIL, /* Vertical_Tail */ + UC_JOINING_GROUP_KASHMIRI_YEH, /* Kashmiri_Yeh */ + UC_JOINING_GROUP_THIN_NOON /* Thin_Noon */ +}; + +/* Return the name of a joining group. */ +extern const char * + uc_joining_group_name (int joining_group) + _UC_ATTRIBUTE_CONST; + +/* Return the joining group given by name, e.g. "Teh_Marbuta". */ +extern int + uc_joining_group_byname (const char *joining_group_name) + _UC_ATTRIBUTE_PURE; + +/* Return the joining group of a Unicode character. */ +extern int + uc_joining_group (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Common API for properties. */ + +/* Data type denoting a property. This is not just a number, but rather a + pointer to the test functions, so that programs that use only few of the + properties don't have a link-time dependency towards all the tables. */ +typedef struct +{ + bool (*test_fn) (ucs4_t uc); +} +uc_property_t; + +/* Predefined properties. */ +/* General. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_WHITE_SPACE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ALPHABETIC; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_ALPHABETIC; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_NOT_A_CHARACTER; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DEPRECATED; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_LOGICAL_ORDER_EXCEPTION; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_VARIATION_SELECTOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PRIVATE_USE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_UNASSIGNED_CODE_VALUE; +/* Case. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_UPPERCASE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_UPPERCASE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_LOWERCASE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_LOWERCASE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_TITLECASE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CASED; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CASE_IGNORABLE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_LOWERCASED; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_UPPERCASED; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_TITLECASED; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEFOLDED; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEMAPPED; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_SOFT_DOTTED; +/* Identifiers. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ID_START; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_ID_START; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ID_CONTINUE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_ID_CONTINUE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_XID_START; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_XID_CONTINUE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_START; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_CONTINUE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PATTERN_WHITE_SPACE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PATTERN_SYNTAX; +/* Shaping and rendering. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_JOIN_CONTROL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_GRAPHEME_BASE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_GRAPHEME_LINK; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_MODIFIER_COMBINING_MARK; +/* Bidi. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_CONTROL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_EUROPEAN_DIGIT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_ARABIC_DIGIT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_COMMON_SEPARATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_BLOCK_SEPARATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_SEGMENT_SEPARATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_WHITESPACE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_NON_SPACING_MARK; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_PDF; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_OTHER_NEUTRAL; +/* Numeric. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_HEX_DIGIT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ASCII_HEX_DIGIT; +/* CJK. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IDEOGRAPHIC; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_UNIFIED_IDEOGRAPH; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_RADICAL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IDS_UNARY_OPERATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IDS_BINARY_OPERATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IDS_TRINARY_OPERATOR; +/* Emoji. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI_PRESENTATION; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI_MODIFIER; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI_MODIFIER_BASE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI_COMPONENT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EXTENDED_PICTOGRAPHIC; +/* Misc. */ +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ZERO_WIDTH; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_SPACE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_NON_BREAK; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ISO_CONTROL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_FORMAT_CONTROL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PREPENDED_CONCATENATION_MARK; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DASH; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_HYPHEN; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PUNCTUATION; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_LINE_SEPARATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PARAGRAPH_SEPARATOR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_QUOTATION_MARK; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_SENTENCE_TERMINAL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_TERMINAL_PUNCTUATION; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CURRENCY_SYMBOL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_MATH; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_MATH; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PAIRED_PUNCTUATION; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_LEFT_OF_PAIR; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_COMBINING; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_COMPOSITE; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DECIMAL_DIGIT; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_NUMERIC; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DIACRITIC; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EXTENDER; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL; +extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_REGIONAL_INDICATOR; + +/* Return the property given by name, e.g. "White space". */ +extern uc_property_t + uc_property_byname (const char *property_name); + +/* Test whether a property is valid. */ +#define uc_property_is_valid(property) ((property).test_fn != NULL) + +/* Test whether a Unicode character has a given property. */ +extern bool + uc_is_property (ucs4_t uc, uc_property_t property); +extern bool uc_is_property_white_space (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_alphabetic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_alphabetic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_not_a_character (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_default_ignorable_code_point (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_default_ignorable_code_point (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_deprecated (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_logical_order_exception (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_variation_selector (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_private_use (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_unassigned_code_value (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_uppercase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_uppercase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_lowercase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_lowercase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_titlecase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_cased (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_case_ignorable (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_lowercased (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_uppercased (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_titlecased (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_casefolded (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_casemapped (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_soft_dotted (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_id_start (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_id_start (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_id_continue (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_id_continue (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_xid_start (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_xid_continue (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_id_compat_math_start (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_id_compat_math_continue (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_pattern_white_space (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_pattern_syntax (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_join_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_grapheme_base (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_grapheme_extend (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_grapheme_extend (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_grapheme_link (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_modifier_combining_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_left_to_right (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_hebrew_right_to_left (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_arabic_right_to_left (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_european_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_eur_num_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_eur_num_terminator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_arabic_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_common_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_block_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_segment_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_whitespace (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_non_spacing_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_boundary_neutral (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_pdf (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_embedding_or_override (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_other_neutral (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_hex_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ascii_hex_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ideographic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_unified_ideograph (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_radical (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ids_unary_operator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ids_binary_operator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ids_trinary_operator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji_presentation (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji_modifier (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji_modifier_base (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji_component (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_extended_pictographic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_zero_width (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_space (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_non_break (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_iso_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_format_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_prepended_concatenation_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_dash (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_hyphen (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_punctuation (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_line_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_paragraph_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_quotation_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_sentence_terminal (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_terminal_punctuation (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_currency_symbol (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_math (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_math (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_paired_punctuation (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_left_of_pair (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_combining (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_composite (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_decimal_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_numeric (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_diacritic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_extender (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ignorable_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_regional_indicator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Other attributes. */ + +/* ------------------------------------------------------------------------- */ + +/* Indic_Conjunct_Break (InCB): from the file DerivedCoreProperties.txt + in the Unicode Character Database. */ + +/* Possible values of the Indic_Conjunct_Break attribute. + This enumeration may be extended in the future. */ +enum +{ + UC_INDIC_CONJUNCT_BREAK_NONE, /* None */ + UC_INDIC_CONJUNCT_BREAK_CONSONANT, /* Consonant */ + UC_INDIC_CONJUNCT_BREAK_LINKER, /* Linker */ + UC_INDIC_CONJUNCT_BREAK_EXTEND /* Extend */ +}; + +/* Return the name of an Indic_Conjunct_Break value. */ +extern const char * + uc_indic_conjunct_break_name (int indic_conjunct_break) + _UC_ATTRIBUTE_CONST; + +/* Return the Indic_Conjunct_Break value given by name, e.g. "Consonant". */ +extern int + uc_indic_conjunct_break_byname (const char *indic_conjunct_break_name) + _UC_ATTRIBUTE_PURE; + +/* Return the Indic_Conjunct_Break attribute of a Unicode character. */ +extern int + uc_indic_conjunct_break (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Subdivision of the Unicode characters into scripts. */ + +typedef struct +{ + unsigned int code : 21; + unsigned int start : 1; + unsigned int end : 1; +} +uc_interval_t; +typedef struct +{ + unsigned int nintervals; + const uc_interval_t *intervals; + const char *name; +} +uc_script_t; + +/* Return the script of a Unicode character. */ +extern const uc_script_t * + uc_script (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the script given by name, e.g. "HAN". */ +extern const uc_script_t * + uc_script_byname (const char *script_name) + _UC_ATTRIBUTE_PURE; + +/* Test whether a Unicode character belongs to a given script. */ +extern bool + uc_is_script (ucs4_t uc, const uc_script_t *script) + _UC_ATTRIBUTE_PURE; + +/* Get the list of all scripts. */ +extern void + uc_all_scripts (const uc_script_t **scripts, size_t *count); + +/* ========================================================================= */ + +/* Subdivision of the Unicode character range into blocks. */ + +typedef struct +{ + ucs4_t start; + ucs4_t end; + const char *name; +} +uc_block_t; + +/* Return the block a character belongs to. */ +extern const uc_block_t * + uc_block (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test whether a Unicode character belongs to a given block. */ +extern bool + uc_is_block (ucs4_t uc, const uc_block_t *block) + _UC_ATTRIBUTE_PURE; + +/* Get the list of all blocks. */ +extern void + uc_all_blocks (const uc_block_t **blocks, size_t *count); + +/* ========================================================================= */ + +/* Properties taken from language standards. */ + +/* Test whether a Unicode character is considered whitespace in ISO C 99. */ +extern bool + uc_is_c_whitespace (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test whether a Unicode character is considered whitespace in Java. */ +extern bool + uc_is_java_whitespace (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +enum +{ + UC_IDENTIFIER_START, /* valid as first or subsequent character */ + UC_IDENTIFIER_VALID, /* valid as subsequent character only */ + UC_IDENTIFIER_INVALID, /* not valid */ + UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */ +}; + +/* Return the categorization of a Unicode character w.r.t. the ISO C 99 + identifier syntax. */ +extern int + uc_c_ident_category (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the categorization of a Unicode character w.r.t. the Java + identifier syntax. */ +extern int + uc_java_ident_category (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Like ISO C and . These functions are deprecated, + because this set of functions was designed with ASCII in mind and cannot + reflect the more diverse reality of the Unicode character set. But they + can be a quick-and-dirty porting aid when migrating from wchar_t APIs + to Unicode strings. */ + +/* Test for any character for which 'uc_is_alpha' or 'uc_is_digit' is true. */ +extern bool + uc_is_alnum (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character for which 'uc_is_upper' or 'uc_is_lower' is true, + or any character that is one of a locale-specific set of characters for + which none of 'uc_is_cntrl', 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' + is true. */ +extern bool + uc_is_alpha (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any control character. */ +extern bool + uc_is_cntrl (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to a decimal-digit character. */ +extern bool + uc_is_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character for which 'uc_is_print' is true and 'uc_is_space' + is false. */ +extern bool + uc_is_graph (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to a lowercase letter or is one + of a locale-specific set of characters for which none of 'uc_is_cntrl', + 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */ +extern bool + uc_is_lower (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any printing character. */ +extern bool + uc_is_print (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any printing character that is one of a locale-specific set of + characters for which neither 'uc_is_space' nor 'uc_is_alnum' is true. */ +extern bool + uc_is_punct (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to a locale-specific set of + characters for which none of 'uc_is_alnum', 'uc_is_graph', or 'uc_is_punct' + is true. */ +extern bool + uc_is_space (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to an uppercase letter or is one + of a locale-specific set of character for which none of 'uc_is_cntrl', + 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */ +extern bool + uc_is_upper (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to a hexadecimal-digit + character. */ +extern bool + uc_is_xdigit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* GNU extension. */ +/* Test for any character that corresponds to a standard blank character or + a locale-specific set of characters for which 'uc_is_alnum' is false. */ +extern bool + uc_is_blank (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +#ifdef __cplusplus +} +#endif + +#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 @@ +/* Unicode character classification and properties. + Copyright (C) 2002, 2005-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNICTYPE_H +#define _UNICTYPE_H + +#include "unitypes.h" + +/* Get bool. */ +#include + +/* Get size_t. */ +#include + +#if @HAVE_UNISTRING_WOE32DLL_H@ +# include +#else +# define LIBUNISTRING_DLL_VARIABLE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* ========================================================================= */ + +/* Field 1 of Unicode Character Database: Character name. + See "uniname.h". */ + +/* ========================================================================= */ + +/* Field 2 of Unicode Character Database: General category. */ + +/* Data type denoting a General category value. This is not just a bitmask, + but rather a bitmask and a pointer to the lookup table, so that programs + that use only the predefined bitmasks (i.e. don't combine bitmasks with & + and |) don't have a link-time dependency towards the big general table. */ +typedef struct +{ + uint32_t bitmask : 31; + /*bool*/ unsigned int generic : 1; + union + { + const void *table; /* when generic is 0 */ + bool (*lookup_fn) (ucs4_t uc, uint32_t bitmask); /* when generic is 1 */ + } lookup; +} +uc_general_category_t; + +/* Bits and bit masks denoting General category values. UnicodeData-3.2.0.html + says a 32-bit integer will always suffice to represent them. + These bit masks can only be used with the uc_is_general_category_withtable + function. */ +enum +{ + UC_CATEGORY_MASK_L = 0x0000001f, + UC_CATEGORY_MASK_LC = 0x00000007, + UC_CATEGORY_MASK_Lu = 0x00000001, + UC_CATEGORY_MASK_Ll = 0x00000002, + UC_CATEGORY_MASK_Lt = 0x00000004, + UC_CATEGORY_MASK_Lm = 0x00000008, + UC_CATEGORY_MASK_Lo = 0x00000010, + UC_CATEGORY_MASK_M = 0x000000e0, + UC_CATEGORY_MASK_Mn = 0x00000020, + UC_CATEGORY_MASK_Mc = 0x00000040, + UC_CATEGORY_MASK_Me = 0x00000080, + UC_CATEGORY_MASK_N = 0x00000700, + UC_CATEGORY_MASK_Nd = 0x00000100, + UC_CATEGORY_MASK_Nl = 0x00000200, + UC_CATEGORY_MASK_No = 0x00000400, + UC_CATEGORY_MASK_P = 0x0003f800, + UC_CATEGORY_MASK_Pc = 0x00000800, + UC_CATEGORY_MASK_Pd = 0x00001000, + UC_CATEGORY_MASK_Ps = 0x00002000, + UC_CATEGORY_MASK_Pe = 0x00004000, + UC_CATEGORY_MASK_Pi = 0x00008000, + UC_CATEGORY_MASK_Pf = 0x00010000, + UC_CATEGORY_MASK_Po = 0x00020000, + UC_CATEGORY_MASK_S = 0x003c0000, + UC_CATEGORY_MASK_Sm = 0x00040000, + UC_CATEGORY_MASK_Sc = 0x00080000, + UC_CATEGORY_MASK_Sk = 0x00100000, + UC_CATEGORY_MASK_So = 0x00200000, + UC_CATEGORY_MASK_Z = 0x01c00000, + UC_CATEGORY_MASK_Zs = 0x00400000, + UC_CATEGORY_MASK_Zl = 0x00800000, + UC_CATEGORY_MASK_Zp = 0x01000000, + UC_CATEGORY_MASK_C = 0x3e000000, + UC_CATEGORY_MASK_Cc = 0x02000000, + UC_CATEGORY_MASK_Cf = 0x04000000, + UC_CATEGORY_MASK_Cs = 0x08000000, + UC_CATEGORY_MASK_Co = 0x10000000, + UC_CATEGORY_MASK_Cn = 0x20000000 +}; + +/* Predefined General category values. */ +extern @GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_L; +extern @GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_LC; +extern @GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lu; +extern @GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Ll; +extern @GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lt; +extern @GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lm; +extern @GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lo; +extern @GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_M; +extern @GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Mn; +extern @GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Mc; +extern @GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Me; +extern @GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_N; +extern @GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Nd; +extern @GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Nl; +extern @GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_No; +extern @GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_P; +extern @GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pc; +extern @GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pd; +extern @GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Ps; +extern @GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pe; +extern @GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pi; +extern @GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pf; +extern @GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Po; +extern @GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_S; +extern @GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sm; +extern @GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sc; +extern @GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sk; +extern @GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_So; +extern @GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Z; +extern @GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zs; +extern @GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zl; +extern @GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zp; +extern @GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_C; +extern @GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cc; +extern @GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cf; +extern @GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cs; +extern @GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Co; +extern @GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cn; +/* Non-public. */ +extern const uc_general_category_t _UC_CATEGORY_NONE; + +/* Alias names for predefined General category values. */ +#define UC_LETTER UC_CATEGORY_L +#define UC_CASED_LETTER UC_CATEGORY_LC +#define UC_UPPERCASE_LETTER UC_CATEGORY_Lu +#define UC_LOWERCASE_LETTER UC_CATEGORY_Ll +#define UC_TITLECASE_LETTER UC_CATEGORY_Lt +#define UC_MODIFIER_LETTER UC_CATEGORY_Lm +#define UC_OTHER_LETTER UC_CATEGORY_Lo +#define UC_MARK UC_CATEGORY_M +#define UC_NON_SPACING_MARK UC_CATEGORY_Mn +#define UC_COMBINING_SPACING_MARK UC_CATEGORY_Mc +#define UC_ENCLOSING_MARK UC_CATEGORY_Me +#define UC_NUMBER UC_CATEGORY_N +#define UC_DECIMAL_DIGIT_NUMBER UC_CATEGORY_Nd +#define UC_LETTER_NUMBER UC_CATEGORY_Nl +#define UC_OTHER_NUMBER UC_CATEGORY_No +#define UC_PUNCTUATION UC_CATEGORY_P +#define UC_CONNECTOR_PUNCTUATION UC_CATEGORY_Pc +#define UC_DASH_PUNCTUATION UC_CATEGORY_Pd +#define UC_OPEN_PUNCTUATION UC_CATEGORY_Ps /* a.k.a. UC_START_PUNCTUATION */ +#define UC_CLOSE_PUNCTUATION UC_CATEGORY_Pe /* a.k.a. UC_END_PUNCTUATION */ +#define UC_INITIAL_QUOTE_PUNCTUATION UC_CATEGORY_Pi +#define UC_FINAL_QUOTE_PUNCTUATION UC_CATEGORY_Pf +#define UC_OTHER_PUNCTUATION UC_CATEGORY_Po +#define UC_SYMBOL UC_CATEGORY_S +#define UC_MATH_SYMBOL UC_CATEGORY_Sm +#define UC_CURRENCY_SYMBOL UC_CATEGORY_Sc +#define UC_MODIFIER_SYMBOL UC_CATEGORY_Sk +#define UC_OTHER_SYMBOL UC_CATEGORY_So +#define UC_SEPARATOR UC_CATEGORY_Z +#define UC_SPACE_SEPARATOR UC_CATEGORY_Zs +#define UC_LINE_SEPARATOR UC_CATEGORY_Zl +#define UC_PARAGRAPH_SEPARATOR UC_CATEGORY_Zp +#define UC_OTHER UC_CATEGORY_C +#define UC_CONTROL UC_CATEGORY_Cc +#define UC_FORMAT UC_CATEGORY_Cf +#define UC_SURROGATE UC_CATEGORY_Cs /* all of them are invalid characters */ +#define UC_PRIVATE_USE UC_CATEGORY_Co +#define UC_UNASSIGNED UC_CATEGORY_Cn /* some of them are invalid characters */ + +/* Return the union of two general categories. + This corresponds to the unions of the two sets of characters. */ +extern uc_general_category_t + uc_general_category_or (uc_general_category_t category1, + uc_general_category_t category2); + +/* Return the intersection of two general categories as bit masks. + This *does*not* correspond to the intersection of the two sets of + characters. */ +extern uc_general_category_t + uc_general_category_and (uc_general_category_t category1, + uc_general_category_t category2); + +/* Return the intersection of a general category with the complement of a + second general category, as bit masks. + This *does*not* correspond to the intersection with complement, when + viewing the categories as sets of characters. */ +extern uc_general_category_t + uc_general_category_and_not (uc_general_category_t category1, + uc_general_category_t category2); + +/* Return the name of a general category. */ +extern const char * + uc_general_category_name (uc_general_category_t category) + _UC_ATTRIBUTE_PURE; + +/* Return the long name of a general category. */ +extern const char * + uc_general_category_long_name (uc_general_category_t category) + _UC_ATTRIBUTE_PURE; + +/* Return the general category given by name, e.g. "Lu", or by long name, + e.g. "Uppercase Letter". */ +extern uc_general_category_t + uc_general_category_byname (const char *category_name) + _UC_ATTRIBUTE_PURE; + +/* Return the general category of a Unicode character. */ +extern uc_general_category_t + uc_general_category (ucs4_t uc) + _UC_ATTRIBUTE_PURE; + +/* Test whether a Unicode character belongs to a given category. + The CATEGORY argument can be the combination of several predefined + general categories. */ +extern bool + uc_is_general_category (ucs4_t uc, uc_general_category_t category) + _UC_ATTRIBUTE_PURE; +/* Likewise. This function uses a big table comprising all categories. */ +extern bool + uc_is_general_category_withtable (ucs4_t uc, uint32_t bitmask) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 3 of Unicode Character Database: Canonical combining class. */ + +/* The possible results of uc_combining_class (0..255) are described in + UCD.html. The list here is not definitive; more values can be added + in future versions. */ +enum +{ + UC_CCC_NR = 0, /* Not Reordered */ + UC_CCC_OV = 1, /* Overlay */ + UC_CCC_NK = 7, /* Nukta */ + UC_CCC_KV = 8, /* Kana Voicing */ + UC_CCC_VR = 9, /* Virama */ + UC_CCC_ATBL = 200, /* Attached Below Left */ + UC_CCC_ATB = 202, /* Attached Below */ + UC_CCC_ATA = 214, /* Attached Above */ + UC_CCC_ATAR = 216, /* Attached Above Right */ + UC_CCC_BL = 218, /* Below Left */ + UC_CCC_B = 220, /* Below */ + UC_CCC_BR = 222, /* Below Right */ + UC_CCC_L = 224, /* Left */ + UC_CCC_R = 226, /* Right */ + UC_CCC_AL = 228, /* Above Left */ + UC_CCC_A = 230, /* Above */ + UC_CCC_AR = 232, /* Above Right */ + UC_CCC_DB = 233, /* Double Below */ + UC_CCC_DA = 234, /* Double Above */ + UC_CCC_IS = 240 /* Iota Subscript */ +}; + +/* Return the canonical combining class of a Unicode character. */ +extern int + uc_combining_class (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the name of a canonical combining class. */ +extern const char * + uc_combining_class_name (int ccc) + _UC_ATTRIBUTE_CONST; + +/* Return the long name of a canonical combining class. */ +extern const char * + uc_combining_class_long_name (int ccc) + _UC_ATTRIBUTE_CONST; + +/* Return the canonical combining class given by name, e.g. "BL", or by long + name, e.g. "Below Left". */ +extern int + uc_combining_class_byname (const char *ccc_name) + _UC_ATTRIBUTE_PURE; + +/* ========================================================================= */ + +/* Field 4 of Unicode Character Database: Bidi class. + Before Unicode 4.0, this field was called "Bidirectional category". */ + +enum +{ + UC_BIDI_L, /* Left-to-Right */ + UC_BIDI_LRE, /* Left-to-Right Embedding */ + UC_BIDI_LRO, /* Left-to-Right Override */ + UC_BIDI_R, /* Right-to-Left */ + UC_BIDI_AL, /* Right-to-Left Arabic */ + UC_BIDI_RLE, /* Right-to-Left Embedding */ + UC_BIDI_RLO, /* Right-to-Left Override */ + UC_BIDI_PDF, /* Pop Directional Format */ + UC_BIDI_EN, /* European Number */ + UC_BIDI_ES, /* European Number Separator */ + UC_BIDI_ET, /* European Number Terminator */ + UC_BIDI_AN, /* Arabic Number */ + UC_BIDI_CS, /* Common Number Separator */ + UC_BIDI_NSM, /* Non-Spacing Mark */ + UC_BIDI_BN, /* Boundary Neutral */ + UC_BIDI_B, /* Paragraph Separator */ + UC_BIDI_S, /* Segment Separator */ + UC_BIDI_WS, /* Whitespace */ + UC_BIDI_ON, /* Other Neutral */ + UC_BIDI_LRI, /* Left-to-Right Isolate */ + UC_BIDI_RLI, /* Right-to-Left Isolate */ + UC_BIDI_FSI, /* First Strong Isolate */ + UC_BIDI_PDI /* Pop Directional Isolate */ +}; + +/* Return the name of a bidi class. */ +extern const char * + uc_bidi_class_name (int bidi_class) + _UC_ATTRIBUTE_CONST; +/* Same; obsolete function name. */ +extern const char * + uc_bidi_category_name (int category) + _UC_ATTRIBUTE_CONST; + +/* Return the long name of a bidi class. */ +extern const char * + uc_bidi_class_long_name (int bidi_class) + _UC_ATTRIBUTE_CONST; + +/* Return the bidi class given by name, e.g. "LRE", or by long name, e.g. + "Left-to-Right Embedding". */ +extern int + uc_bidi_class_byname (const char *bidi_class_name) + _UC_ATTRIBUTE_PURE; +/* Same; obsolete function name. */ +extern int + uc_bidi_category_byname (const char *category_name) + _UC_ATTRIBUTE_PURE; + +/* Return the bidi class of a Unicode character. */ +extern int + uc_bidi_class (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +/* Same; obsolete function name. */ +extern int + uc_bidi_category (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test whether a Unicode character belongs to a given bidi class. */ +extern bool + uc_is_bidi_class (ucs4_t uc, int bidi_class) + _UC_ATTRIBUTE_CONST; +/* Same; obsolete function name. */ +extern bool + uc_is_bidi_category (ucs4_t uc, int category) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 5 of Unicode Character Database: Character decomposition mapping. + See "uninorm.h". */ + +/* ========================================================================= */ + +/* Field 6 of Unicode Character Database: Decimal digit value. */ + +/* Return the decimal digit value of a Unicode character. */ +extern int + uc_decimal_value (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 7 of Unicode Character Database: Digit value. */ + +/* Return the digit value of a Unicode character. */ +extern int + uc_digit_value (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 8 of Unicode Character Database: Numeric value. */ + +/* Return the numeric value of a Unicode character. */ +typedef struct +{ + int numerator; + int denominator; +} +uc_fraction_t; +extern uc_fraction_t + uc_numeric_value (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 9 of Unicode Character Database: Mirrored. */ + +/* Return the mirrored character of a Unicode character UC in *PUC. */ +extern bool + uc_mirror_char (ucs4_t uc, ucs4_t *puc); + +/* ========================================================================= */ + +/* Field 10 of Unicode Character Database: Unicode 1.0 Name. + Not available in this library. */ + +/* ========================================================================= */ + +/* Field 11 of Unicode Character Database: ISO 10646 comment. + Not available in this library. */ + +/* ========================================================================= */ + +/* Field 12, 13, 14 of Unicode Character Database: Uppercase mapping, + lowercase mapping, titlecase mapping. See "unicase.h". */ + +/* ========================================================================= */ + +/* Field 2 of the file ArabicShaping.txt in the Unicode Character Database. */ + +/* Possible joining types. */ +enum +{ + UC_JOINING_TYPE_U, /* Non_Joining */ + UC_JOINING_TYPE_T, /* Transparent */ + UC_JOINING_TYPE_C, /* Join_Causing */ + UC_JOINING_TYPE_L, /* Left_Joining */ + UC_JOINING_TYPE_R, /* Right_Joining */ + UC_JOINING_TYPE_D /* Dual_Joining */ +}; + +/* Return the name of a joining type. */ +extern const char * + uc_joining_type_name (int joining_type) + _UC_ATTRIBUTE_CONST; + +/* Return the long name of a joining type. */ +extern const char * + uc_joining_type_long_name (int joining_type) + _UC_ATTRIBUTE_CONST; + +/* Return the joining type given by name, e.g. "D", or by long name, e.g. + "Dual Joining". */ +extern int + uc_joining_type_byname (const char *joining_type_name) + _UC_ATTRIBUTE_PURE; + +/* Return the joining type of a Unicode character. */ +extern int + uc_joining_type (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Field 3 of the file ArabicShaping.txt in the Unicode Character Database. */ + +/* Possible joining groups. + This enumeration may be extended in the future. */ +enum +{ + UC_JOINING_GROUP_NONE, /* No_Joining_Group */ + UC_JOINING_GROUP_AIN, /* Ain */ + UC_JOINING_GROUP_ALAPH, /* Alaph */ + UC_JOINING_GROUP_ALEF, /* Alef */ + UC_JOINING_GROUP_BEH, /* Beh */ + UC_JOINING_GROUP_BETH, /* Beth */ + UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, /* Burushaski_Yeh_Barree */ + UC_JOINING_GROUP_DAL, /* Dal */ + UC_JOINING_GROUP_DALATH_RISH, /* Dalath_Rish */ + UC_JOINING_GROUP_E, /* E */ + UC_JOINING_GROUP_FARSI_YEH, /* Farsi_Yeh */ + UC_JOINING_GROUP_FE, /* Fe */ + UC_JOINING_GROUP_FEH, /* Feh */ + UC_JOINING_GROUP_FINAL_SEMKATH, /* Final_Semkath */ + UC_JOINING_GROUP_GAF, /* Gaf */ + UC_JOINING_GROUP_GAMAL, /* Gamal */ + UC_JOINING_GROUP_HAH, /* Hah */ + UC_JOINING_GROUP_HE, /* He */ + UC_JOINING_GROUP_HEH, /* Heh */ + UC_JOINING_GROUP_HEH_GOAL, /* Heh_Goal */ + UC_JOINING_GROUP_HETH, /* Heth */ + UC_JOINING_GROUP_KAF, /* Kaf */ + UC_JOINING_GROUP_KAPH, /* Kaph */ + UC_JOINING_GROUP_KHAPH, /* Khaph */ + UC_JOINING_GROUP_KNOTTED_HEH, /* Knotted_Heh */ + UC_JOINING_GROUP_LAM, /* Lam */ + UC_JOINING_GROUP_LAMADH, /* Lamadh */ + UC_JOINING_GROUP_MEEM, /* Meem */ + UC_JOINING_GROUP_MIM, /* Mim */ + UC_JOINING_GROUP_NOON, /* Noon */ + UC_JOINING_GROUP_NUN, /* Nun */ + UC_JOINING_GROUP_NYA, /* Nya */ + UC_JOINING_GROUP_PE, /* Pe */ + UC_JOINING_GROUP_QAF, /* Qaf */ + UC_JOINING_GROUP_QAPH, /* Qaph */ + UC_JOINING_GROUP_REH, /* Reh */ + UC_JOINING_GROUP_REVERSED_PE, /* Reversed_Pe */ + UC_JOINING_GROUP_SAD, /* Sad */ + UC_JOINING_GROUP_SADHE, /* Sadhe */ + UC_JOINING_GROUP_SEEN, /* Seen */ + UC_JOINING_GROUP_SEMKATH, /* Semkath */ + UC_JOINING_GROUP_SHIN, /* Shin */ + UC_JOINING_GROUP_SWASH_KAF, /* Swash_Kaf */ + UC_JOINING_GROUP_SYRIAC_WAW, /* Syriac_Waw */ + UC_JOINING_GROUP_TAH, /* Tah */ + UC_JOINING_GROUP_TAW, /* Taw */ + UC_JOINING_GROUP_TEH_MARBUTA, /* Teh_Marbuta */ + UC_JOINING_GROUP_TEH_MARBUTA_GOAL, /* Teh_Marbuta_Goal */ + UC_JOINING_GROUP_TETH, /* Teth */ + UC_JOINING_GROUP_WAW, /* Waw */ + UC_JOINING_GROUP_YEH, /* Yeh */ + UC_JOINING_GROUP_YEH_BARREE, /* Yeh_Barree */ + UC_JOINING_GROUP_YEH_WITH_TAIL, /* Yeh_With_Tail */ + UC_JOINING_GROUP_YUDH, /* Yudh */ + UC_JOINING_GROUP_YUDH_HE, /* Yudh_He */ + UC_JOINING_GROUP_ZAIN, /* Zain */ + UC_JOINING_GROUP_ZHAIN, /* Zhain */ + UC_JOINING_GROUP_ROHINGYA_YEH, /* Rohingya_Yeh */ + UC_JOINING_GROUP_STRAIGHT_WAW, /* Straight_Waw */ + UC_JOINING_GROUP_MANICHAEAN_ALEPH, /* Manichaean_Aleph */ + UC_JOINING_GROUP_MANICHAEAN_BETH, /* Manichaean_Beth */ + UC_JOINING_GROUP_MANICHAEAN_GIMEL, /* Manichaean_Gimel */ + UC_JOINING_GROUP_MANICHAEAN_DALETH, /* Manichaean_Daleth */ + UC_JOINING_GROUP_MANICHAEAN_WAW, /* Manichaean_Waw */ + UC_JOINING_GROUP_MANICHAEAN_ZAYIN, /* Manichaean_Zayin */ + UC_JOINING_GROUP_MANICHAEAN_HETH, /* Manichaean_Heth */ + UC_JOINING_GROUP_MANICHAEAN_TETH, /* Manichaean_Teth */ + UC_JOINING_GROUP_MANICHAEAN_YODH, /* Manichaean_Yodh */ + UC_JOINING_GROUP_MANICHAEAN_KAPH, /* Manichaean_Kaph */ + UC_JOINING_GROUP_MANICHAEAN_LAMEDH, /* Manichaean_Lamedh */ + UC_JOINING_GROUP_MANICHAEAN_DHAMEDH, /* Manichaean_Dhamedh */ + UC_JOINING_GROUP_MANICHAEAN_THAMEDH, /* Manichaean_Thamedh */ + UC_JOINING_GROUP_MANICHAEAN_MEM, /* Manichaean_Mem */ + UC_JOINING_GROUP_MANICHAEAN_NUN, /* Manichaean_Nun */ + UC_JOINING_GROUP_MANICHAEAN_SAMEKH, /* Manichaean_Aleph */ + UC_JOINING_GROUP_MANICHAEAN_AYIN, /* Manichaean_Ayin */ + UC_JOINING_GROUP_MANICHAEAN_PE, /* Manichaean_Pe */ + UC_JOINING_GROUP_MANICHAEAN_SADHE, /* Manichaean_Sadhe */ + UC_JOINING_GROUP_MANICHAEAN_QOPH, /* Manichaean_Qoph */ + UC_JOINING_GROUP_MANICHAEAN_RESH, /* Manichaean_Resh */ + UC_JOINING_GROUP_MANICHAEAN_TAW, /* Manichaean_Taw */ + UC_JOINING_GROUP_MANICHAEAN_ONE, /* Manichaean_One */ + UC_JOINING_GROUP_MANICHAEAN_FIVE, /* Manichaean_Five */ + UC_JOINING_GROUP_MANICHAEAN_TEN, /* Manichaean_Ten */ + UC_JOINING_GROUP_MANICHAEAN_TWENTY, /* Manichaean_Twenty */ + UC_JOINING_GROUP_MANICHAEAN_HUNDRED, /* Manichaean_Hundred */ + UC_JOINING_GROUP_AFRICAN_FEH, /* African_Feh */ + UC_JOINING_GROUP_AFRICAN_QAF, /* African_Qaf */ + UC_JOINING_GROUP_AFRICAN_NOON, /* African_Noon */ + UC_JOINING_GROUP_MALAYALAM_NGA, /* Malayalam_Nga */ + UC_JOINING_GROUP_MALAYALAM_JA, /* Malayalam_Ja */ + UC_JOINING_GROUP_MALAYALAM_NYA, /* Malayalam_Nya */ + UC_JOINING_GROUP_MALAYALAM_TTA, /* Malayalam_Tta */ + UC_JOINING_GROUP_MALAYALAM_NNA, /* Malayalam_Nna */ + UC_JOINING_GROUP_MALAYALAM_NNNA, /* Malayalam_Nnna */ + UC_JOINING_GROUP_MALAYALAM_BHA, /* Malayalam_Bha */ + UC_JOINING_GROUP_MALAYALAM_RA, /* Malayalam_Ra */ + UC_JOINING_GROUP_MALAYALAM_LLA, /* Malayalam_Lla */ + UC_JOINING_GROUP_MALAYALAM_LLLA, /* Malayalam_Llla */ + UC_JOINING_GROUP_MALAYALAM_SSA, /* Malayalam_Ssa */ + UC_JOINING_GROUP_HANIFI_ROHINGYA_PA, /* Hanifi_Rohingya_Pa */ + UC_JOINING_GROUP_HANIFI_ROHINGYA_KINNA_YA, /* Hanifi_Rohingya_Kinna_Ya */ + UC_JOINING_GROUP_THIN_YEH, /* Thin_Yeh */ + UC_JOINING_GROUP_VERTICAL_TAIL, /* Vertical_Tail */ + UC_JOINING_GROUP_KASHMIRI_YEH /* Kashmiri_Yeh */ +}; + +/* Return the name of a joining group. */ +extern const char * + uc_joining_group_name (int joining_group) + _UC_ATTRIBUTE_CONST; + +/* Return the joining group given by name, e.g. "Teh_Marbuta". */ +extern int + uc_joining_group_byname (const char *joining_group_name) + _UC_ATTRIBUTE_PURE; + +/* Return the joining group of a Unicode character. */ +extern int + uc_joining_group (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Common API for properties. */ + +/* Data type denoting a property. This is not just a number, but rather a + pointer to the test functions, so that programs that use only few of the + properties don't have a link-time dependency towards all the tables. */ +typedef struct +{ + bool (*test_fn) (ucs4_t uc); +} +uc_property_t; + +/* Predefined properties. */ +/* General. */ +extern @GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_WHITE_SPACE; +extern @GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ALPHABETIC; +extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ALPHABETIC; +extern @GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NOT_A_CHARACTER; +extern @GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT; +extern @GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT; +extern @GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEPRECATED; +extern @GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOGICAL_ORDER_EXCEPTION; +extern @GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_VARIATION_SELECTOR; +extern @GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PRIVATE_USE; +extern @GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNASSIGNED_CODE_VALUE; +/* Case. */ +extern @GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UPPERCASE; +extern @GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_UPPERCASE; +extern @GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOWERCASE; +extern @GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_LOWERCASE; +extern @GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TITLECASE; +extern @GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASED; +extern @GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASE_IGNORABLE; +extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_LOWERCASED; +extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_UPPERCASED; +extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_TITLECASED; +extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEFOLDED; +extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEMAPPED; +extern @GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SOFT_DOTTED; +/* Identifiers. */ +extern @GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_START; +extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_START; +extern @GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_CONTINUE; +extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_CONTINUE; +extern @GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_START; +extern @GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_CONTINUE; +extern @GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_START; +extern @GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_CONTINUE; +extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_WHITE_SPACE; +extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_SYNTAX; +/* Shaping and rendering. */ +extern @GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_JOIN_CONTROL; +extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_BASE; +extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND; +extern @GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND; +extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_LINK; +extern @GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MODIFIER_COMBINING_MARK; +/* Bidi. */ +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_CONTROL; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUROPEAN_DIGIT; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_DIGIT; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_COMMON_SEPARATOR; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BLOCK_SEPARATOR; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_SEGMENT_SEPARATOR; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_WHITESPACE; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_NON_SPACING_MARK; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_PDF; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE; +extern @GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_OTHER_NEUTRAL; +/* Numeric. */ +extern @GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HEX_DIGIT; +extern @GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ASCII_HEX_DIGIT; +/* CJK. */ +extern @GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDEOGRAPHIC; +extern @GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNIFIED_IDEOGRAPH; +extern @GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_RADICAL; +extern @GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_UNARY_OPERATOR; +extern @GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_BINARY_OPERATOR; +extern @GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_TRINARY_OPERATOR; +/* Emoji. */ +extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI; +extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_PRESENTATION; +extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER; +extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER_BASE; +extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_COMPONENT; +extern @GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDED_PICTOGRAPHIC; +/* Misc. */ +extern @GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ZERO_WIDTH; +extern @GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SPACE; +extern @GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NON_BREAK; +extern @GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ISO_CONTROL; +extern @GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_FORMAT_CONTROL; +extern @GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PREPENDED_CONCATENATION_MARK; +extern @GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DASH; +extern @GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HYPHEN; +extern @GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PUNCTUATION; +extern @GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LINE_SEPARATOR; +extern @GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PARAGRAPH_SEPARATOR; +extern @GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_QUOTATION_MARK; +extern @GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SENTENCE_TERMINAL; +extern @GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TERMINAL_PUNCTUATION; +extern @GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CURRENCY_SYMBOL; +extern @GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MATH; +extern @GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_MATH; +extern @GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PAIRED_PUNCTUATION; +extern @GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LEFT_OF_PAIR; +extern @GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMBINING; +extern @GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMPOSITE; +extern @GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DECIMAL_DIGIT; +extern @GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NUMERIC; +extern @GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DIACRITIC; +extern @GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDER; +extern @GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL; +extern @GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_REGIONAL_INDICATOR; + +/* Return the property given by name, e.g. "White space". */ +extern uc_property_t + uc_property_byname (const char *property_name); + +/* Test whether a property is valid. */ +#define uc_property_is_valid(property) ((property).test_fn != NULL) + +/* Test whether a Unicode character has a given property. */ +extern bool + uc_is_property (ucs4_t uc, uc_property_t property); +extern bool uc_is_property_white_space (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_alphabetic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_alphabetic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_not_a_character (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_default_ignorable_code_point (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_default_ignorable_code_point (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_deprecated (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_logical_order_exception (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_variation_selector (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_private_use (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_unassigned_code_value (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_uppercase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_uppercase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_lowercase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_lowercase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_titlecase (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_cased (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_case_ignorable (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_lowercased (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_uppercased (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_titlecased (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_casefolded (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_changes_when_casemapped (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_soft_dotted (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_id_start (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_id_start (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_id_continue (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_id_continue (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_xid_start (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_xid_continue (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_id_compat_math_start (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_id_compat_math_continue (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_pattern_white_space (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_pattern_syntax (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_join_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_grapheme_base (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_grapheme_extend (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_grapheme_extend (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_grapheme_link (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_modifier_combining_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_left_to_right (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_hebrew_right_to_left (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_arabic_right_to_left (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_european_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_eur_num_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_eur_num_terminator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_arabic_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_common_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_block_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_segment_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_whitespace (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_non_spacing_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_boundary_neutral (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_pdf (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_embedding_or_override (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_bidi_other_neutral (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_hex_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ascii_hex_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ideographic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_unified_ideograph (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_radical (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ids_unary_operator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ids_binary_operator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ids_trinary_operator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji_presentation (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji_modifier (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji_modifier_base (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_emoji_component (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_extended_pictographic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_zero_width (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_space (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_non_break (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_iso_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_format_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_prepended_concatenation_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_dash (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_hyphen (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_punctuation (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_line_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_paragraph_separator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_quotation_mark (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_sentence_terminal (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_terminal_punctuation (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_currency_symbol (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_math (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_other_math (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_paired_punctuation (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_left_of_pair (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_combining (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_composite (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_decimal_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_numeric (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_diacritic (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_extender (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_ignorable_control (ucs4_t uc) + _UC_ATTRIBUTE_CONST; +extern bool uc_is_property_regional_indicator (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Other attributes. */ + +/* ------------------------------------------------------------------------- */ + +/* Indic_Conjunct_Break (InCB): from the file DerivedCoreProperties.txt + in the Unicode Character Database. */ + +/* Possible values of the Indic_Conjunct_Break attribute. + This enumeration may be extended in the future. */ +enum +{ + UC_INDIC_CONJUNCT_BREAK_NONE, /* None */ + UC_INDIC_CONJUNCT_BREAK_CONSONANT, /* Consonant */ + UC_INDIC_CONJUNCT_BREAK_LINKER, /* Linker */ + UC_INDIC_CONJUNCT_BREAK_EXTEND /* Extend */ +}; + +/* Return the name of an Indic_Conjunct_Break value. */ +extern const char * + uc_indic_conjunct_break_name (int indic_conjunct_break) + _UC_ATTRIBUTE_CONST; + +/* Return the Indic_Conjunct_Break value given by name, e.g. "Consonant". */ +extern int + uc_indic_conjunct_break_byname (const char *indic_conjunct_break_name) + _UC_ATTRIBUTE_PURE; + +/* Return the Indic_Conjunct_Break attribute of a Unicode character. */ +extern int + uc_indic_conjunct_break (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Subdivision of the Unicode characters into scripts. */ + +typedef struct +{ + unsigned int code : 21; + unsigned int start : 1; + unsigned int end : 1; +} +uc_interval_t; +typedef struct +{ + unsigned int nintervals; + const uc_interval_t *intervals; + const char *name; +} +uc_script_t; + +/* Return the script of a Unicode character. */ +extern const uc_script_t * + uc_script (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the script given by name, e.g. "HAN". */ +extern const uc_script_t * + uc_script_byname (const char *script_name) + _UC_ATTRIBUTE_PURE; + +/* Test whether a Unicode character belongs to a given script. */ +extern bool + uc_is_script (ucs4_t uc, const uc_script_t *script) + _UC_ATTRIBUTE_PURE; + +/* Get the list of all scripts. */ +extern void + uc_all_scripts (const uc_script_t **scripts, size_t *count); + +/* ========================================================================= */ + +/* Subdivision of the Unicode character range into blocks. */ + +typedef struct +{ + ucs4_t start; + ucs4_t end; + const char *name; +} +uc_block_t; + +/* Return the block a character belongs to. */ +extern const uc_block_t * + uc_block (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test whether a Unicode character belongs to a given block. */ +extern bool + uc_is_block (ucs4_t uc, const uc_block_t *block) + _UC_ATTRIBUTE_PURE; + +/* Get the list of all blocks. */ +extern void + uc_all_blocks (const uc_block_t **blocks, size_t *count); + +/* ========================================================================= */ + +/* Properties taken from language standards. */ + +/* Test whether a Unicode character is considered whitespace in ISO C 99. */ +extern bool + uc_is_c_whitespace (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test whether a Unicode character is considered whitespace in Java. */ +extern bool + uc_is_java_whitespace (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +enum +{ + UC_IDENTIFIER_START, /* valid as first or subsequent character */ + UC_IDENTIFIER_VALID, /* valid as subsequent character only */ + UC_IDENTIFIER_INVALID, /* not valid */ + UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */ +}; + +/* Return the categorization of a Unicode character w.r.t. the ISO C 99 + identifier syntax. */ +extern int + uc_c_ident_category (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Return the categorization of a Unicode character w.r.t. the Java + identifier syntax. */ +extern int + uc_java_ident_category (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +/* Like ISO C and . These functions are deprecated, + because this set of functions was designed with ASCII in mind and cannot + reflect the more diverse reality of the Unicode character set. But they + can be a quick-and-dirty porting aid when migrating from wchar_t APIs + to Unicode strings. */ + +/* Test for any character for which 'uc_is_alpha' or 'uc_is_digit' is true. */ +extern bool + uc_is_alnum (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character for which 'uc_is_upper' or 'uc_is_lower' is true, + or any character that is one of a locale-specific set of characters for + which none of 'uc_is_cntrl', 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' + is true. */ +extern bool + uc_is_alpha (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any control character. */ +extern bool + uc_is_cntrl (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to a decimal-digit character. */ +extern bool + uc_is_digit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character for which 'uc_is_print' is true and 'uc_is_space' + is false. */ +extern bool + uc_is_graph (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to a lowercase letter or is one + of a locale-specific set of characters for which none of 'uc_is_cntrl', + 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */ +extern bool + uc_is_lower (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any printing character. */ +extern bool + uc_is_print (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any printing character that is one of a locale-specific set of + characters for which neither 'uc_is_space' nor 'uc_is_alnum' is true. */ +extern bool + uc_is_punct (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to a locale-specific set of + characters for which none of 'uc_is_alnum', 'uc_is_graph', or 'uc_is_punct' + is true. */ +extern bool + uc_is_space (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to an uppercase letter or is one + of a locale-specific set of character for which none of 'uc_is_cntrl', + 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */ +extern bool + uc_is_upper (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* Test for any character that corresponds to a hexadecimal-digit + character. */ +extern bool + uc_is_xdigit (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* GNU extension. */ +/* Test for any character that corresponds to a standard blank character or + a locale-specific set of characters for which 'uc_is_alnum' is false. */ +extern bool + uc_is_blank (ucs4_t uc) + _UC_ATTRIBUTE_CONST; + +/* ========================================================================= */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UNICTYPE_H */ diff --git a/gl/unictype/.deps/.dirstamp b/gl/unictype/.deps/.dirstamp new file mode 100644 index 00000000..e69de29b 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 @@ +unictype/libgnu_a-ctype_alnum.o: unictype/ctype_alnum.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_alnum.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_alpha.o: unictype/ctype_alpha.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_alpha.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_blank.o: unictype/ctype_blank.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_blank.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_cntrl.o: unictype/ctype_cntrl.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_cntrl.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_digit.o: unictype/ctype_digit.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_digit.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_graph.o: unictype/ctype_graph.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_graph.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_lower.o: unictype/ctype_lower.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_lower.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_print.o: unictype/ctype_print.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_print.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_punct.o: unictype/ctype_punct.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_punct.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_space.o: unictype/ctype_space.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_space.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_upper.o: unictype/ctype_upper.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_upper.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/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 @@ +unictype/libgnu_a-ctype_xdigit.o: unictype/ctype_xdigit.c \ + /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \ + unictype/ctype_xdigit.h +/usr/include/stdc-predef.h: +../config.h: +unictype.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +unictype/bitmap.h: +unictype/ctype_xdigit.h: diff --git a/gl/unictype/.dirstamp b/gl/unictype/.dirstamp new file mode 100644 index 00000000..e69de29b 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 @@ +/* Three-level bitmap lookup. + Copyright (C) 2000-2002, 2005-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2000-2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +static inline int bitmap_lookup (const void *table, ucs4_t uc); + +/* These values are currently hardcoded into gen-uni-tables.c, function + output_predicate(). */ +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 + +static inline int +bitmap_lookup (const void *table, ucs4_t uc) +{ + unsigned int index1 = uc >> header_0; + if (index1 < ((const int *) table)[0]) + { + int lookup1 = ((const int *) table)[1 + index1]; + if (lookup1 >= 0) + { + unsigned int index2 = (uc >> header_2) & header_3; + int lookup2 = ((const short *) table)[lookup1 + index2]; + if (lookup2 >= 0) + { + unsigned int index3 = (uc >> 5) & header_4; + unsigned int lookup3 = ((const unsigned int *) table)[lookup2 + index3]; + + return (lookup3 >> (uc & 0x1f)) & 1; + } + } + } + return 0; +} 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_alnum table. */ +#include "ctype_alnum.h" + +bool +uc_is_alnum (ucs4_t uc) +{ + return bitmap_lookup (&u_is_alnum, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[4]; + short level2[4 << 7]; + unsigned int level3[85 << 4]; + } +u_is_alnum = +{ + { 4 }, + { + 5 * sizeof (int) / sizeof (short) + 0, + 5 * sizeof (int) / sizeof (short) + 128, + 5 * sizeof (int) / sizeof (short) + 256, + 5 * sizeof (int) / sizeof (short) + 384 + }, + { + 5 + 512 * sizeof (short) / sizeof (int) + 0, + 5 + 512 * sizeof (short) / sizeof (int) + 16, + 5 + 512 * sizeof (short) / sizeof (int) + 32, + 5 + 512 * sizeof (short) / sizeof (int) + 48, + 5 + 512 * sizeof (short) / sizeof (int) + 64, + 5 + 512 * sizeof (short) / sizeof (int) + 80, + 5 + 512 * sizeof (short) / sizeof (int) + 96, + 5 + 512 * sizeof (short) / sizeof (int) + 112, + 5 + 512 * sizeof (short) / sizeof (int) + 128, + 5 + 512 * sizeof (short) / sizeof (int) + 144, + 5 + 512 * sizeof (short) / sizeof (int) + 160, + 5 + 512 * sizeof (short) / sizeof (int) + 176, + 5 + 512 * sizeof (short) / sizeof (int) + 192, + 5 + 512 * sizeof (short) / sizeof (int) + 208, + 5 + 512 * sizeof (short) / sizeof (int) + 224, + 5 + 512 * sizeof (short) / sizeof (int) + 240, + 5 + 512 * sizeof (short) / sizeof (int) + 256, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 272, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 288, + 5 + 512 * sizeof (short) / sizeof (int) + 304, + 5 + 512 * sizeof (short) / sizeof (int) + 320, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 352, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 368, + 5 + 512 * sizeof (short) / sizeof (int) + 384, + 5 + 512 * sizeof (short) / sizeof (int) + 400, + 5 + 512 * sizeof (short) / sizeof (int) + 416, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 432, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 448, + 5 + 512 * sizeof (short) / sizeof (int) + 464, + 5 + 512 * sizeof (short) / sizeof (int) + 480, + 5 + 512 * sizeof (short) / sizeof (int) + 496, + 5 + 512 * sizeof (short) / sizeof (int) + 512, + 5 + 512 * sizeof (short) / sizeof (int) + 528, + 5 + 512 * sizeof (short) / sizeof (int) + 544, + 5 + 512 * sizeof (short) / sizeof (int) + 560, + 5 + 512 * sizeof (short) / sizeof (int) + 576, + 5 + 512 * sizeof (short) / sizeof (int) + 592, + 5 + 512 * sizeof (short) / sizeof (int) + 608, + 5 + 512 * sizeof (short) / sizeof (int) + 624, + 5 + 512 * sizeof (short) / sizeof (int) + 640, + 5 + 512 * sizeof (short) / sizeof (int) + 656, + 5 + 512 * sizeof (short) / sizeof (int) + 672, + 5 + 512 * sizeof (short) / sizeof (int) + 688, + 5 + 512 * sizeof (short) / sizeof (int) + 704, + 5 + 512 * sizeof (short) / sizeof (int) + 720, + 5 + 512 * sizeof (short) / sizeof (int) + 736, + 5 + 512 * sizeof (short) / sizeof (int) + 752, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 768, + 5 + 512 * sizeof (short) / sizeof (int) + 784, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 800, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 816, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 832, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 848, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 864, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 880, + 5 + 512 * sizeof (short) / sizeof (int) + 896, + 5 + 512 * sizeof (short) / sizeof (int) + 912, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 928, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 944, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 960, + 5 + 512 * sizeof (short) / sizeof (int) + 976, + 5 + 512 * sizeof (short) / sizeof (int) + 992, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1008, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1024, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1040, + 5 + 512 * sizeof (short) / sizeof (int) + 1056, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1072, + 5 + 512 * sizeof (short) / sizeof (int) + 1088, + 5 + 512 * sizeof (short) / sizeof (int) + 1104, + 5 + 512 * sizeof (short) / sizeof (int) + 1120, + 5 + 512 * sizeof (short) / sizeof (int) + 1136, + 5 + 512 * sizeof (short) / sizeof (int) + 1152, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1168, + 5 + 512 * sizeof (short) / sizeof (int) + 1184, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1200, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1216, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1232, + 5 + 512 * sizeof (short) / sizeof (int) + 1248, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1264, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1280, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1296, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1312, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1328, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1344, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000000U, 0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU, + 0x00000000U, 0x04200400U, 0xFF7FFFFFU, 0xFF7FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0003FFC3U, 0x0000501FU, + 0x00000000U, 0x00000000U, 0x00000020U, 0xBCDF0000U, + 0xFFFFD740U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFBFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFC03U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFEFFFFU, 0x027FFFFFU, 0xFFFFFFFFU, + 0x000001FFU, 0x00000000U, 0xFFFF0000U, 0x000787FFU, + 0x00000000U, 0xFFFFFFFFU, 0x000007FFU, 0xFFFEC3FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x002FFFFFU, 0x9FFFC060U, + 0xFFFD0000U, 0x0000FFFFU, 0xFFFFE000U, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0002003FU, 0xFFFFFFFFU, 0x043007FFU, + 0x043FFFFFU, 0x00000110U, 0x01FFFFFFU, 0xFFFF07FFU, + 0x00007EFFU, 0xFFFFFFFFU, 0x000003FFU, 0x00000000U, + 0xFFFFFFF0U, 0x23FFFFFFU, 0xFF010000U, 0xFFFEFFC3U, + 0xFFF99FE1U, 0x23C5FDFFU, 0xB0004000U, 0x1003FFC3U, + 0xFFF987E0U, 0x036DFDFFU, 0x5E000000U, 0x001CFFC0U, + 0xFFFBBFE0U, 0x23EDFDFFU, 0x00010000U, 0x0200FFC3U, + 0xFFF99FE0U, 0x23EDFDFFU, 0xB0000000U, 0x0002FFC3U, + 0xD63DC7E8U, 0x03FFC718U, 0x00010000U, 0x0000FFC0U, + 0xFFFDDFE0U, 0x23FFFDFFU, 0x27000000U, 0x0000FFC3U, + 0xFFFDDFE1U, 0x23EFFDFFU, 0x60000000U, 0x0006FFC3U, + 0xFFFDDFF0U, 0x27FFFFFFU, 0x80704000U, 0xFC00FFC3U, + 0xFC7FFFE0U, 0x2FFBFFFFU, 0x0000007FU, 0x0000FFC0U, + 0xFFFFFFFEU, 0x07FF7FFFU, 0x03FF7FBFU, 0x00000000U, + 0xFFFFF7D6U, 0x200DFFAFU, 0xF3FF005FU, 0x00000000U, + 0x00000001U, 0x000003FFU, 0xFFFFFEFFU, 0x00001FFFU, + 0x00001F00U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x800007FFU, 0x3C3F03FFU, 0xFFE1C062U, + 0x03FF4003U, 0xFFFFFFFFU, 0xFFFF20BFU, 0xF7FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU, + 0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU, + 0xFF3DFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, 0x00000000U, + 0x0000FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU, + 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF9FFFU, + 0x07FFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFC7FFU, + 0x8003FFFFU, 0x0003FFFFU, 0x0003FFFFU, 0x0001DFFFU, + 0xFFFFFFFFU, 0x000FFFFFU, 0x10800000U, 0x000003FFU, + 0x03FF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU, + 0xFFFFFF9FU, 0xFFFF05FFU, 0xFFFFFFFFU, 0x003FFFFFU, + 0x7FFFFFFFU, 0x00000000U, 0xFFFFFFC0U, 0x001F3FFFU, + 0xFFFFFFFFU, 0xFFFF0FFFU, 0x03FF03FFU, 0x00000000U, + 0x007FFFFFU, 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, + 0x03FF03FFU, 0x00000080U, 0x00000000U, 0x00000000U, + 0xFFFFFFE0U, 0x000FFFFFU, 0x03FF1FE0U, 0x00000000U, + 0xFFFFFFF8U, 0xFFFFC001U, 0xFFFFFFFFU, 0x0000003FU, + 0xFFFFFFFFU, 0x0000000FU, 0xFFFFE3FFU, 0x3FFFFFFFU, + 0xFFFF07FFU, 0xE7FFFFFFU, 0x00000000U, 0x046FDE00U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU, + 0xFFFFFFFFU, 0x5FDFFFFFU, 0x0FCF1FDCU, 0x1FDC1FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x80020000U, + 0x1FFF0000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x3E2FFC84U, 0xF3FFBF50U, 0x000043E0U, 0xFFFFFFFFU, + 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xF0000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000003FFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000C781FU, + 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x000080FFU, + 0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0x00000000U, + 0x00000000U, 0x00008000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x000000E0U, 0x1F3E03FEU, 0xFFFFFFFEU, 0xFFFFFFFFU, + 0xE07FFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, 0xF7FFFFFFU, + 0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00007FFFU, 0xFFFFFFFFU, 0x00000000U, 0xFFFF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00001FFFU, 0x00000000U, 0xFFFF0000U, 0x3FFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFF1FFFU, 0x00000FFFU, 0xFFFFFFFFU, 0x80007FFFU, + 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, + 0xFF800000U, 0xFFFFFFFCU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFF9FFU, 0xFFFFFFFFU, 0x1FEB3FFFU, 0xFFFC0000U, + 0xFFFFF7BBU, 0x00000007U, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFCU, 0x000FFFFFU, 0x03FF0000U, 0x68FC0000U, + 0xFFFFFFFFU, 0xFFFF003FU, 0x0000007FU, 0x1FFFFFFFU, + 0xFFFFFFF0U, 0x0007FFFFU, 0x03FF8000U, 0x7FFFFFDFU, + 0xFFFFFFFFU, 0x000001FFU, 0x03FF0FF7U, 0xC47FFFFFU, + 0xFFFFFFFFU, 0x3E62FFFFU, 0x38000005U, 0x001C07FFU, + 0x007E7E7EU, 0xFFFF7F7FU, 0xF7FFFFFFU, 0xFFFF03FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF0007U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U, + 0xA0F8007FU, 0x5F7FFDFFU, 0xFFFFFFDBU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0003FFFFU, 0xFFF80000U, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF0000U, 0xFFFFFFFFU, + 0xFFFCFFFFU, 0xFFFFFFFFU, 0x000000FFU, 0x0FFF0000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFFDF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU, + 0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU, 0xFFFFFFC0U, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x00000000U, + 0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x001FFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFE000U, 0xFFFF07FFU, 0x003FFFFFU, + 0x3FFFFFFFU, 0xFFFFFFFFU, 0x003EFF0FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU, + 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF000FU, + 0xFFB7F7FFU, 0x1BFBFFFBU, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU, + 0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFD3FU, 0x91BFFFFFU, 0x003FFFFFU, 0x007FFFFFU, + 0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x0037FFFFU, + 0x003FFFFFU, 0x03FFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xC0FFFFFFU, 0x00000000U, 0x00000000U, + 0xFEEF0001U, 0x003FFFFFU, 0x00000000U, 0x1FFFFFFFU, + 0x1FFFFFFFU, 0x00000000U, 0xFFFFFEFFU, 0x0000001FU, + 0xFFFFFFFFU, 0x003FFFFFU, 0x003FFFFFU, 0x0007FFFFU, + 0x0003FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U, + 0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0x0007FFFFU, + 0xFFFFFFFFU, 0x03FF000FU, 0xFFFFFFFFU, 0xFFFF803FU, + 0x0000003FU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x000303FFU, 0x0000001CU, 0x00000000U, + 0x1FFFFFFFU, 0xFFFF0080U, 0x0000003FU, 0xFFFF0000U, + 0x00000003U, 0xFFFF0000U, 0x0000001FU, 0x007FFFFFU, + 0xFFFFFFF8U, 0x00FFFFFFU, 0x00000000U, 0x0026FFC0U, + 0xFFFFFFF8U, 0x0000FFFFU, 0xFFFF0000U, 0x03FF01FFU, + 0xFFFFFFF8U, 0xFFC0007FU, 0xFFFF0090U, 0x0047FFFFU, + 0xFFFFFFF8U, 0x0007FFFFU, 0x17FF001EU, 0x00000000U, + 0xFFFBFFFFU, 0x80000FFFU, 0x00000001U, 0x00000000U, + 0xBFFFBD7FU, 0xFFFF01FFU, 0x7FFFFFFFU, 0x03FF0000U, + 0xFFF99FE0U, 0x23EDFDFFU, 0xE0010000U, 0x00000003U, + 0xFFFF4BFFU, 0x00BFFFFFU, 0x000A0000U, 0x00000000U, + 0xFFFFFFFFU, 0x001FFFFFU, 0x83FF0780U, 0x00000003U, + 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF00B0U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x00007FFFU, 0x0F000000U, 0x00000000U, + 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF0010U, 0x00000000U, + 0xFFFFFFFFU, 0x010007FFU, 0xFFFF03FFU, 0x0000000FU, + 0x07FFFFFFU, 0x03FF0000U, 0x0000007FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x00000FFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800003FFU, + 0xFF6FF27FU, 0x8000FFFFU, 0x03FF0002U, 0x00000000U, + 0x00000000U, 0xFFFFFCFFU, 0x0001FFFFU, 0x0000000AU, + 0xFFFFF801U, 0x0407FFFFU, 0xF0010000U, 0xFFFFFFFFU, + 0x200003FFU, 0xFFFF0000U, 0xFFFFFFFFU, 0x01FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0001U, + 0xFFFFFDFFU, 0x00007FFFU, 0x03FF0001U, 0xFFFC0000U, + 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFB7FU, 0x0001FFFFU, 0x03FF0040U, 0xFFFFFDBFU, + 0x010003FFU, 0x000003FFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0007FFFFU, + 0xFFFDFFF4U, 0x000FFFFFU, 0x03FF0000U, 0x00000000U, + 0x00000000U, 0x00010000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00007FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, + 0xFFFFFFFFU, 0x0000FFFFU, 0x0000007EU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x3FFFFFFFU, 0x03FF0000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x00003FFFU, + 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF000FU, 0xE0FFFFF8U, + 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF1FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000107FFU, 0x00000000U, + 0xFFF80000U, 0x00000000U, 0x00000000U, 0x0000000BU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U, + 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU, + 0x03FF01FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFC00000U, 0x03FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU, + 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU, + 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFF3FU, 0xF7FFFFFDU, 0xF7FFFFFFU, + 0xFFDFFFFFU, 0xFFDFFFFFU, 0xFFFF7FFFU, 0xFFFF7FFFU, + 0xFFFFFDFFU, 0xFFFFFDFFU, 0xFFFFCFF7U, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00003FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x3F801FFFU, 0x000043FFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0x00003FFFU, 0xFFFFFFFFU, 0x03FF0FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FF0FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x07FF3FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000001FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF080FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U, + 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0xFFFF1FFFU, 0xFFFF03FFU, 0xFFFF03FFU, + 0x000007FFU, 0x00000020U, 0x00000000U, 0xFFFFFFC0U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x03FF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_alpha table. */ +#include "ctype_alpha.h" + +bool +uc_is_alpha (ucs4_t uc) +{ + return bitmap_lookup (&u_is_alpha, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[4]; + short level2[4 << 7]; + unsigned int level3[85 << 4]; + } +u_is_alpha = +{ + { 4 }, + { + 5 * sizeof (int) / sizeof (short) + 0, + 5 * sizeof (int) / sizeof (short) + 128, + 5 * sizeof (int) / sizeof (short) + 256, + 5 * sizeof (int) / sizeof (short) + 384 + }, + { + 5 + 512 * sizeof (short) / sizeof (int) + 0, + 5 + 512 * sizeof (short) / sizeof (int) + 16, + 5 + 512 * sizeof (short) / sizeof (int) + 32, + 5 + 512 * sizeof (short) / sizeof (int) + 48, + 5 + 512 * sizeof (short) / sizeof (int) + 64, + 5 + 512 * sizeof (short) / sizeof (int) + 80, + 5 + 512 * sizeof (short) / sizeof (int) + 96, + 5 + 512 * sizeof (short) / sizeof (int) + 112, + 5 + 512 * sizeof (short) / sizeof (int) + 128, + 5 + 512 * sizeof (short) / sizeof (int) + 144, + 5 + 512 * sizeof (short) / sizeof (int) + 160, + 5 + 512 * sizeof (short) / sizeof (int) + 176, + 5 + 512 * sizeof (short) / sizeof (int) + 192, + 5 + 512 * sizeof (short) / sizeof (int) + 208, + 5 + 512 * sizeof (short) / sizeof (int) + 224, + 5 + 512 * sizeof (short) / sizeof (int) + 240, + 5 + 512 * sizeof (short) / sizeof (int) + 256, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 272, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 288, + 5 + 512 * sizeof (short) / sizeof (int) + 304, + 5 + 512 * sizeof (short) / sizeof (int) + 320, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 352, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 368, + 5 + 512 * sizeof (short) / sizeof (int) + 384, + 5 + 512 * sizeof (short) / sizeof (int) + 400, + 5 + 512 * sizeof (short) / sizeof (int) + 416, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 432, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 448, + 5 + 512 * sizeof (short) / sizeof (int) + 464, + 5 + 512 * sizeof (short) / sizeof (int) + 480, + 5 + 512 * sizeof (short) / sizeof (int) + 496, + 5 + 512 * sizeof (short) / sizeof (int) + 512, + 5 + 512 * sizeof (short) / sizeof (int) + 528, + 5 + 512 * sizeof (short) / sizeof (int) + 544, + 5 + 512 * sizeof (short) / sizeof (int) + 560, + 5 + 512 * sizeof (short) / sizeof (int) + 576, + 5 + 512 * sizeof (short) / sizeof (int) + 592, + 5 + 512 * sizeof (short) / sizeof (int) + 608, + 5 + 512 * sizeof (short) / sizeof (int) + 624, + 5 + 512 * sizeof (short) / sizeof (int) + 640, + 5 + 512 * sizeof (short) / sizeof (int) + 656, + 5 + 512 * sizeof (short) / sizeof (int) + 672, + 5 + 512 * sizeof (short) / sizeof (int) + 688, + 5 + 512 * sizeof (short) / sizeof (int) + 704, + 5 + 512 * sizeof (short) / sizeof (int) + 720, + 5 + 512 * sizeof (short) / sizeof (int) + 736, + 5 + 512 * sizeof (short) / sizeof (int) + 752, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 768, + 5 + 512 * sizeof (short) / sizeof (int) + 784, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 800, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 816, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 832, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 848, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 864, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 880, + 5 + 512 * sizeof (short) / sizeof (int) + 896, + 5 + 512 * sizeof (short) / sizeof (int) + 912, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 928, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 944, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 960, + 5 + 512 * sizeof (short) / sizeof (int) + 976, + 5 + 512 * sizeof (short) / sizeof (int) + 992, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1008, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1024, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1040, + 5 + 512 * sizeof (short) / sizeof (int) + 1056, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1072, + 5 + 512 * sizeof (short) / sizeof (int) + 1088, + 5 + 512 * sizeof (short) / sizeof (int) + 1104, + 5 + 512 * sizeof (short) / sizeof (int) + 1120, + 5 + 512 * sizeof (short) / sizeof (int) + 1136, + 5 + 512 * sizeof (short) / sizeof (int) + 1152, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1168, + 5 + 512 * sizeof (short) / sizeof (int) + 1184, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 1200, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1216, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1232, + 5 + 512 * sizeof (short) / sizeof (int) + 1248, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1264, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1280, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1296, + -1, + -1, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1312, + -1, + -1, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1328, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 336, + 5 + 512 * sizeof (short) / sizeof (int) + 1344, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x07FFFFFEU, + 0x00000000U, 0x04200400U, 0xFF7FFFFFU, 0xFF7FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0003FFC3U, 0x0000501FU, + 0x00000000U, 0x00000000U, 0x00000020U, 0xBCDF0000U, + 0xFFFFD740U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFBFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFC03U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFEFFFFU, 0x027FFFFFU, 0xFFFFFFFFU, + 0x000001FFU, 0x00000000U, 0xFFFF0000U, 0x000787FFU, + 0x00000000U, 0xFFFFFFFFU, 0x000007FFU, 0xFFFEC3FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x002FFFFFU, 0x9FFFC060U, + 0xFFFD0000U, 0x0000FFFFU, 0xFFFFE000U, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0002003FU, 0xFFFFFFFFU, 0x043007FFU, + 0x043FFFFFU, 0x00000110U, 0x01FFFFFFU, 0xFFFF07FFU, + 0x00007EFFU, 0xFFFFFFFFU, 0x000003FFU, 0x00000000U, + 0xFFFFFFF0U, 0x23FFFFFFU, 0xFF010000U, 0xFFFEFFC3U, + 0xFFF99FE1U, 0x23C5FDFFU, 0xB0004000U, 0x1003FFC3U, + 0xFFF987E0U, 0x036DFDFFU, 0x5E000000U, 0x001CFFC0U, + 0xFFFBBFE0U, 0x23EDFDFFU, 0x00010000U, 0x0200FFC3U, + 0xFFF99FE0U, 0x23EDFDFFU, 0xB0000000U, 0x0002FFC3U, + 0xD63DC7E8U, 0x03FFC718U, 0x00010000U, 0x0000FFC0U, + 0xFFFDDFE0U, 0x23FFFDFFU, 0x27000000U, 0x0000FFC3U, + 0xFFFDDFE1U, 0x23EFFDFFU, 0x60000000U, 0x0006FFC3U, + 0xFFFDDFF0U, 0x27FFFFFFU, 0x80704000U, 0xFC00FFC3U, + 0xFC7FFFE0U, 0x2FFBFFFFU, 0x0000007FU, 0x0000FFC0U, + 0xFFFFFFFEU, 0x07FF7FFFU, 0x03FF7FBFU, 0x00000000U, + 0xFFFFF7D6U, 0x200DFFAFU, 0xF3FF005FU, 0x00000000U, + 0x00000001U, 0x000003FFU, 0xFFFFFEFFU, 0x00001FFFU, + 0x00001F00U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x800007FFU, 0x3C3F03FFU, 0xFFE1C062U, + 0x03FF4003U, 0xFFFFFFFFU, 0xFFFF20BFU, 0xF7FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU, + 0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU, + 0xFF3DFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, 0x00000000U, + 0x0000FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU, + 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF9FFFU, + 0x07FFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFC7FFU, + 0x8003FFFFU, 0x0003FFFFU, 0x0003FFFFU, 0x0001DFFFU, + 0xFFFFFFFFU, 0x000FFFFFU, 0x10800000U, 0x000003FFU, + 0x03FF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU, + 0xFFFFFF9FU, 0xFFFF05FFU, 0xFFFFFFFFU, 0x003FFFFFU, + 0x7FFFFFFFU, 0x00000000U, 0xFFFFFFC0U, 0x001F3FFFU, + 0xFFFFFFFFU, 0xFFFF0FFFU, 0x03FF03FFU, 0x00000000U, + 0x007FFFFFU, 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, + 0x03FF03FFU, 0x00000080U, 0x00000000U, 0x00000000U, + 0xFFFFFFE0U, 0x000FFFFFU, 0x03FF1FE0U, 0x00000000U, + 0xFFFFFFF8U, 0xFFFFC001U, 0xFFFFFFFFU, 0x0000003FU, + 0xFFFFFFFFU, 0x0000000FU, 0xFFFFE3FFU, 0x3FFFFFFFU, + 0xFFFF07FFU, 0xE7FFFFFFU, 0x00000000U, 0x046FDE00U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU, + 0xFFFFFFFFU, 0x5FDFFFFFU, 0x0FCF1FDCU, 0x1FDC1FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x80020000U, + 0x1FFF0000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x3E2FFC84U, 0xF3FFBF50U, 0x000043E0U, 0xFFFFFFFFU, + 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xF0000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000003FFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000C781FU, + 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x000080FFU, + 0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0x00000000U, + 0x00000000U, 0x00008000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x000000E0U, 0x1F3E03FEU, 0xFFFFFFFEU, 0xFFFFFFFFU, + 0xE07FFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, 0xF7FFFFFFU, + 0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00007FFFU, 0xFFFFFFFFU, 0x00000000U, 0xFFFF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00001FFFU, 0x00000000U, 0xFFFF0000U, 0x3FFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFF1FFFU, 0x00000FFFU, 0xFFFFFFFFU, 0x80007FFFU, + 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, + 0xFF800000U, 0xFFFFFFFCU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFF9FFU, 0xFFFFFFFFU, 0x1FEB3FFFU, 0xFFFC0000U, + 0xFFFFF7BBU, 0x00000007U, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFCU, 0x000FFFFFU, 0x03FF0000U, 0x68FC0000U, + 0xFFFFFFFFU, 0xFFFF003FU, 0x0000007FU, 0x1FFFFFFFU, + 0xFFFFFFF0U, 0x0007FFFFU, 0x03FF8000U, 0x7FFFFFDFU, + 0xFFFFFFFFU, 0x000001FFU, 0x03FF0FF7U, 0xC47FFFFFU, + 0xFFFFFFFFU, 0x3E62FFFFU, 0x38000005U, 0x001C07FFU, + 0x007E7E7EU, 0xFFFF7F7FU, 0xF7FFFFFFU, 0xFFFF03FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF0007U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U, + 0xA0F8007FU, 0x5F7FFDFFU, 0xFFFFFFDBU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0003FFFFU, 0xFFF80000U, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF0000U, 0xFFFFFFFFU, + 0xFFFCFFFFU, 0xFFFFFFFFU, 0x000000FFU, 0x0FFF0000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFFDF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU, + 0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU, 0xFFFFFFC0U, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x00000000U, + 0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x001FFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFE000U, 0xFFFF07FFU, 0x003FFFFFU, + 0x3FFFFFFFU, 0xFFFFFFFFU, 0x003EFF0FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU, + 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF000FU, + 0xFFB7F7FFU, 0x1BFBFFFBU, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU, + 0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFD3FU, 0x91BFFFFFU, 0x003FFFFFU, 0x007FFFFFU, + 0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x0037FFFFU, + 0x003FFFFFU, 0x03FFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xC0FFFFFFU, 0x00000000U, 0x00000000U, + 0xFEEF0001U, 0x003FFFFFU, 0x00000000U, 0x1FFFFFFFU, + 0x1FFFFFFFU, 0x00000000U, 0xFFFFFEFFU, 0x0000001FU, + 0xFFFFFFFFU, 0x003FFFFFU, 0x003FFFFFU, 0x0007FFFFU, + 0x0003FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U, + 0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0x0007FFFFU, + 0xFFFFFFFFU, 0x03FF000FU, 0xFFFFFFFFU, 0xFFFF803FU, + 0x0000003FU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x000303FFU, 0x0000001CU, 0x00000000U, + 0x1FFFFFFFU, 0xFFFF0080U, 0x0000003FU, 0xFFFF0000U, + 0x00000003U, 0xFFFF0000U, 0x0000001FU, 0x007FFFFFU, + 0xFFFFFFF8U, 0x00FFFFFFU, 0x00000000U, 0x0026FFC0U, + 0xFFFFFFF8U, 0x0000FFFFU, 0xFFFF0000U, 0x03FF01FFU, + 0xFFFFFFF8U, 0xFFC0007FU, 0xFFFF0090U, 0x0047FFFFU, + 0xFFFFFFF8U, 0x0007FFFFU, 0x17FF001EU, 0x00000000U, + 0xFFFBFFFFU, 0x80000FFFU, 0x00000001U, 0x00000000U, + 0xBFFFBD7FU, 0xFFFF01FFU, 0x7FFFFFFFU, 0x03FF0000U, + 0xFFF99FE0U, 0x23EDFDFFU, 0xE0010000U, 0x00000003U, + 0xFFFF4BFFU, 0x00BFFFFFU, 0x000A0000U, 0x00000000U, + 0xFFFFFFFFU, 0x001FFFFFU, 0x83FF0780U, 0x00000003U, + 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF00B0U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x00007FFFU, 0x0F000000U, 0x00000000U, + 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF0010U, 0x00000000U, + 0xFFFFFFFFU, 0x010007FFU, 0xFFFF03FFU, 0x0000000FU, + 0x07FFFFFFU, 0x03FF0000U, 0x0000007FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x00000FFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800003FFU, + 0xFF6FF27FU, 0x8000FFFFU, 0x03FF0002U, 0x00000000U, + 0x00000000U, 0xFFFFFCFFU, 0x0001FFFFU, 0x0000000AU, + 0xFFFFF801U, 0x0407FFFFU, 0xF0010000U, 0xFFFFFFFFU, + 0x200003FFU, 0xFFFF0000U, 0xFFFFFFFFU, 0x01FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0001U, + 0xFFFFFDFFU, 0x00007FFFU, 0x03FF0001U, 0xFFFC0000U, + 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFB7FU, 0x0001FFFFU, 0x03FF0040U, 0xFFFFFDBFU, + 0x010003FFU, 0x000003FFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0007FFFFU, + 0xFFFDFFF4U, 0x000FFFFFU, 0x03FF0000U, 0x00000000U, + 0x00000000U, 0x00010000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00007FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, + 0xFFFFFFFFU, 0x0000FFFFU, 0x0000007EU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x3FFFFFFFU, 0x03FF0000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x00003FFFU, + 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF000FU, 0xE0FFFFF8U, + 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF1FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000107FFU, 0x00000000U, + 0xFFF80000U, 0x00000000U, 0x00000000U, 0x0000000BU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U, + 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU, + 0x03FF01FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFC00000U, 0x03FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU, + 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU, + 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFF3FU, 0xF7FFFFFDU, 0xF7FFFFFFU, + 0xFFDFFFFFU, 0xFFDFFFFFU, 0xFFFF7FFFU, 0xFFFF7FFFU, + 0xFFFFFDFFU, 0xFFFFFDFFU, 0xFFFFCFF7U, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00003FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x3F801FFFU, 0x000043FFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0x00003FFFU, 0xFFFFFFFFU, 0x03FF0FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FF0FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x07FF3FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000001FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF080FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U, + 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0xFFFF1FFFU, 0xFFFF03FFU, 0xFFFF03FFU, + 0x000007FFU, 0x00000020U, 0x00000000U, 0xFFFFFFC0U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x03FF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_blank table. */ +#include "ctype_blank.h" + +bool +uc_is_blank (ucs4_t uc) +{ + return bitmap_lookup (&u_is_blank, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[1]; + short level2[1 << 7]; + unsigned int level3[4 << 4]; + } +u_is_blank = +{ + { 1 }, + { 2 * sizeof (int) / sizeof (short) + 0 }, + { + 2 + 128 * sizeof (short) / sizeof (int) + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 2 + 128 * sizeof (short) / sizeof (int) + 16, + -1, + -1, + -1, + -1, + 2 + 128 * sizeof (short) / sizeof (int) + 32, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 2 + 128 * sizeof (short) / sizeof (int) + 48, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000200U, 0x00000001U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x0000077FU, 0x00000000U, 0x80000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_cntrl table. */ +#include "ctype_cntrl.h" + +bool +uc_is_cntrl (ucs4_t uc) +{ + return bitmap_lookup (&u_is_cntrl, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[1]; + short level2[1 << 7]; + unsigned int level3[2 << 4]; + } +u_is_cntrl = +{ + { 1 }, + { 2 * sizeof (int) / sizeof (short) + 0 }, + { + 2 + 128 * sizeof (short) / sizeof (int) + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 2 + 128 * sizeof (short) / sizeof (int) + 16, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0xFFFFFFFFU, 0x00000000U, 0x00000000U, 0x80000000U, + 0xFFFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000300U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_digit table. */ +#include "ctype_digit.h" + +bool +uc_is_digit (ucs4_t uc) +{ + return bitmap_lookup (&u_is_digit, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[1]; + short level2[1 << 7]; + unsigned int level3[1 << 4]; + } +u_is_digit = +{ + { 1 }, + { 2 * sizeof (int) / sizeof (short) + 0 }, + { + 2 + 128 * sizeof (short) / sizeof (int) + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000000U, 0x03FF0000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_graph table. */ +#include "ctype_graph.h" + +bool +uc_is_graph (ucs4_t uc) +{ + return bitmap_lookup (&u_is_graph, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[17]; + short level2[6 << 7]; + unsigned int level3[94 << 4]; + } +u_is_graph = +{ + { 17 }, + { + 18 * sizeof (int) / sizeof (short) + 0, + 18 * sizeof (int) / sizeof (short) + 128, + 18 * sizeof (int) / sizeof (short) + 256, + 18 * sizeof (int) / sizeof (short) + 384, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 * sizeof (int) / sizeof (short) + 512, + 18 * sizeof (int) / sizeof (short) + 640, + 18 * sizeof (int) / sizeof (short) + 640 + }, + { + 18 + 768 * sizeof (short) / sizeof (int) + 0, + 18 + 768 * sizeof (short) / sizeof (int) + 16, + 18 + 768 * sizeof (short) / sizeof (int) + 32, + 18 + 768 * sizeof (short) / sizeof (int) + 48, + 18 + 768 * sizeof (short) / sizeof (int) + 64, + 18 + 768 * sizeof (short) / sizeof (int) + 80, + 18 + 768 * sizeof (short) / sizeof (int) + 96, + 18 + 768 * sizeof (short) / sizeof (int) + 112, + 18 + 768 * sizeof (short) / sizeof (int) + 128, + 18 + 768 * sizeof (short) / sizeof (int) + 144, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 176, + 18 + 768 * sizeof (short) / sizeof (int) + 192, + 18 + 768 * sizeof (short) / sizeof (int) + 208, + 18 + 768 * sizeof (short) / sizeof (int) + 224, + 18 + 768 * sizeof (short) / sizeof (int) + 240, + 18 + 768 * sizeof (short) / sizeof (int) + 256, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 272, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 288, + 18 + 768 * sizeof (short) / sizeof (int) + 304, + 18 + 768 * sizeof (short) / sizeof (int) + 320, + 18 + 768 * sizeof (short) / sizeof (int) + 336, + 18 + 768 * sizeof (short) / sizeof (int) + 352, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 368, + 18 + 768 * sizeof (short) / sizeof (int) + 384, + 18 + 768 * sizeof (short) / sizeof (int) + 400, + 18 + 768 * sizeof (short) / sizeof (int) + 416, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 432, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 448, + 18 + 768 * sizeof (short) / sizeof (int) + 464, + 18 + 768 * sizeof (short) / sizeof (int) + 480, + 18 + 768 * sizeof (short) / sizeof (int) + 496, + 18 + 768 * sizeof (short) / sizeof (int) + 512, + 18 + 768 * sizeof (short) / sizeof (int) + 528, + 18 + 768 * sizeof (short) / sizeof (int) + 544, + 18 + 768 * sizeof (short) / sizeof (int) + 560, + 18 + 768 * sizeof (short) / sizeof (int) + 576, + 18 + 768 * sizeof (short) / sizeof (int) + 592, + 18 + 768 * sizeof (short) / sizeof (int) + 608, + 18 + 768 * sizeof (short) / sizeof (int) + 624, + 18 + 768 * sizeof (short) / sizeof (int) + 640, + 18 + 768 * sizeof (short) / sizeof (int) + 656, + 18 + 768 * sizeof (short) / sizeof (int) + 672, + 18 + 768 * sizeof (short) / sizeof (int) + 688, + 18 + 768 * sizeof (short) / sizeof (int) + 704, + 18 + 768 * sizeof (short) / sizeof (int) + 720, + 18 + 768 * sizeof (short) / sizeof (int) + 736, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 752, + 18 + 768 * sizeof (short) / sizeof (int) + 768, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 784, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 800, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 816, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 832, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 848, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 864, + 18 + 768 * sizeof (short) / sizeof (int) + 880, + 18 + 768 * sizeof (short) / sizeof (int) + 896, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 912, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 928, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 944, + 18 + 768 * sizeof (short) / sizeof (int) + 960, + 18 + 768 * sizeof (short) / sizeof (int) + 976, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 992, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 1008, + 18 + 768 * sizeof (short) / sizeof (int) + 1024, + 18 + 768 * sizeof (short) / sizeof (int) + 1040, + 18 + 768 * sizeof (short) / sizeof (int) + 1056, + 18 + 768 * sizeof (short) / sizeof (int) + 1072, + 18 + 768 * sizeof (short) / sizeof (int) + 1088, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1104, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 1120, + 18 + 768 * sizeof (short) / sizeof (int) + 1136, + 18 + 768 * sizeof (short) / sizeof (int) + 1152, + 18 + 768 * sizeof (short) / sizeof (int) + 1168, + 18 + 768 * sizeof (short) / sizeof (int) + 1184, + 18 + 768 * sizeof (short) / sizeof (int) + 1200, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 1216, + 18 + 768 * sizeof (short) / sizeof (int) + 1232, + 18 + 768 * sizeof (short) / sizeof (int) + 1248, + 18 + 768 * sizeof (short) / sizeof (int) + 1264, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1280, + 18 + 768 * sizeof (short) / sizeof (int) + 1296, + 18 + 768 * sizeof (short) / sizeof (int) + 1312, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1328, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1344, + 18 + 768 * sizeof (short) / sizeof (int) + 1360, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1376, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1392, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1408, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1424, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1440, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1456, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 1472, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1488 + }, + { + 0x00000000U, 0xFFFFFFFEU, 0xFFFFFFFFU, 0x7FFFFFFFU, + 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFCFFFFFFU, + 0xFFFFD7F0U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFEFFFFU, 0xFE7FFFFFU, 0xFFFFFFFFU, + 0xFFFEE7FFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0x001F87FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFBFFFU, 0xFFFFFFFFU, 0xFFFFE7FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0003FFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU, + 0xFFFFFFFFU, 0x7FFF3FFFU, 0x4FFFFFFFU, 0xFFFF07FFU, + 0xFF837FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFF99FEFU, 0xF3C5FDFFU, 0xB080799FU, 0x7FFFFFCFU, + 0xFFF987EEU, 0xD36DFDFFU, 0x5E023987U, 0x007FFFC0U, + 0xFFFBBFEEU, 0xF3EDFDFFU, 0x00013BBFU, 0xFE03FFCFU, + 0xFFF99FEEU, 0xF3EDFDFFU, 0xB0E0399FU, 0x00FFFFCFU, + 0xD63DC7ECU, 0xC3FFC718U, 0x00813DC7U, 0x07FFFFC0U, + 0xFFFDDFFFU, 0xF3FFFDFFU, 0x27603DDFU, 0xFF80FFCFU, + 0xFFFDDFFFU, 0xF3EFFDFFU, 0x60603DDFU, 0x000EFFCFU, + 0xFFFDDFFFU, 0xFFFFFFFFU, 0xFFF0FDDFU, 0xFFFFFFCFU, + 0xFC7FFFEEU, 0x2FFBFFFFU, 0xFF5F847FU, 0x001CFFC0U, + 0xFFFFFFFEU, 0x87FFFFFFU, 0x0FFFFFFFU, 0x00000000U, + 0xFFFFF7D6U, 0x3FFFFFAFU, 0xF3FF7F5FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFEFFU, 0xFFFE1FFFU, + 0xFEFFFFFFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU, + 0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU, + 0xFF3DFFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU, 0x1FFFFFFFU, + 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x1FFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU, + 0x803FFFFFU, 0x007FFFFFU, 0x000FFFFFU, 0x000DDFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x03FF03FFU, + 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU, + 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, 0x003FFFFFU, + 0x7FFFFFFFU, 0x0FFF0FFFU, 0xFFFFFFF1U, 0x001F3FFFU, + 0xFFFFFFFFU, 0xFFFF0FFFU, 0xC7FF03FFU, 0xFFFFFFFFU, + 0xCFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU, 0x9FFFFFFFU, + 0x03FF03FFU, 0xFFFF3FFFU, 0x00007FFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFDFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF00FFFFFU, + 0xFFFFFFFFU, 0xF8FFFFFFU, 0xFFFFE3FFU, 0xFFFFFFFFU, + 0xFFFF07FFU, 0xE7FFFFFFU, 0xFFFF00FFU, 0x07FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU, + 0xFFFFFFFFU, 0xFFDFFFFFU, 0xEFCFFFDFU, 0x7FDCFFFFU, + 0xFFFFF880U, 0xFFFFFCFFU, 0x7FFFFFFFU, 0xFFF3FFDFU, + 0x1FFF7FFFU, 0xFFFFFFFFU, 0xFFFF0001U, 0x0001FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x000003FFU, 0x000007FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU, + 0xFFBFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFE0FFFFFU, + 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x800180FFU, + 0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U, + 0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFF0000U, + 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, + 0xFE7FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFF7FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF803FU, + 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFF1FFFU, 0xFFFFFFFFU, 0xFFFF007FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00000FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FEB3FFFU, 0xFFFC0000U, + 0xFFFFFFFFU, 0x03FF1FFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFC03FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800FFFFFU, 0x1FFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FFBFFFU, 0x7FFFFFFFU, + 0xFFFFFFFFU, 0x007FFFFFU, 0xF3FF3FFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF8000007U, 0x007FFFFFU, + 0x007E7E7EU, 0xFFFF7F7FU, 0xFFFFFFFFU, 0xFFFF0FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF3FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U, + 0xE0F8007FU, 0x5F7FFFFFU, 0xFFFFFFDBU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFF80007U, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFCFFFFU, 0xFFFFFFFFU, 0x000080FFU, 0xFFFF0000U, + 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0xFFDF0F7FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU, + 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x3E007F7FU, + 0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, + 0xFFFFFF87U, 0xFF8FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x0FFFFFFFU, + 0xFFFFFFFFU, 0xFFFFE00FU, 0xFFFF07FFU, 0x07FFFFFFU, + 0xBFFFFFFFU, 0xFFFFFFFFU, 0x003FFF0FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU, + 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF800FU, + 0xFFB7F7FFU, 0x1BFBFFFBU, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU, + 0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFD3FU, 0x91BFFFFFU, 0xFFBFFFFFU, 0xFFFFFFFFU, + 0x7FFFFFFFU, 0x0000FF80U, 0x00000000U, 0xF837FFFFU, + 0x8FFFFFFFU, 0x83FFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xF0FFFFFFU, 0xFFFCFFFFU, 0xFFFFFFFFU, + 0xFEEFF06FU, 0x873FFFFFU, 0x01FF01FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00000000U, 0xFFFFFFFFU, 0x007FF87FU, + 0xFFFFFFFFU, 0xFE3FFFFFU, 0xFF3FFFFFU, 0xFF07FFFFU, + 0x1E03FFFFU, 0x0000FE00U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U, + 0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0xFC07FFFFU, + 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU, 0xFFFFFE3FU, + 0x0000C03FU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU, + 0xFFFFFFFFU, 0x00033BFFU, 0x0000001CU, 0xF0000000U, + 0xFFFFFFFFU, 0xFFFF00FFU, 0x03FFFFFFU, 0xFFFF0000U, + 0x000003FFU, 0xFFFF0000U, 0x00000FFFU, 0x007FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFC3FFFU, 0x803FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF2007U, 0x03FF01FFU, + 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFF00FFU, 0x007FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001FFFFEU, + 0xFFFBFFFFU, 0xFFFFFFFFU, 0x00000003U, 0x00000000U, + 0xBFFFBD7FU, 0xFFFF03FFU, 0xFFFFFFFFU, 0x03FF07FFU, + 0xFFF99FEFU, 0xFBEDFDFFU, 0xE081399FU, 0x001F1FCFU, + 0xFFFF4BFFU, 0xFFBFFFFFU, 0x01BFF7A5U, 0x00000006U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xEFFFFFFFU, 0x00000003U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFF3FFFFFU, 0x3FFFFFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF001FU, 0x00001FFFU, + 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFF03FFU, 0x0000000FU, + 0xE7FFFFFFU, 0xFFFF0FFFU, 0x0000007FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x0FFFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x8007FFFFU, + 0xFF6FF27FU, 0xF9BFFFFFU, 0x03FF007FU, 0x00000000U, + 0x00000000U, 0xFFFFFCFFU, 0xFCFFFFFFU, 0x0000001FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF0007U, 0xFFFFFFFFU, 0x01FFFFFFU, + 0x000003FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0003U, + 0xFFFFFDFFU, 0xFF7FFFFFU, 0xFFFF003FU, 0xFFFF1FFFU, + 0xFFFCFFFFU, 0x007FFEFFU, 0x00000000U, 0x00000000U, + 0xFFFFFB7FU, 0xB47FFFFFU, 0x03FF00FFU, 0xFFFFFDBFU, + 0x01FB7FFFU, 0x000003FFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x01FFFFFFU, + 0xFFFDFFFFU, 0xC7FFFFFFU, 0x07FFFFFFU, 0x00000000U, + 0x00000000U, 0x00010000U, 0xFFFFFFFFU, 0x8003FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001F7FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFFC3FFU, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x003F3FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFBFF003FU, 0xE0FFFFFBU, + 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x07FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF87FFU, 0xFFFFFFFFU, + 0xFFFF80FFU, 0x00000000U, 0x00000000U, 0x0003001FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U, + 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU, + 0xF3FF01FFU, 0x0000000FU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x000FFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, + 0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU, + 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU, + 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFF3FU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFCFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xF9FFFF7FU, 0xFFFF07DBU, 0xFFFFFFFFU, 0x00003FFFU, + 0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x3FFF1FFFU, 0x0000C3FFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0x00007FFFU, 0xFFFFFFFFU, 0x83FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x87FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFF9FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FF0FFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U, + 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U, + 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00030000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00003FFFU, 0x00000000U, 0xFFFFFFC0U, + 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU, + 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU, + 0xFFFF00FFU, 0x0FFF3FFFU, 0x00000003U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU, + 0xFFFF83FFU, 0xFFFFFFFFU, 0x9FFFC07FU, 0x01FF03FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U, + 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_lower table. */ +#include "ctype_lower.h" + +bool +uc_is_lower (ucs4_t uc) +{ + return bitmap_lookup (&u_is_lower, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[2]; + short level2[2 << 7]; + unsigned int level3[18 << 4]; + } +u_is_lower = +{ + { 2 }, + { + 3 * sizeof (int) / sizeof (short) + 0, + 3 * sizeof (int) / sizeof (short) + 128 + }, + { + 3 + 256 * sizeof (short) / sizeof (int) + 0, + 3 + 256 * sizeof (short) / sizeof (int) + 16, + 3 + 256 * sizeof (short) / sizeof (int) + 32, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 48, + 3 + 256 * sizeof (short) / sizeof (int) + 64, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 80, + 3 + 256 * sizeof (short) / sizeof (int) + 96, + 3 + 256 * sizeof (short) / sizeof (int) + 112, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 128, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 144, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 160, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 176, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 192, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 208, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 224, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 240, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 256, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 272, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000000U, 0x00000000U, 0x00000000U, 0x07FFFFFEU, + 0x00000000U, 0x00200000U, 0x80000000U, 0xFF7FFFFFU, + 0xAAAAAAAAU, 0x54AAAAAAU, 0xAAAAA955U, 0xD4AAAAAAU, + 0x4E241129U, 0xA251212AU, 0xB5555B60U, 0xAA2CAAAAU, + 0xAAAAAAAAU, 0x900AAAA8U, 0x1ADFAA85U, 0x20269F7BU, + 0x60041F8DU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000020U, 0x388A0000U, + 0x00000000U, 0xFFFEF000U, 0xAAE37FFFU, 0x092FAAAAU, + 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0xAAAAAAAAU, + 0xAAAAA802U, 0xAAAAAAAAU, 0xAAAAD554U, 0xAAAAAAAAU, + 0xAAAAAAAAU, 0x0000AAAAU, 0x00000000U, 0xFFFFFFFEU, + 0x0000007FU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0xE7FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x3F000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x000005FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x22000000U, + 0x00004000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, + 0x082AAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, + 0x003F00FFU, 0x00FF00FFU, 0x00AA003FU, 0x3FFF00FFU, + 0x00FF00FFU, 0x400B00FFU, 0x00030008U, 0x00080023U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00004000U, 0xFFFF0000U, + 0x00000010U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x000003FFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00481562U, + 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0x0008500AU, + 0xFFFFFFFFU, 0x000020BFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xAAAAAAAAU, 0x00002AAAU, + 0x0AAAAAAAU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xAAA8AAA8U, 0xAAAAAAAAU, 0x9400AAAAU, + 0xAA9A10AAU, 0xAAA002AAU, 0x0A82250AU, 0x00400000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00080000U, 0xFFFF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFF00U, 0x0000FFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFF000000U, 0x0FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFF800000U, 0x1BFBFFFBU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x0007FFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFF0000U, + 0x0000003FU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFFFCU, 0x0000000FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_print table. */ +#include "ctype_print.h" + +bool +uc_is_print (ucs4_t uc) +{ + return bitmap_lookup (&u_is_print, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[17]; + short level2[6 << 7]; + unsigned int level3[94 << 4]; + } +u_is_print = +{ + { 17 }, + { + 18 * sizeof (int) / sizeof (short) + 0, + 18 * sizeof (int) / sizeof (short) + 128, + 18 * sizeof (int) / sizeof (short) + 256, + 18 * sizeof (int) / sizeof (short) + 384, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 * sizeof (int) / sizeof (short) + 512, + 18 * sizeof (int) / sizeof (short) + 640, + 18 * sizeof (int) / sizeof (short) + 640 + }, + { + 18 + 768 * sizeof (short) / sizeof (int) + 0, + 18 + 768 * sizeof (short) / sizeof (int) + 16, + 18 + 768 * sizeof (short) / sizeof (int) + 32, + 18 + 768 * sizeof (short) / sizeof (int) + 48, + 18 + 768 * sizeof (short) / sizeof (int) + 64, + 18 + 768 * sizeof (short) / sizeof (int) + 80, + 18 + 768 * sizeof (short) / sizeof (int) + 96, + 18 + 768 * sizeof (short) / sizeof (int) + 112, + 18 + 768 * sizeof (short) / sizeof (int) + 128, + 18 + 768 * sizeof (short) / sizeof (int) + 144, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 176, + 18 + 768 * sizeof (short) / sizeof (int) + 192, + 18 + 768 * sizeof (short) / sizeof (int) + 208, + 18 + 768 * sizeof (short) / sizeof (int) + 224, + 18 + 768 * sizeof (short) / sizeof (int) + 240, + 18 + 768 * sizeof (short) / sizeof (int) + 256, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 272, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 288, + 18 + 768 * sizeof (short) / sizeof (int) + 304, + 18 + 768 * sizeof (short) / sizeof (int) + 320, + 18 + 768 * sizeof (short) / sizeof (int) + 336, + 18 + 768 * sizeof (short) / sizeof (int) + 352, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 368, + 18 + 768 * sizeof (short) / sizeof (int) + 384, + 18 + 768 * sizeof (short) / sizeof (int) + 400, + 18 + 768 * sizeof (short) / sizeof (int) + 416, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 432, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 448, + 18 + 768 * sizeof (short) / sizeof (int) + 464, + 18 + 768 * sizeof (short) / sizeof (int) + 480, + 18 + 768 * sizeof (short) / sizeof (int) + 496, + 18 + 768 * sizeof (short) / sizeof (int) + 512, + 18 + 768 * sizeof (short) / sizeof (int) + 528, + 18 + 768 * sizeof (short) / sizeof (int) + 544, + 18 + 768 * sizeof (short) / sizeof (int) + 560, + 18 + 768 * sizeof (short) / sizeof (int) + 576, + 18 + 768 * sizeof (short) / sizeof (int) + 592, + 18 + 768 * sizeof (short) / sizeof (int) + 608, + 18 + 768 * sizeof (short) / sizeof (int) + 624, + 18 + 768 * sizeof (short) / sizeof (int) + 640, + 18 + 768 * sizeof (short) / sizeof (int) + 656, + 18 + 768 * sizeof (short) / sizeof (int) + 672, + 18 + 768 * sizeof (short) / sizeof (int) + 688, + 18 + 768 * sizeof (short) / sizeof (int) + 704, + 18 + 768 * sizeof (short) / sizeof (int) + 720, + 18 + 768 * sizeof (short) / sizeof (int) + 736, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 752, + 18 + 768 * sizeof (short) / sizeof (int) + 768, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 784, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 800, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 816, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 832, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 848, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 864, + 18 + 768 * sizeof (short) / sizeof (int) + 880, + 18 + 768 * sizeof (short) / sizeof (int) + 896, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 912, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 928, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 944, + 18 + 768 * sizeof (short) / sizeof (int) + 960, + 18 + 768 * sizeof (short) / sizeof (int) + 976, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 992, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 1008, + 18 + 768 * sizeof (short) / sizeof (int) + 1024, + 18 + 768 * sizeof (short) / sizeof (int) + 1040, + 18 + 768 * sizeof (short) / sizeof (int) + 1056, + 18 + 768 * sizeof (short) / sizeof (int) + 1072, + 18 + 768 * sizeof (short) / sizeof (int) + 1088, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1104, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 1120, + 18 + 768 * sizeof (short) / sizeof (int) + 1136, + 18 + 768 * sizeof (short) / sizeof (int) + 1152, + 18 + 768 * sizeof (short) / sizeof (int) + 1168, + 18 + 768 * sizeof (short) / sizeof (int) + 1184, + 18 + 768 * sizeof (short) / sizeof (int) + 1200, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 1216, + 18 + 768 * sizeof (short) / sizeof (int) + 1232, + 18 + 768 * sizeof (short) / sizeof (int) + 1248, + 18 + 768 * sizeof (short) / sizeof (int) + 1264, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1280, + 18 + 768 * sizeof (short) / sizeof (int) + 1296, + 18 + 768 * sizeof (short) / sizeof (int) + 1312, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1328, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1344, + 18 + 768 * sizeof (short) / sizeof (int) + 1360, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1376, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1392, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1408, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1424, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1440, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1456, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 1472, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 160, + 18 + 768 * sizeof (short) / sizeof (int) + 1488 + }, + { + 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU, + 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFCFFFFFFU, + 0xFFFFD7F0U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFEFFFFU, 0xFE7FFFFFU, 0xFFFFFFFFU, + 0xFFFEE7FFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0x001F87FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFBFFFU, 0xFFFFFFFFU, 0xFFFFE7FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0003FFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU, + 0xFFFFFFFFU, 0x7FFF3FFFU, 0x4FFFFFFFU, 0xFFFF07FFU, + 0xFF837FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFF99FEFU, 0xF3C5FDFFU, 0xB080799FU, 0x7FFFFFCFU, + 0xFFF987EEU, 0xD36DFDFFU, 0x5E023987U, 0x007FFFC0U, + 0xFFFBBFEEU, 0xF3EDFDFFU, 0x00013BBFU, 0xFE03FFCFU, + 0xFFF99FEEU, 0xF3EDFDFFU, 0xB0E0399FU, 0x00FFFFCFU, + 0xD63DC7ECU, 0xC3FFC718U, 0x00813DC7U, 0x07FFFFC0U, + 0xFFFDDFFFU, 0xF3FFFDFFU, 0x27603DDFU, 0xFF80FFCFU, + 0xFFFDDFFFU, 0xF3EFFDFFU, 0x60603DDFU, 0x000EFFCFU, + 0xFFFDDFFFU, 0xFFFFFFFFU, 0xFFF0FDDFU, 0xFFFFFFCFU, + 0xFC7FFFEEU, 0x2FFBFFFFU, 0xFF5F847FU, 0x001CFFC0U, + 0xFFFFFFFEU, 0x87FFFFFFU, 0x0FFFFFFFU, 0x00000000U, + 0xFFFFF7D6U, 0x3FFFFFAFU, 0xF3FF7F5FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFEFFU, 0xFFFE1FFFU, + 0xFEFFFFFFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU, + 0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU, + 0xFF3DFFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU, 0x1FFFFFFFU, + 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x1FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU, + 0x803FFFFFU, 0x007FFFFFU, 0x000FFFFFU, 0x000DDFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x03FF03FFU, + 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU, + 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, 0x003FFFFFU, + 0x7FFFFFFFU, 0x0FFF0FFFU, 0xFFFFFFF1U, 0x001F3FFFU, + 0xFFFFFFFFU, 0xFFFF0FFFU, 0xC7FF03FFU, 0xFFFFFFFFU, + 0xCFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU, 0x9FFFFFFFU, + 0x03FF03FFU, 0xFFFF3FFFU, 0x00007FFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFDFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF00FFFFFU, + 0xFFFFFFFFU, 0xF8FFFFFFU, 0xFFFFE3FFU, 0xFFFFFFFFU, + 0xFFFF07FFU, 0xE7FFFFFFU, 0xFFFF00FFU, 0x07FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU, + 0xFFFFFFFFU, 0xFFDFFFFFU, 0xEFCFFFDFU, 0x7FDCFFFFU, + 0xFFFFFFFFU, 0xFFFFFCFFU, 0xFFFFFFFFU, 0xFFF3FFDFU, + 0x1FFF7FFFU, 0xFFFFFFFFU, 0xFFFF0001U, 0x0001FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x000003FFU, 0x000007FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU, + 0xFFBFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFE0FFFFFU, + 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x800180FFU, + 0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U, + 0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, + 0xFE7FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFF7FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF803FU, + 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFF1FFFU, 0xFFFFFFFFU, 0xFFFF007FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00000FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FEB3FFFU, 0xFFFC0000U, + 0xFFFFFFFFU, 0x03FF1FFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFC03FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800FFFFFU, 0x1FFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FFBFFFU, 0x7FFFFFFFU, + 0xFFFFFFFFU, 0x007FFFFFU, 0xF3FF3FFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF8000007U, 0x007FFFFFU, + 0x007E7E7EU, 0xFFFF7F7FU, 0xFFFFFFFFU, 0xFFFF0FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF3FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U, + 0xE0F8007FU, 0x5F7FFFFFU, 0xFFFFFFDBU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFF80007U, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFCFFFFU, 0xFFFFFFFFU, 0x000080FFU, 0xFFFF0000U, + 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0xFFDF0F7FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU, + 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x3E007F7FU, + 0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, + 0xFFFFFF87U, 0xFF8FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x0FFFFFFFU, + 0xFFFFFFFFU, 0xFFFFE00FU, 0xFFFF07FFU, 0x07FFFFFFU, + 0xBFFFFFFFU, 0xFFFFFFFFU, 0x003FFF0FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU, + 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF800FU, + 0xFFB7F7FFU, 0x1BFBFFFBU, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU, + 0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFD3FU, 0x91BFFFFFU, 0xFFBFFFFFU, 0xFFFFFFFFU, + 0x7FFFFFFFU, 0x0000FF80U, 0x00000000U, 0xF837FFFFU, + 0x8FFFFFFFU, 0x83FFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xF0FFFFFFU, 0xFFFCFFFFU, 0xFFFFFFFFU, + 0xFEEFF06FU, 0x873FFFFFU, 0x01FF01FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00000000U, 0xFFFFFFFFU, 0x007FF87FU, + 0xFFFFFFFFU, 0xFE3FFFFFU, 0xFF3FFFFFU, 0xFF07FFFFU, + 0x1E03FFFFU, 0x0000FE00U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U, + 0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0xFC07FFFFU, + 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU, 0xFFFFFE3FU, + 0x0000C03FU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU, + 0xFFFFFFFFU, 0x00033BFFU, 0x0000001CU, 0xF0000000U, + 0xFFFFFFFFU, 0xFFFF00FFU, 0x03FFFFFFU, 0xFFFF0000U, + 0x000003FFU, 0xFFFF0000U, 0x00000FFFU, 0x007FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFC3FFFU, 0x803FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF2007U, 0x03FF01FFU, + 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFF00FFU, 0x007FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001FFFFEU, + 0xFFFBFFFFU, 0xFFFFFFFFU, 0x00000003U, 0x00000000U, + 0xBFFFBD7FU, 0xFFFF03FFU, 0xFFFFFFFFU, 0x03FF07FFU, + 0xFFF99FEFU, 0xFBEDFDFFU, 0xE081399FU, 0x001F1FCFU, + 0xFFFF4BFFU, 0xFFBFFFFFU, 0x01BFF7A5U, 0x00000006U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xEFFFFFFFU, 0x00000003U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFF3FFFFFU, 0x3FFFFFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF001FU, 0x00001FFFU, + 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFF03FFU, 0x0000000FU, + 0xE7FFFFFFU, 0xFFFF0FFFU, 0x0000007FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x0FFFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x8007FFFFU, + 0xFF6FF27FU, 0xF9BFFFFFU, 0x03FF007FU, 0x00000000U, + 0x00000000U, 0xFFFFFCFFU, 0xFCFFFFFFU, 0x0000001FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF0007U, 0xFFFFFFFFU, 0x01FFFFFFU, + 0x000003FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0003U, + 0xFFFFFDFFU, 0xFF7FFFFFU, 0xFFFF003FU, 0xFFFF1FFFU, + 0xFFFCFFFFU, 0x007FFEFFU, 0x00000000U, 0x00000000U, + 0xFFFFFB7FU, 0xB47FFFFFU, 0x03FF00FFU, 0xFFFFFDBFU, + 0x01FB7FFFU, 0x000003FFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x01FFFFFFU, + 0xFFFDFFFFU, 0xC7FFFFFFU, 0x07FFFFFFU, 0x00000000U, + 0x00000000U, 0x00010000U, 0xFFFFFFFFU, 0x8003FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001F7FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFFC3FFU, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x003F3FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFBFF003FU, 0xE0FFFFFBU, + 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x07FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF87FFU, 0xFFFFFFFFU, + 0xFFFF80FFU, 0x00000000U, 0x00000000U, 0x0003001FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U, + 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU, + 0xF3FF01FFU, 0x0000000FU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x000FFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, + 0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU, + 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU, + 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFF3FU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFCFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xF9FFFF7FU, 0xFFFF07DBU, 0xFFFFFFFFU, 0x00003FFFU, + 0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x3FFF1FFFU, 0x0000C3FFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0x00007FFFU, 0xFFFFFFFFU, 0x83FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x87FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFF9FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FF0FFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U, + 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U, + 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00030000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00003FFFU, 0x00000000U, 0xFFFFFFC0U, + 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU, + 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU, + 0xFFFF00FFU, 0x0FFF3FFFU, 0x00000003U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU, + 0xFFFF83FFU, 0xFFFFFFFFU, 0x9FFFC07FU, 0x01FF03FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U, + 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_punct table. */ +#include "ctype_punct.h" + +bool +uc_is_punct (ucs4_t uc) +{ + return bitmap_lookup (&u_is_punct, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[17]; + short level2[4 << 7]; + unsigned int level3[75 << 4]; + } +u_is_punct = +{ + { 17 }, + { + 18 * sizeof (int) / sizeof (short) + 0, + 18 * sizeof (int) / sizeof (short) + 128, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 * sizeof (int) / sizeof (short) + 256, + 18 * sizeof (int) / sizeof (short) + 384, + 18 * sizeof (int) / sizeof (short) + 384 + }, + { + 18 + 512 * sizeof (short) / sizeof (int) + 0, + 18 + 512 * sizeof (short) / sizeof (int) + 16, + 18 + 512 * sizeof (short) / sizeof (int) + 32, + 18 + 512 * sizeof (short) / sizeof (int) + 48, + 18 + 512 * sizeof (short) / sizeof (int) + 64, + 18 + 512 * sizeof (short) / sizeof (int) + 80, + 18 + 512 * sizeof (short) / sizeof (int) + 96, + 18 + 512 * sizeof (short) / sizeof (int) + 112, + 18 + 512 * sizeof (short) / sizeof (int) + 128, + 18 + 512 * sizeof (short) / sizeof (int) + 144, + 18 + 512 * sizeof (short) / sizeof (int) + 160, + 18 + 512 * sizeof (short) / sizeof (int) + 176, + 18 + 512 * sizeof (short) / sizeof (int) + 192, + 18 + 512 * sizeof (short) / sizeof (int) + 208, + 18 + 512 * sizeof (short) / sizeof (int) + 224, + 18 + 512 * sizeof (short) / sizeof (int) + 240, + 18 + 512 * sizeof (short) / sizeof (int) + 256, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 288, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 304, + 18 + 512 * sizeof (short) / sizeof (int) + 320, + 18 + 512 * sizeof (short) / sizeof (int) + 336, + 18 + 512 * sizeof (short) / sizeof (int) + 352, + 18 + 512 * sizeof (short) / sizeof (int) + 368, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 384, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 400, + 18 + 512 * sizeof (short) / sizeof (int) + 416, + 18 + 512 * sizeof (short) / sizeof (int) + 432, + 18 + 512 * sizeof (short) / sizeof (int) + 448, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 464, + 18 + 512 * sizeof (short) / sizeof (int) + 480, + 18 + 512 * sizeof (short) / sizeof (int) + 496, + 18 + 512 * sizeof (short) / sizeof (int) + 512, + 18 + 512 * sizeof (short) / sizeof (int) + 528, + 18 + 512 * sizeof (short) / sizeof (int) + 544, + 18 + 512 * sizeof (short) / sizeof (int) + 560, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 576, + 18 + 512 * sizeof (short) / sizeof (int) + 592, + 18 + 512 * sizeof (short) / sizeof (int) + 608, + 18 + 512 * sizeof (short) / sizeof (int) + 624, + 18 + 512 * sizeof (short) / sizeof (int) + 640, + 18 + 512 * sizeof (short) / sizeof (int) + 656, + 18 + 512 * sizeof (short) / sizeof (int) + 672, + 18 + 512 * sizeof (short) / sizeof (int) + 688, + 18 + 512 * sizeof (short) / sizeof (int) + 704, + 18 + 512 * sizeof (short) / sizeof (int) + 720, + 18 + 512 * sizeof (short) / sizeof (int) + 736, + 18 + 512 * sizeof (short) / sizeof (int) + 752, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 768, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 784, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 800, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 816, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 832, + 18 + 512 * sizeof (short) / sizeof (int) + 848, + 18 + 512 * sizeof (short) / sizeof (int) + 864, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 880, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 896, + 18 + 512 * sizeof (short) / sizeof (int) + 912, + 18 + 512 * sizeof (short) / sizeof (int) + 928, + 18 + 512 * sizeof (short) / sizeof (int) + 944, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 960, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 976, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 992, + 18 + 512 * sizeof (short) / sizeof (int) + 1008, + 18 + 512 * sizeof (short) / sizeof (int) + 1024, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 1040, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 1056, + 18 + 512 * sizeof (short) / sizeof (int) + 1072, + 18 + 512 * sizeof (short) / sizeof (int) + 1088, + 18 + 512 * sizeof (short) / sizeof (int) + 1104, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 1120, + 18 + 512 * sizeof (short) / sizeof (int) + 1136, + 18 + 512 * sizeof (short) / sizeof (int) + 1152, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 1168, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 272, + 18 + 512 * sizeof (short) / sizeof (int) + 1184 + }, + { + 0x00000000U, 0xFC00FFFEU, 0xF8000001U, 0x78000001U, + 0x00000000U, 0xFBDFFBFFU, 0x00800000U, 0x00800000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFC003CU, 0xFFFFAFE0U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFDFU, 0x4020FFFFU, + 0x000000B0U, 0x00000000U, 0x00000000U, 0x00400000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x000003FCU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFC000000U, 0x00000000U, + 0xFFFEE600U, 0xFFFFFFFFU, 0x000000FFU, 0x00180000U, + 0xFFFFFFFFU, 0x00000000U, 0xFFFFF800U, 0x00013C00U, + 0x00000000U, 0x00000000U, 0xFFD00000U, 0x60003F9FU, + 0x0002BFFFU, 0xFFFF0000U, 0x000007FFU, 0x00000000U, + 0x00000000U, 0x0001FFC0U, 0x00000000U, 0xE3CFF800U, + 0xFBC00000U, 0x7FFF3EEFU, 0x4E000000U, 0x00000000U, + 0xFF830100U, 0x00000000U, 0xFFFFFC00U, 0xFFFFFFFFU, + 0x0000000FU, 0xDC000000U, 0x00FEFFFFU, 0x0001003CU, + 0x0000000EU, 0xD0000000U, 0x0080399FU, 0x6FFC000CU, + 0x0000000EU, 0xD0000000U, 0x00023987U, 0x00630000U, + 0x0000000EU, 0xD0000000U, 0x00003BBFU, 0xFC03000CU, + 0x0000000EU, 0xD0000000U, 0x00E0399FU, 0x00FD000CU, + 0x00000004U, 0xC0000000U, 0x00803DC7U, 0x07FF0000U, + 0x0000001FU, 0xD0000000U, 0x00603DDFU, 0xFF80000CU, + 0x0000001EU, 0xD0000000U, 0x00603DDFU, 0x0008000CU, + 0x0000000FU, 0xD8000000U, 0x7F80BDDFU, 0x03FF000CU, + 0x0000000EU, 0x00000000U, 0xFF5F8400U, 0x001C0000U, + 0x00000000U, 0x80008000U, 0x0C008040U, 0x00000000U, + 0x00000000U, 0x1FF20000U, 0x00007F00U, 0x00000000U, + 0xFFFFFFFEU, 0xFFFFFC00U, 0x00000000U, 0xFFFE0000U, + 0xFEFFE0FFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U, + 0x00000000U, 0x7FFFF800U, 0xC3C0FC00U, 0x001E3F9DU, + 0xFC00BFFCU, 0x00000000U, 0x00000000U, 0x08000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xE0000000U, 0x1FFFFFFFU, + 0x03FF0000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00006000U, + 0x18000000U, 0x00000000U, 0x00000000U, 0x00003800U, + 0x003C0000U, 0x007C0000U, 0x000C0000U, 0x000C0000U, + 0x00000000U, 0xFFF00000U, 0x2F7FFFFFU, 0x03FF0000U, + 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000060U, 0x00000200U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x0FFF0FFFU, 0x00000031U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xC4000000U, 0xFFFFFFFFU, + 0xCF800000U, 0x00000000U, 0x7FE00000U, 0x9FFFFFFFU, + 0x00000000U, 0xFFFF3F7FU, 0x00007FFFU, 0x00000000U, + 0x0000001FU, 0xFFF00000U, 0xFC00C01FU, 0xFFFFFFFFU, + 0x00000007U, 0x00003FFEU, 0x00000000U, 0xF00FFFC0U, + 0x00000000U, 0xF8FFFFF0U, 0x00000000U, 0xC0000000U, + 0x00000000U, 0x00000000U, 0xFFFF00FFU, 0x039021FFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xA0000000U, 0xE000E003U, 0x6000E000U, + 0xFFFFF880U, 0xFFFFFCFFU, 0x7FFFFFFFU, 0x7FF1FFDFU, + 0x00007FFFU, 0xFFFFFFFFU, 0xFFFF0001U, 0x0001FFFFU, + 0xC1D0037BU, 0x0C0040AFU, 0xFFFFBC1FU, 0x00000000U, + 0xFFFF0E00U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x000003FFU, 0x000007FFU, 0xFFFFFFFFU, + 0x0FFFFFFFU, 0x00000000U, 0x00000000U, 0xFFFFFC00U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU, + 0xFFBFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFE0387E0U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x80010000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFF7FFFU, 0x3FFFFFFFU, 0x00000000U, + 0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFF0000U, + 0xFFFFFF1EU, 0xE0C1FC01U, 0x00000000U, 0x00000000U, + 0x1E000000U, 0x00000001U, 0x00000000U, 0x08000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0x00000000U, 0xFFFFFFFFU, 0x0000803FU, + 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0xFFFFFFFFU, 0x0000007FU, 0xC0000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x0000E000U, 0x00000000U, 0x00000000U, 0x7FFF8000U, + 0xC0000000U, 0x00000000U, 0x00000000U, 0x00FF0000U, + 0x007FFFFFU, 0x00000003U, 0x00000000U, 0x00000000U, + 0x00000600U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000844U, 0x03FF1FF8U, 0x00000000U, 0x00F00000U, + 0x00000003U, 0xFFF00000U, 0x0000C03FU, 0x9703FFFFU, + 0x00000000U, 0x0000FFC0U, 0x800FFF80U, 0x00000000U, + 0x0000000FU, 0xFFF80000U, 0xC0003FFFU, 0x00000020U, + 0x00000000U, 0x007FFE00U, 0xF0003008U, 0x3B800000U, + 0x00000000U, 0xC19D0000U, 0xC0000002U, 0x0063F800U, + 0x00000000U, 0x00000000U, 0x08000000U, 0x00000C00U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00003FF8U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x40000000U, 0x00000200U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFC0000U, 0x00000007U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xC0000000U, 0x0000FFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00008000U, 0xF0000000U, + 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0x00000F7FU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x80000000U, + 0xFC00FFFEU, 0xF8000001U, 0xF8000001U, 0x0000003FU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x3E007F7FU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFF87U, 0xFF8FFFFFU, 0x00000000U, 0xFFE00000U, + 0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0FFFFFFFU, + 0x00000000U, 0x0000000FU, 0x00000000U, 0x07C00000U, + 0x80000000U, 0x00000000U, 0x00010000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00008000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFF800000U, 0xFF800000U, + 0x00000000U, 0x0000FF80U, 0x00000000U, 0xF8000000U, + 0x8FC00000U, 0x80000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x30000000U, 0xFFFCFFFFU, 0xFFFFFFFFU, + 0x0000F06EU, 0x87000000U, 0x01FF01FFU, 0xE0000000U, + 0xE0000000U, 0x00000000U, 0x00000100U, 0x007FF860U, + 0x00000000U, 0xFE000000U, 0xFF000000U, 0xFF000000U, + 0x1E000000U, 0x0000FE00U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFC000000U, + 0x00000000U, 0x000000F0U, 0x00000000U, 0x00007E00U, + 0x0000C000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU, + 0x00000000U, 0x00003800U, 0x00000000U, 0xF0000000U, + 0xE0000000U, 0x0000007FU, 0x03FFFFC0U, 0x00000000U, + 0x000003FCU, 0x00000000U, 0x00000FE0U, 0x00000000U, + 0x00000007U, 0xFF000000U, 0xFFFC3FFFU, 0x8019003FU, + 0x00000007U, 0xFFFF0000U, 0x00002007U, 0x00000000U, + 0x00000007U, 0x001FFF80U, 0x0000006FU, 0x00380000U, + 0x00000007U, 0xFFF80000U, 0xE800FFE1U, 0x001FFFFEU, + 0x00000000U, 0x7FFFF000U, 0x00000002U, 0x00000000U, + 0x00000000U, 0x00000200U, 0x80000000U, 0x000007FFU, + 0x0000000FU, 0xD8000000U, 0x0080399FU, 0x001F1FCCU, + 0x00000000U, 0xFF000000U, 0x01B5F7A5U, 0x00000006U, + 0x00000000U, 0xFFE00000U, 0x6C00F87FU, 0x00000000U, + 0x00000000U, 0xFFFF0000U, 0x0000004FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFF3F8000U, 0x30FFFFFFU, 0x00000000U, + 0x00000000U, 0xFFFF0000U, 0x0000000FU, 0x00001FFFU, + 0x00000000U, 0x02FFF800U, 0x00000000U, 0x00000000U, + 0xE0000000U, 0xFC000FFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x0FFFF000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0007FC00U, + 0x00000000U, 0x79BF0000U, 0x0000007DU, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFCFE0000U, 0x00000015U, + 0x000007FEU, 0xFBF80000U, 0x0FFE00FFU, 0x00000000U, + 0xDFFFFC00U, 0x00000007U, 0x00000000U, 0x00000000U, + 0x000003FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000002U, + 0x00000000U, 0xFF7F8000U, 0xFC00003EU, 0x00031FFFU, + 0xFFFC0000U, 0x007FFEFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0xB47E0000U, 0x000000BFU, 0x00000000U, + 0x00FB7C00U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x01F80000U, + 0x0000000BU, 0xC7F00000U, 0x0400FFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x8003FFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x001F0000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00060000U, + 0x00000000U, 0xFFFF0000U, 0x003FFF81U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xC0000000U, 0x0000FFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0000C000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x003F0000U, + 0x00000000U, 0xFFFF0000U, 0xF8000030U, 0x00000003U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0000E000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x07FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFE8000U, 0xFFFFFFFFU, + 0x000780FFU, 0x00000000U, 0x00000000U, 0x00030014U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xF0000000U, 0x0000000FU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x000FFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, + 0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x08000002U, 0x08000000U, + 0x00200000U, 0x00200000U, 0x00008000U, 0x00008000U, + 0x00000200U, 0x00000200U, 0x00000008U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xF9FFFF7FU, 0x000007DBU, 0x00000000U, 0x00000000U, + 0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x007F0000U, 0x00008000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00004000U, 0x00000000U, 0x8000F000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0000F000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x8000C000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x007FFF80U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xC00007F0U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U, + 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00030000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU, + 0x0000FFFFU, 0x0000E000U, 0x0000FC00U, 0x0000FC00U, + 0xFFFFF800U, 0x00003FDFU, 0x00000000U, 0x00000000U, + 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU, + 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU, + 0xFFFF00FFU, 0x0FFF3FFFU, 0x00000003U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU, + 0xFFFF83FFU, 0xFFFFFFFFU, 0x9FFFC07FU, 0x01FF03FFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, + 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_space table. */ +#include "ctype_space.h" + +bool +uc_is_space (ucs4_t uc) +{ + return bitmap_lookup (&u_is_space, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[1]; + short level2[1 << 7]; + unsigned int level3[4 << 4]; + } +u_is_space = +{ + { 1 }, + { 2 * sizeof (int) / sizeof (short) + 0 }, + { + 2 + 128 * sizeof (short) / sizeof (int) + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 2 + 128 * sizeof (short) / sizeof (int) + 16, + -1, + -1, + -1, + -1, + 2 + 128 * sizeof (short) / sizeof (int) + 32, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 2 + 128 * sizeof (short) / sizeof (int) + 48, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00003E00U, 0x00000001U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x0000077FU, 0x00000300U, 0x80000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_upper table. */ +#include "ctype_upper.h" + +bool +uc_is_upper (ucs4_t uc) +{ + return bitmap_lookup (&u_is_upper, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[2]; + short level2[2 << 7]; + unsigned int level3[17 << 4]; + } +u_is_upper = +{ + { 2 }, + { + 3 * sizeof (int) / sizeof (short) + 0, + 3 * sizeof (int) / sizeof (short) + 128 + }, + { + 3 + 256 * sizeof (short) / sizeof (int) + 0, + 3 + 256 * sizeof (short) / sizeof (int) + 16, + 3 + 256 * sizeof (short) / sizeof (int) + 32, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 48, + 3 + 256 * sizeof (short) / sizeof (int) + 64, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 80, + 3 + 256 * sizeof (short) / sizeof (int) + 96, + 3 + 256 * sizeof (short) / sizeof (int) + 112, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 128, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 144, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 160, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 176, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 192, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 208, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 224, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 240, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 3 + 256 * sizeof (short) / sizeof (int) + 256, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x7F7FFFFFU, 0x00000000U, + 0x55555555U, 0xAA555555U, 0x555554AAU, 0x2B555555U, + 0xB1DBCED6U, 0x11AED2D5U, 0x4AAAADB0U, 0x55D65555U, + 0x55555555U, 0x6C055555U, 0x0000557AU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x80450000U, + 0xFFFED740U, 0x00000FFBU, 0x55008000U, 0xE6905555U, + 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x55555555U, + 0x55555401U, 0x55555555U, 0x55552AABU, 0x55555555U, + 0x55555555U, 0xFFFE5555U, 0x007FFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFFFFU, 0x000020BFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0200U, 0xE7FFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x55555555U, 0x55555555U, 0x55555555U, 0x55555555U, + 0x40155555U, 0x55555555U, 0x55555555U, 0x55555555U, + 0x3F00FF00U, 0xFF00FF00U, 0xAA003F00U, 0x0000FF00U, + 0xFF00FF00U, 0x1F00FF00U, 0x0F001F00U, 0x1F001F00U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00040C40U, 0x00000000U, 0x0000FFFFU, + 0x00000008U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFC00000U, 0x0000FFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0xC025EA9DU, + 0x55555555U, 0x55555555U, 0x55555555U, 0x00042805U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x55555555U, 0x00001555U, + 0x05555555U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x55545554U, 0x55555555U, 0x6A005555U, + 0x55452855U, 0x555F7D55U, 0x15411AF5U, 0x00200000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x07FFFFFEU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x000000FFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFF0000U, 0x000FFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0xF7FF0000U, + 0x0037F7FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x0007FFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x0000003FU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0xFFFFFFFFU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0x00000003U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* ISO C like properties of Unicode characters. + Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unictype.h" + +#include "bitmap.h" + +/* Define u_is_xdigit table. */ +#include "ctype_xdigit.h" + +bool +uc_is_xdigit (ucs4_t uc) +{ + return bitmap_lookup (&u_is_xdigit, uc); +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* ISO C like properties of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[1]; + short level2[1 << 7]; + unsigned int level3[1 << 4]; + } +u_is_xdigit = +{ + { 1 }, + { 2 * sizeof (int) / sizeof (short) + 0 }, + { + 2 + 128 * sizeof (short) / sizeof (int) + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + }, + { + 0x00000000U, 0x03FF0000U, 0x0000007EU, 0x0000007EU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Normalization forms (composition and decomposition) of Unicode strings. + Copyright (C) 2001-2002, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2009. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNINORM_H +#define _UNINORM_H + +/* Get size_t. */ +#include + +#include "unitypes.h" + +#if 0 +# include +#else +# define LIBUNISTRING_DLL_VARIABLE +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Conventions: + + All functions prefixed with u8_ operate on UTF-8 encoded strings. + Their unit is an uint8_t (1 byte). + + All functions prefixed with u16_ operate on UTF-16 encoded strings. + Their unit is an uint16_t (a 2-byte word). + + All functions prefixed with u32_ operate on UCS-4 encoded strings. + Their unit is an uint32_t (a 4-byte word). + + All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly + n units. + + Functions returning a string result take a (resultbuf, lengthp) argument + pair. If resultbuf is not NULL and the result fits into *lengthp units, + it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly + allocated string is returned. In both cases, *lengthp is set to the + length (number of units) of the returned string. In case of error, + NULL is returned and errno is set. */ + + +enum +{ + UC_DECOMP_CANONICAL,/* Canonical decomposition. */ + UC_DECOMP_FONT, /* A font variant (e.g. a blackletter form). */ + UC_DECOMP_NOBREAK, /* A no-break version of a space or hyphen. */ + UC_DECOMP_INITIAL, /* An initial presentation form (Arabic). */ + UC_DECOMP_MEDIAL, /* A medial presentation form (Arabic). */ + UC_DECOMP_FINAL, /* A final presentation form (Arabic). */ + UC_DECOMP_ISOLATED,/* An isolated presentation form (Arabic). */ + UC_DECOMP_CIRCLE, /* An encircled form. */ + UC_DECOMP_SUPER, /* A superscript form. */ + UC_DECOMP_SUB, /* A subscript form. */ + UC_DECOMP_VERTICAL,/* A vertical layout presentation form. */ + UC_DECOMP_WIDE, /* A wide (or zenkaku) compatibility character. */ + UC_DECOMP_NARROW, /* A narrow (or hankaku) compatibility character. */ + UC_DECOMP_SMALL, /* A small variant form (CNS compatibility). */ + UC_DECOMP_SQUARE, /* A CJK squared font variant. */ + UC_DECOMP_FRACTION,/* A vulgar fraction form. */ + UC_DECOMP_COMPAT /* Otherwise unspecified compatibility character. */ +}; + +/* Maximum size of decomposition of a single Unicode character. */ +#define UC_DECOMPOSITION_MAX_LENGTH 32 + +/* Return the character decomposition mapping of a Unicode character. + DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH + ucs_t elements. + When a decomposition exists, DECOMPOSITION[0..N-1] and *DECOMP_TAG are + filled and N is returned. Otherwise -1 is returned. */ +extern int + uc_decomposition (ucs4_t uc, int *decomp_tag, ucs4_t *decomposition); + +/* Return the canonical character decomposition mapping of a Unicode character. + DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH + ucs_t elements. + When a decomposition exists, DECOMPOSITION[0..N-1] is filled and N is + returned. Otherwise -1 is returned. */ +extern int + uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition); + + +/* Attempt to combine the Unicode characters uc1, uc2. + uc1 is known to have canonical combining class 0. + Return the combination of uc1 and uc2, if it exists. + Return 0 otherwise. + Not all decompositions can be recombined using this function. See the + Unicode file CompositionExclusions.txt for details. */ +extern ucs4_t + uc_composition (ucs4_t uc1, ucs4_t uc2) + _UC_ATTRIBUTE_CONST; + + +/* An object of type uninorm_t denotes a Unicode normalization form. */ +struct unicode_normalization_form; +typedef const struct unicode_normalization_form *uninorm_t; + +/* UNINORM_NFD: Normalization form D: canonical decomposition. */ +extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form uninorm_nfd; +#define UNINORM_NFD (&uninorm_nfd) + +/* UNINORM_NFC: Normalization form C: canonical decomposition, then + canonical composition. */ +extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form uninorm_nfc; +#define UNINORM_NFC (&uninorm_nfc) + +/* UNINORM_NFKD: Normalization form KD: compatibility decomposition. */ +extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form uninorm_nfkd; +#define UNINORM_NFKD (&uninorm_nfkd) + +/* UNINORM_NFKC: Normalization form KC: compatibility decomposition, then + canonical composition. */ +extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form uninorm_nfkc; +#define UNINORM_NFKC (&uninorm_nfkc) + +/* Test whether a normalization form does compatibility decomposition. */ +#define uninorm_is_compat_decomposing(nf) \ + ((* (const unsigned int *) (nf) >> 0) & 1) + +/* Test whether a normalization form includes canonical composition. */ +#define uninorm_is_composing(nf) \ + ((* (const unsigned int *) (nf) >> 1) & 1) + +/* Return the decomposing variant of a normalization form. + This maps NFC,NFD -> NFD and NFKC,NFKD -> NFKD. */ +extern uninorm_t + uninorm_decomposing_form (uninorm_t nf) + _UC_ATTRIBUTE_PURE; + + +/* Return the specified normalization form of a string. */ +extern uint8_t * + u8_normalize (uninorm_t nf, const uint8_t *s, size_t n, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_normalize (uninorm_t nf, const uint16_t *s, size_t n, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_normalize (uninorm_t nf, const uint32_t *s, size_t n, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + + +/* Compare S1 and S2, ignoring differences in normalization. + NF must be either UNINORM_NFD or UNINORM_NFKD. + If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and + return 0. Upon failure, return -1 with errno set. */ +extern int + u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, + uninorm_t nf, int *resultp); +extern int + u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, + uninorm_t nf, int *resultp); +extern int + u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, + uninorm_t nf, int *resultp); + + +/* Converts the string S of length N to a NUL-terminated byte sequence, in such + a way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with uN_cmp2() is + equivalent to comparing S1 and S2 with uN_normcoll(). + NF must be either UNINORM_NFC or UNINORM_NFKC. */ +extern char * + u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf, + char *resultbuf, size_t *lengthp); +extern char * + u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf, + char *resultbuf, size_t *lengthp); +extern char * + u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf, + char *resultbuf, size_t *lengthp); + + +/* Compare S1 and S2, ignoring differences in normalization, using the + collation rules of the current locale. + NF must be either UNINORM_NFC or UNINORM_NFKC. + If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and + return 0. Upon failure, return -1 with errno set. */ +extern int + u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, + uninorm_t nf, int *resultp); +extern int + u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, + uninorm_t nf, int *resultp); +extern int + u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, + uninorm_t nf, int *resultp); + + +/* Normalization of a stream of Unicode characters. + + A "stream of Unicode characters" is essentially a function that accepts an + ucs4_t argument repeatedly, optionally combined with a function that + "flushes" the stream. */ + +/* Data type of a stream of Unicode characters that normalizes its input + according to a given normalization form and passes the normalized character + sequence to the encapsulated stream of Unicode characters. */ +struct uninorm_filter; + +/* Bring data buffered in the filter to its destination, the encapsulated + stream, then close and free the filter. + Return 0 if successful, or -1 with errno set upon failure. */ +extern int + uninorm_filter_free (struct uninorm_filter *filter); + +/* Create and return a normalization filter for Unicode characters. + The pair (stream_func, stream_data) is the encapsulated stream. + stream_func (stream_data, uc) receives the Unicode character uc + and returns 0 if successful, or -1 with errno set upon failure. + Return the new filter, or NULL with errno set upon failure. */ +extern struct uninorm_filter * + uninorm_filter_create (uninorm_t nf, + int (*stream_func) (void *stream_data, ucs4_t uc), + void *stream_data) + _GL_ATTRIBUTE_DEALLOC (uninorm_filter_free, 1); + +/* Stuff a Unicode character into a normalizing filter. + Return 0 if successful, or -1 with errno set upon failure. */ +extern int + uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc); + +/* Bring data buffered in the filter to its destination, the encapsulated + stream. + Return 0 if successful, or -1 with errno set upon failure. + Note! If after calling this function, additional characters are written + into the filter, the resulting character sequence in the encapsulated stream + will not necessarily be normalized. */ +extern int + uninorm_filter_flush (struct uninorm_filter *filter); + + +#ifdef __cplusplus +} +#endif + + +#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 @@ +/* Normalization forms (composition and decomposition) of Unicode strings. + Copyright (C) 2001-2002, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2009. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNINORM_H +#define _UNINORM_H + +/* Get size_t. */ +#include + +#include "unitypes.h" + +#if @HAVE_UNISTRING_WOE32DLL_H@ +# include +#else +# define LIBUNISTRING_DLL_VARIABLE +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Conventions: + + All functions prefixed with u8_ operate on UTF-8 encoded strings. + Their unit is an uint8_t (1 byte). + + All functions prefixed with u16_ operate on UTF-16 encoded strings. + Their unit is an uint16_t (a 2-byte word). + + All functions prefixed with u32_ operate on UCS-4 encoded strings. + Their unit is an uint32_t (a 4-byte word). + + All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly + n units. + + Functions returning a string result take a (resultbuf, lengthp) argument + pair. If resultbuf is not NULL and the result fits into *lengthp units, + it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly + allocated string is returned. In both cases, *lengthp is set to the + length (number of units) of the returned string. In case of error, + NULL is returned and errno is set. */ + + +enum +{ + UC_DECOMP_CANONICAL,/* Canonical decomposition. */ + UC_DECOMP_FONT, /* A font variant (e.g. a blackletter form). */ + UC_DECOMP_NOBREAK, /* A no-break version of a space or hyphen. */ + UC_DECOMP_INITIAL, /* An initial presentation form (Arabic). */ + UC_DECOMP_MEDIAL, /* A medial presentation form (Arabic). */ + UC_DECOMP_FINAL, /* A final presentation form (Arabic). */ + UC_DECOMP_ISOLATED,/* An isolated presentation form (Arabic). */ + UC_DECOMP_CIRCLE, /* An encircled form. */ + UC_DECOMP_SUPER, /* A superscript form. */ + UC_DECOMP_SUB, /* A subscript form. */ + UC_DECOMP_VERTICAL,/* A vertical layout presentation form. */ + UC_DECOMP_WIDE, /* A wide (or zenkaku) compatibility character. */ + UC_DECOMP_NARROW, /* A narrow (or hankaku) compatibility character. */ + UC_DECOMP_SMALL, /* A small variant form (CNS compatibility). */ + UC_DECOMP_SQUARE, /* A CJK squared font variant. */ + UC_DECOMP_FRACTION,/* A vulgar fraction form. */ + UC_DECOMP_COMPAT /* Otherwise unspecified compatibility character. */ +}; + +/* Maximum size of decomposition of a single Unicode character. */ +#define UC_DECOMPOSITION_MAX_LENGTH 32 + +/* Return the character decomposition mapping of a Unicode character. + DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH + ucs_t elements. + When a decomposition exists, DECOMPOSITION[0..N-1] and *DECOMP_TAG are + filled and N is returned. Otherwise -1 is returned. */ +extern int + uc_decomposition (ucs4_t uc, int *decomp_tag, ucs4_t *decomposition); + +/* Return the canonical character decomposition mapping of a Unicode character. + DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH + ucs_t elements. + When a decomposition exists, DECOMPOSITION[0..N-1] is filled and N is + returned. Otherwise -1 is returned. */ +extern int + uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition); + + +/* Attempt to combine the Unicode characters uc1, uc2. + uc1 is known to have canonical combining class 0. + Return the combination of uc1 and uc2, if it exists. + Return 0 otherwise. + Not all decompositions can be recombined using this function. See the + Unicode file CompositionExclusions.txt for details. */ +extern ucs4_t + uc_composition (ucs4_t uc1, ucs4_t uc2) + _UC_ATTRIBUTE_CONST; + + +/* An object of type uninorm_t denotes a Unicode normalization form. */ +struct unicode_normalization_form; +typedef const struct unicode_normalization_form *uninorm_t; + +/* UNINORM_NFD: Normalization form D: canonical decomposition. */ +extern @GNULIB_UNINORM_NFD_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfd; +#define UNINORM_NFD (&uninorm_nfd) + +/* UNINORM_NFC: Normalization form C: canonical decomposition, then + canonical composition. */ +extern @GNULIB_UNINORM_NFC_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfc; +#define UNINORM_NFC (&uninorm_nfc) + +/* UNINORM_NFKD: Normalization form KD: compatibility decomposition. */ +extern @GNULIB_UNINORM_NFKD_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfkd; +#define UNINORM_NFKD (&uninorm_nfkd) + +/* UNINORM_NFKC: Normalization form KC: compatibility decomposition, then + canonical composition. */ +extern @GNULIB_UNINORM_NFKC_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfkc; +#define UNINORM_NFKC (&uninorm_nfkc) + +/* Test whether a normalization form does compatibility decomposition. */ +#define uninorm_is_compat_decomposing(nf) \ + ((* (const unsigned int *) (nf) >> 0) & 1) + +/* Test whether a normalization form includes canonical composition. */ +#define uninorm_is_composing(nf) \ + ((* (const unsigned int *) (nf) >> 1) & 1) + +/* Return the decomposing variant of a normalization form. + This maps NFC,NFD -> NFD and NFKC,NFKD -> NFKD. */ +extern uninorm_t + uninorm_decomposing_form (uninorm_t nf) + _UC_ATTRIBUTE_PURE; + + +/* Return the specified normalization form of a string. */ +extern uint8_t * + u8_normalize (uninorm_t nf, const uint8_t *s, size_t n, + uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint16_t * + u16_normalize (uninorm_t nf, const uint16_t *s, size_t n, + uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp); +extern uint32_t * + u32_normalize (uninorm_t nf, const uint32_t *s, size_t n, + uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp); + + +/* Compare S1 and S2, ignoring differences in normalization. + NF must be either UNINORM_NFD or UNINORM_NFKD. + If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and + return 0. Upon failure, return -1 with errno set. */ +extern int + u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, + uninorm_t nf, int *resultp); +extern int + u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, + uninorm_t nf, int *resultp); +extern int + u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, + uninorm_t nf, int *resultp); + + +/* Converts the string S of length N to a NUL-terminated byte sequence, in such + a way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with uN_cmp2() is + equivalent to comparing S1 and S2 with uN_normcoll(). + NF must be either UNINORM_NFC or UNINORM_NFKC. */ +extern char * + u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf, + char *resultbuf, size_t *lengthp); +extern char * + u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf, + char *resultbuf, size_t *lengthp); +extern char * + u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf, + char *resultbuf, size_t *lengthp); + + +/* Compare S1 and S2, ignoring differences in normalization, using the + collation rules of the current locale. + NF must be either UNINORM_NFC or UNINORM_NFKC. + If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and + return 0. Upon failure, return -1 with errno set. */ +extern int + u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, + uninorm_t nf, int *resultp); +extern int + u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, + uninorm_t nf, int *resultp); +extern int + u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, + uninorm_t nf, int *resultp); + + +/* Normalization of a stream of Unicode characters. + + A "stream of Unicode characters" is essentially a function that accepts an + ucs4_t argument repeatedly, optionally combined with a function that + "flushes" the stream. */ + +/* Data type of a stream of Unicode characters that normalizes its input + according to a given normalization form and passes the normalized character + sequence to the encapsulated stream of Unicode characters. */ +struct uninorm_filter; + +/* Bring data buffered in the filter to its destination, the encapsulated + stream, then close and free the filter. + Return 0 if successful, or -1 with errno set upon failure. */ +extern int + uninorm_filter_free (struct uninorm_filter *filter); + +/* Create and return a normalization filter for Unicode characters. + The pair (stream_func, stream_data) is the encapsulated stream. + stream_func (stream_data, uc) receives the Unicode character uc + and returns 0 if successful, or -1 with errno set upon failure. + Return the new filter, or NULL with errno set upon failure. */ +extern struct uninorm_filter * + uninorm_filter_create (uninorm_t nf, + int (*stream_func) (void *stream_data, ucs4_t uc), + void *stream_data) + _GL_ATTRIBUTE_DEALLOC (uninorm_filter_free, 1); + +/* Stuff a Unicode character into a normalizing filter. + Return 0 if successful, or -1 with errno set upon failure. */ +extern int + uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc); + +/* Bring data buffered in the filter to its destination, the encapsulated + stream. + Return 0 if successful, or -1 with errno set upon failure. + Note! If after calling this function, additional characters are written + into the filter, the resulting character sequence in the encapsulated stream + will not necessarily be normalized. */ +extern int + uninorm_filter_flush (struct uninorm_filter *filter); + + +#ifdef __cplusplus +} +#endif + + +#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 @@ /* Inline functions for . - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include -#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include typedef 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 @@ /* Substitute for and wrapper around . - Copyright (C) 2003-2024 Free Software Foundation, Inc. + Copyright (C) 2003-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -69,8 +69,8 @@ #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H #define _@GUARD_PREFIX@_UNISTD_H -/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK, - HAVE_RAW_DECL_*. */ +/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_INLINE_HEADER_BEGIN, _GL_INLINE, + GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ #if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif @@ -95,12 +95,24 @@ # include #endif +/* Native Windows platforms declare _chdir, _getcwd, _rmdir in + and/or , not in . + They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(), + _lseek(), _read(), _unlink(), _write() in . */ +#if defined _WIN32 && !defined __CYGWIN__ +# include +# include +#endif + +/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41 + do not define O_CLOEXEC in . */ /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ -#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ - && (defined __CYGWIN__ || defined __ANDROID__) \ - && ! defined __GLIBC__ +#if ! defined O_CLOEXEC \ + || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ + && (defined __CYGWIN__ || defined __ANDROID__) \ + && ! defined __GLIBC__) # include #endif @@ -117,15 +129,6 @@ # undef __need_system_stdlib_h #endif -/* Native Windows platforms declare _chdir, _getcwd, _rmdir in - and/or , not in . - They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(), - _lseek(), _read(), _unlink(), _write() in . */ -#if defined _WIN32 && !defined __CYGWIN__ -# include -# include -#endif - /* Native Windows platforms declare _execl*, _execv* in . */ #if defined _WIN32 && !defined __CYGWIN__ # include @@ -159,8 +162,9 @@ #endif /* MSVC defines off_t in . - May also define off_t to a 64-bit type on native Windows. */ -/* Get off_t, ssize_t, mode_t. */ + May also define off_t to a 64-bit type on native Windows. + Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ +/* Get off_t, off64_t, ssize_t, mode_t. */ #include /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -180,6 +184,9 @@ _GL_INLINE_HEADER_BEGIN #ifndef _GL_UNISTD_INLINE # define _GL_UNISTD_INLINE _GL_INLINE #endif +#ifndef _GL_GETPAGESIZE_INLINE +# define _GL_GETPAGESIZE_INLINE _GL_INLINE +#endif /* Hide some function declarations from . */ @@ -286,7 +293,7 @@ _GL_INLINE_HEADER_BEGIN # undef access # define access rpl_access # endif -_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) +_GL_FUNCDECL_RPL (access, int, (const char *file, int mode), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); # elif defined _WIN32 && !defined __CYGWIN__ @@ -339,7 +346,7 @@ _GL_CXXALIASWARN (chdir); #elif defined GNULIB_POSIXCHECK # undef chdir # if HAVE_RAW_DECL_CHDIR -_GL_WARN_ON_USE (chown, "chdir is not always in - " +_GL_WARN_ON_USE (chdir, "chdir is not always in - " "use gnulib module chdir for portability"); # endif #elif @GNULIB_MDA_CHDIR@ @@ -370,13 +377,13 @@ _GL_CXXALIASWARN (chdir); # undef chown # define chown rpl_chown # endif -_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); # else # if !@HAVE_CHOWN@ -_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); # endif @@ -398,7 +405,7 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " # undef close # define close rpl_close # endif -_GL_FUNCDECL_RPL (close, int, (int fd)); +_GL_FUNCDECL_RPL (close, int, (int fd), ); _GL_CXXALIAS_RPL (close, int, (int fd)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -411,8 +418,10 @@ _GL_CXXALIAS_SYS (close, int, (int fd)); # endif _GL_CXXALIASWARN (close); #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ -# undef close -# define close close_used_without_requesting_gnulib_module_close +# if !GNULIB_CLOSE +# undef close +# define close close_used_without_requesting_gnulib_module_close +# endif #elif defined GNULIB_POSIXCHECK # undef close /* Assume close is always declared. */ @@ -443,7 +452,7 @@ _GL_CXXALIASWARN (close); # endif _GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, int ofd, off_t *opos, - size_t len, unsigned flags)); + size_t len, unsigned flags), ); _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, int ofd, off_t *opos, size_t len, unsigned flags)); @@ -451,13 +460,15 @@ _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, # if !@HAVE_COPY_FILE_RANGE@ _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, int ofd, off_t *opos, - size_t len, unsigned flags)); + size_t len, unsigned flags), ); # endif _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, int ofd, off_t *opos, size_t len, unsigned flags)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (copy_file_range); +# endif #elif defined GNULIB_POSIXCHECK # undef copy_file_range # if HAVE_RAW_DECL_COPY_FILE_RANGE @@ -473,7 +484,7 @@ _GL_WARN_ON_USE (copy_file_range, # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup rpl_dup # endif -_GL_FUNCDECL_RPL (dup, int, (int oldfd)); +_GL_FUNCDECL_RPL (dup, int, (int oldfd), _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (dup, int, (int oldfd)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -518,7 +529,7 @@ _GL_CXXALIASWARN (dup); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup2 rpl_dup2 # endif -_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); +_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd), ); _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -567,11 +578,11 @@ _GL_CXXALIASWARN (dup2); # undef dup3 # define dup3 rpl_dup3 # endif -_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); +_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags), ); _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); # else # if !@HAVE_DUP3@ -_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); +_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags), ); # endif _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); # endif @@ -636,7 +647,7 @@ rpl_environ (void) /* Like access(), except that it uses the effective user id and group id of the current process. */ # if !@HAVE_EUIDACCESS@ -_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) +_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); @@ -661,7 +672,7 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " # undef execl # define execl rpl_execl # endif -_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) +_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); # else @@ -696,7 +707,7 @@ _GL_CXXALIASWARN (execl); # undef execle # define execle rpl_execle # endif -_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) +_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); # else @@ -732,7 +743,7 @@ _GL_CXXALIASWARN (execle); # undef execlp # define execlp rpl_execlp # endif -_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) +_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); # else @@ -769,7 +780,7 @@ _GL_CXXALIASWARN (execlp); # undef execv # define execv rpl_execv # endif -_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) +_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); # else @@ -806,7 +817,7 @@ _GL_CXXALIASWARN (execv); # define execve rpl_execve # endif _GL_FUNCDECL_RPL (execve, int, - (const char *program, char * const *argv, char * const *env) + (const char *program, char * const *argv, char * const *env), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (execve, int, (const char *program, char * const *argv, char * const *env)); @@ -846,7 +857,7 @@ _GL_CXXALIASWARN (execve); # undef execvp # define execvp rpl_execvp # endif -_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) +_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); # else @@ -883,14 +894,14 @@ _GL_CXXALIASWARN (execvp); # define execvpe rpl_execvpe # endif _GL_FUNCDECL_RPL (execvpe, int, - (const char *program, char * const *argv, char * const *env) + (const char *program, char * const *argv, char * const *env), _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (execvpe, int, (const char *program, char * const *argv, char * const *env)); # else # if !@HAVE_DECL_EXECVPE@ _GL_FUNCDECL_SYS (execvpe, int, - (const char *program, char * const *argv, char * const *env) + (const char *program, char * const *argv, char * const *env), _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (execvpe, int, @@ -921,7 +932,7 @@ _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t, # elif @HAVE_EXECVPE@ # if !@HAVE_DECL_EXECVPE@ _GL_FUNCDECL_SYS (execvpe, int, - (const char *program, char * const *argv, char * const *env) + (const char *program, char * const *argv, char * const *env), _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (execvpe, int, @@ -940,15 +951,15 @@ _GL_CXXALIASWARN (execvpe); # define faccessat rpl_faccessat # endif _GL_FUNCDECL_RPL (faccessat, int, - (int fd, char const *name, int mode, int flag) - _GL_ARG_NONNULL ((2))); + (int fd, char const *name, int mode, int flag), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (faccessat, int, (int fd, char const *name, int mode, int flag)); # else # if !@HAVE_FACCESSAT@ _GL_FUNCDECL_SYS (faccessat, int, - (int fd, char const *file, int mode, int flag) - _GL_ARG_NONNULL ((2))); + (int fd, char const *file, int mode, int flag), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (faccessat, int, (int fd, char const *file, int mode, int flag)); @@ -976,11 +987,11 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " # undef fchdir # define fchdir rpl_fchdir # endif -_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/)); +_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/)); # else # if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@ -_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); +_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); # endif @@ -1009,15 +1020,15 @@ _GL_WARN_ON_USE (fchdir, "fchdir is unportable - " # define fchownat rpl_fchownat # endif _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, - uid_t owner, gid_t group, int flag) - _GL_ARG_NONNULL ((2))); + uid_t owner, gid_t group, int flag), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag)); # else # if !@HAVE_FCHOWNAT@ _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, - uid_t owner, gid_t group, int flag) - _GL_ARG_NONNULL ((2))); + uid_t owner, gid_t group, int flag), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, uid_t owner, gid_t group, int flag)); @@ -1042,11 +1053,11 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " # undef fdatasync # define fdatasync rpl_fdatasync # endif -_GL_FUNCDECL_RPL (fdatasync, int, (int fd)); +_GL_FUNCDECL_RPL (fdatasync, int, (int fd), ); _GL_CXXALIAS_RPL (fdatasync, int, (int fd)); # else # if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@ -_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); +_GL_FUNCDECL_SYS (fdatasync, int, (int fd), ); # endif _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); # endif @@ -1068,7 +1079,7 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " See POSIX:2008 specification . */ # if !@HAVE_FSYNC@ -_GL_FUNCDECL_SYS (fsync, int, (int fd)); +_GL_FUNCDECL_SYS (fsync, int, (int fd), ); # endif _GL_CXXALIAS_SYS (fsync, int, (int fd)); _GL_CXXALIASWARN (fsync); @@ -1091,13 +1102,17 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - " # undef ftruncate # define ftruncate rpl_ftruncate # endif -_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); -_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); +_GL_FUNCDECL_RPL (ftruncate, int, + (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_RPL (ftruncate, int, + (int fd, off_t length)); # else # if !@HAVE_FTRUNCATE@ -_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); +_GL_FUNCDECL_SYS (ftruncate, int, + (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD); # endif -_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); +_GL_CXXALIAS_SYS (ftruncate, int, + (int fd, off_t length)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (ftruncate); @@ -1126,7 +1141,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getcwd rpl_getcwd # endif -_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); +_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size), + _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1181,15 +1197,19 @@ _GL_CXXALIASWARN (getcwd); # undef getdomainname # define getdomainname rpl_getdomainname # endif -_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); +_GL_FUNCDECL_RPL (getdomainname, int, + (char *name, size_t len), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_RPL (getdomainname, int, + (char *name, size_t len)); # else # if !@HAVE_DECL_GETDOMAINNAME@ -_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (getdomainname, int, + (char *name, size_t len), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif -_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); +_GL_CXXALIAS_SYS (getdomainname, int, + (char *name, size_t len)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (getdomainname); @@ -1211,11 +1231,11 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " # undef getdtablesize # define getdtablesize rpl_getdtablesize # endif -_GL_FUNCDECL_RPL (getdtablesize, int, (void)); +_GL_FUNCDECL_RPL (getdtablesize, int, (void), ); _GL_CXXALIAS_RPL (getdtablesize, int, (void)); # else # if !@HAVE_GETDTABLESIZE@ -_GL_FUNCDECL_SYS (getdtablesize, int, (void)); +_GL_FUNCDECL_SYS (getdtablesize, int, (void), ); # endif /* Need to cast, because on AIX, the parameter list is (...). */ @@ -1238,13 +1258,17 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " # undef getentropy # define getentropy rpl_getentropy # endif -_GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length)); -_GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length)); +_GL_FUNCDECL_RPL (getentropy, int, + (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_RPL (getentropy, int, + (void *buffer, size_t length)); # else # if !@HAVE_GETENTROPY@ -_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); +_GL_FUNCDECL_SYS (getentropy, int, + (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD); # endif -_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); +_GL_CXXALIAS_SYS (getentropy, int, + (void *buffer, size_t length)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (getentropy); @@ -1269,13 +1293,17 @@ _GL_WARN_ON_USE (getentropy, "getentropy is unportable - " # undef getgroups # define getgroups rpl_getgroups # endif -_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); -_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); +_GL_FUNCDECL_RPL (getgroups, int, + (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_RPL (getgroups, int, + (int n, gid_t *groups)); # else # if !@HAVE_GETGROUPS@ -_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); +_GL_FUNCDECL_SYS (getgroups, int, + (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD); # endif -_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); +_GL_CXXALIAS_SYS (getgroups, int, + (int n, gid_t *groups)); # endif _GL_CXXALIASWARN (getgroups); #elif defined GNULIB_POSIXCHECK @@ -1300,12 +1328,12 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " # undef gethostname # define gethostname rpl_gethostname # endif -_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) +_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); # else # if !@HAVE_GETHOSTNAME@ -_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) +_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len), _GL_ARG_NONNULL ((1))); # endif /* 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)); # endif _GL_CXXALIASWARN (gethostname); #elif @UNISTD_H_HAVE_WINSOCK2_H@ -# undef gethostname -# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname +# if !GNULIB_GETHOSTNAME +# undef gethostname +# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname +# endif #elif defined GNULIB_POSIXCHECK # undef gethostname # if HAVE_RAW_DECL_GETHOSTNAME @@ -1337,11 +1367,21 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ -# if !@HAVE_DECL_GETLOGIN@ -_GL_FUNCDECL_SYS (getlogin, char *, (void)); -# endif +# if @REPLACE_GETLOGIN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getlogin rpl_getlogin +# endif +_GL_FUNCDECL_RPL (getlogin, char *, (void), ); +_GL_CXXALIAS_RPL (getlogin, char *, (void)); +# else +# if !@HAVE_DECL_GETLOGIN@ +_GL_FUNCDECL_SYS (getlogin, char *, (void), ); +# endif _GL_CXXALIAS_SYS (getlogin, char *, (void)); +# endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (getlogin); +# endif #elif defined GNULIB_POSIXCHECK # undef getlogin # if HAVE_RAW_DECL_GETLOGIN @@ -1370,12 +1410,12 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getlogin_r rpl_getlogin_r # endif -_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) +_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); # else # if !@HAVE_DECL_GETLOGIN_R@ -_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) +_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size), _GL_ARG_NONNULL ((1))); # endif /* 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 - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getpagesize rpl_getpagesize # endif -_GL_FUNCDECL_RPL (getpagesize, int, (void)); +_GL_FUNCDECL_RPL (getpagesize, int, (void), ); _GL_CXXALIAS_RPL (getpagesize, int, (void)); # else /* On HP-UX, getpagesize exists, but it is not declared in even if the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ # if defined __hpux -_GL_FUNCDECL_SYS (getpagesize, int, (void)); +_GL_FUNCDECL_SYS (getpagesize, int, (void), ); # endif # if !@HAVE_GETPAGESIZE@ # if !defined getpagesize @@ -1456,7 +1496,7 @@ _GL_FUNCDECL_SYS (getpagesize, int, (void)); # define getpagesize() _gl_getpagesize () # else # if !GNULIB_defined_getpagesize_function -_GL_UNISTD_INLINE int +_GL_GETPAGESIZE_INLINE int getpagesize () { return _gl_getpagesize (); @@ -1492,12 +1532,12 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " # undef getpass # define getpass rpl_getpass # endif -_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) +_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); # else # if !@HAVE_GETPASS@ -_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) +_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); @@ -1530,12 +1570,21 @@ _GL_CXXALIASWARN (getpid); #if @GNULIB_GETUSERSHELL@ +# if @REPLACE_GETUSERSHELL@ /* Return the next valid login shell on the system, or NULL when the end of the list has been reached. */ -# if !@HAVE_DECL_GETUSERSHELL@ -_GL_FUNCDECL_SYS (getusershell, char *, (void)); -# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getusershell +# define getusershell rpl_getusershell +# endif +_GL_FUNCDECL_RPL (getusershell, char *, (void), ); +_GL_CXXALIAS_RPL (getusershell, char *, (void)); +# else +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (getusershell, char *, (void), ); +# endif _GL_CXXALIAS_SYS (getusershell, char *, (void)); +# endif _GL_CXXALIASWARN (getusershell); #elif defined GNULIB_POSIXCHECK # undef getusershell @@ -1547,10 +1596,19 @@ _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " #if @GNULIB_GETUSERSHELL@ /* Rewind to pointer that is advanced at each getusershell() call. */ -# if !@HAVE_DECL_GETUSERSHELL@ -_GL_FUNCDECL_SYS (setusershell, void, (void)); -# endif +# if @REPLACE_GETUSERSHELL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setusershell +# define setusershell rpl_setusershell +# endif +_GL_FUNCDECL_RPL (setusershell, void, (void), ); +_GL_CXXALIAS_RPL (setusershell, void, (void)); +# else +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (setusershell, void, (void), ); +# endif _GL_CXXALIAS_SYS (setusershell, void, (void)); +# endif _GL_CXXALIASWARN (setusershell); #elif defined GNULIB_POSIXCHECK # undef setusershell @@ -1563,10 +1621,19 @@ _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " #if @GNULIB_GETUSERSHELL@ /* Free the pointer that is advanced at each getusershell() call and associated resources. */ -# if !@HAVE_DECL_GETUSERSHELL@ -_GL_FUNCDECL_SYS (endusershell, void, (void)); -# endif +# if @REPLACE_GETUSERSHELL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef endusershell +# define endusershell rpl_endusershell +# endif +_GL_FUNCDECL_RPL (endusershell, void, (void), ); +_GL_CXXALIAS_RPL (endusershell, void, (void)); +# else +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (endusershell, void, (void), ); +# endif _GL_CXXALIAS_SYS (endusershell, void, (void)); +# endif _GL_CXXALIASWARN (endusershell); #elif defined GNULIB_POSIXCHECK # undef endusershell @@ -1580,7 +1647,7 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " #if @GNULIB_GROUP_MEMBER@ /* Determine whether group id is in calling user's group list. */ # if !@HAVE_GROUP_MEMBER@ -_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); +_GL_FUNCDECL_SYS (group_member, int, (gid_t gid), ); # endif _GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); _GL_CXXALIASWARN (group_member); @@ -1600,7 +1667,7 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - " # define isatty rpl_isatty # endif # define GNULIB_defined_isatty 1 -_GL_FUNCDECL_RPL (isatty, int, (int fd)); +_GL_FUNCDECL_RPL (isatty, int, (int fd), ); _GL_CXXALIAS_RPL (isatty, int, (int fd)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1646,13 +1713,13 @@ _GL_CXXALIASWARN (isatty); # undef lchown # define lchown rpl_lchown # endif -_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); # else # if !@HAVE_LCHOWN@ -_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); # endif @@ -1675,13 +1742,13 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define link rpl_link # endif -_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) - _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2), + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); # else # if !@HAVE_LINK@ -_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) - _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2), + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); # endif @@ -1706,8 +1773,8 @@ _GL_WARN_ON_USE (link, "link is unportable - " # endif _GL_FUNCDECL_RPL (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, - int flag) - _GL_ARG_NONNULL ((2, 4))); + int flag), + _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, int flag)); @@ -1715,8 +1782,8 @@ _GL_CXXALIAS_RPL (linkat, int, # if !@HAVE_LINKAT@ _GL_FUNCDECL_SYS (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, - int flag) - _GL_ARG_NONNULL ((2, 4))); + int flag), + _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (linkat, int, (int fd1, const char *path1, int fd2, const char *path2, @@ -1743,7 +1810,7 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lseek rpl_lseek # endif -_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); +_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence), ); _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1783,7 +1850,8 @@ _GL_CXXALIASWARN (lseek); Store the read-end as fd[0] and the write-end as fd[1]. Return 0 upon success, or -1 with errno set upon failure. */ # if !@HAVE_PIPE@ -_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (pipe, int, (int fd[2]), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (pipe, int, (int fd[2])); _GL_CXXALIASWARN (pipe); @@ -1810,10 +1878,12 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - " # undef pipe2 # define pipe2 rpl_pipe2 # endif -_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); # else -_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); # endif # if __GLIBC__ >= 2 @@ -1840,15 +1910,15 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " # define pread rpl_pread # endif _GL_FUNCDECL_RPL (pread, ssize_t, - (int fd, void *buf, size_t bufsize, off_t offset) - _GL_ARG_NONNULL ((2))); + (int fd, void *buf, size_t bufsize, off_t offset), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset)); # else # if !@HAVE_PREAD@ _GL_FUNCDECL_SYS (pread, ssize_t, - (int fd, void *buf, size_t bufsize, off_t offset) - _GL_ARG_NONNULL ((2))); + (int fd, void *buf, size_t bufsize, off_t offset), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (pread, ssize_t, (int fd, void *buf, size_t bufsize, off_t offset)); @@ -1877,15 +1947,15 @@ _GL_WARN_ON_USE (pread, "pread is unportable - " # define pwrite rpl_pwrite # endif _GL_FUNCDECL_RPL (pwrite, ssize_t, - (int fd, const void *buf, size_t bufsize, off_t offset) - _GL_ARG_NONNULL ((2))); + (int fd, const void *buf, size_t bufsize, off_t offset), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset)); # else # if !@HAVE_PWRITE@ _GL_FUNCDECL_SYS (pwrite, ssize_t, - (int fd, const void *buf, size_t bufsize, off_t offset) - _GL_ARG_NONNULL ((2))); + (int fd, const void *buf, size_t bufsize, off_t offset), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (pwrite, ssize_t, (int fd, const void *buf, size_t bufsize, off_t offset)); @@ -1911,8 +1981,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " # undef read # define read rpl_read # endif -_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) - _GL_ARG_NONNULL ((2))); + +_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1933,11 +2004,7 @@ _GL_CXXALIASWARN (read); # undef read # define read _read # endif -# ifdef __MINGW32__ -_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count)); -# else -_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count)); -# endif +_GL_CXXALIAS_MDA_CAST (read, ssize_t, (int fd, void *buf, unsigned int count)); # else _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); # endif @@ -1957,8 +2024,8 @@ _GL_CXXALIASWARN (read); # endif _GL_FUNCDECL_RPL (readlink, ssize_t, (const char *restrict file, - char *restrict buf, size_t bufsize) - _GL_ARG_NONNULL ((1, 2))); + char *restrict buf, size_t bufsize), + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (readlink, ssize_t, (const char *restrict file, char *restrict buf, size_t bufsize)); @@ -1966,8 +2033,8 @@ _GL_CXXALIAS_RPL (readlink, ssize_t, # if !@HAVE_READLINK@ _GL_FUNCDECL_SYS (readlink, ssize_t, (const char *restrict file, - char *restrict buf, size_t bufsize) - _GL_ARG_NONNULL ((1, 2))); + char *restrict buf, size_t bufsize), + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (readlink, ssize_t, (const char *restrict file, @@ -1990,8 +2057,8 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - " # endif _GL_FUNCDECL_RPL (readlinkat, ssize_t, (int fd, char const *restrict file, - char *restrict buf, size_t len) - _GL_ARG_NONNULL ((2, 3))); + char *restrict buf, size_t len), + _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (readlinkat, ssize_t, (int fd, char const *restrict file, char *restrict buf, size_t len)); @@ -1999,8 +2066,8 @@ _GL_CXXALIAS_RPL (readlinkat, ssize_t, # if !@HAVE_READLINKAT@ _GL_FUNCDECL_SYS (readlinkat, ssize_t, (int fd, char const *restrict file, - char *restrict buf, size_t len) - _GL_ARG_NONNULL ((2, 3))); + char *restrict buf, size_t len), + _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (readlinkat, ssize_t, (int fd, char const *restrict file, @@ -2024,7 +2091,7 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define rmdir rpl_rmdir # endif -_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (rmdir, int, (char const *name), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (rmdir, int, (char const *name)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -2073,18 +2140,22 @@ _GL_CXXALIASWARN (rmdir); # undef sethostname # define sethostname rpl_sethostname # endif -_GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len)); +_GL_FUNCDECL_RPL (sethostname, int, + (const char *name, size_t len), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_RPL (sethostname, int, + (const char *name, size_t len)); # else # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ -_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (sethostname, int, + (const char *name, size_t len), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 and FreeBSD 6.4 the second parameter is int. On Solaris 11 2011-10, the first parameter is not const. */ -_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); +_GL_CXXALIAS_SYS_CAST (sethostname, int, + (const char *name, size_t len)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (sethostname); @@ -2108,11 +2179,11 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " # undef sleep # define sleep rpl_sleep # endif -_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); +_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n), ); _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); # else # if !@HAVE_SLEEP@ -_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); +_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n), ); # endif _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); # endif @@ -2157,15 +2228,19 @@ _GL_CXXALIASWARN (swab); # undef symlink # define symlink rpl_symlink # endif -_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); +_GL_FUNCDECL_RPL (symlink, int, + (char const *contents, char const *file), + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_RPL (symlink, int, + (char const *contents, char const *file)); # else # if !@HAVE_SYMLINK@ -_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) - _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_SYS (symlink, int, + (char const *contents, char const *file), + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD); # endif -_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); +_GL_CXXALIAS_SYS (symlink, int, + (char const *contents, char const *file)); # endif _GL_CXXALIASWARN (symlink); #elif defined GNULIB_POSIXCHECK @@ -2184,15 +2259,15 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - " # define symlinkat rpl_symlinkat # endif _GL_FUNCDECL_RPL (symlinkat, int, - (char const *contents, int fd, char const *file) - _GL_ARG_NONNULL ((1, 3))); + (char const *contents, int fd, char const *file), + _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (symlinkat, int, (char const *contents, int fd, char const *file)); # else # if !@HAVE_SYMLINKAT@ _GL_FUNCDECL_SYS (symlinkat, int, - (char const *contents, int fd, char const *file) - _GL_ARG_NONNULL ((1, 3))); + (char const *contents, int fd, char const *file), + _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (symlinkat, int, (char const *contents, int fd, char const *file)); @@ -2219,13 +2294,13 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " # undef truncate # define truncate rpl_truncate # endif -_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); # else # if !@HAVE_DECL_TRUNCATE@ -_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length), + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); # endif @@ -2250,13 +2325,15 @@ _GL_WARN_ON_USE (truncate, "truncate is unportable - " # define ttyname_r rpl_ttyname_r # endif _GL_FUNCDECL_RPL (ttyname_r, int, - (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); + (int fd, char *buf, size_t buflen), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); _GL_CXXALIAS_RPL (ttyname_r, int, (int fd, char *buf, size_t buflen)); # else # if !@HAVE_DECL_TTYNAME_R@ _GL_FUNCDECL_SYS (ttyname_r, int, - (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); + (int fd, char *buf, size_t buflen), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); # endif _GL_CXXALIAS_SYS (ttyname_r, int, (int fd, char *buf, size_t buflen)); @@ -2279,7 +2356,7 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " # undef unlink # define unlink rpl_unlink # endif -_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (unlink, int, (char const *file), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (unlink, int, (char const *file)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -2320,12 +2397,12 @@ _GL_CXXALIASWARN (unlink); # undef unlinkat # define unlinkat rpl_unlinkat # endif -_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) +_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); # else # if !@HAVE_UNLINKAT@ -_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) +_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag), _GL_ARG_NONNULL ((2))); # endif _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 - " #if @GNULIB_USLEEP@ /* Pause the execution of the current thread for N microseconds. Returns 0 on completion, or -1 on range error. - See the POSIX:2001 specification + See the POSIX.1-2004 specification . */ # if @REPLACE_USLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef usleep # define usleep rpl_usleep # endif -_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); +_GL_FUNCDECL_RPL (usleep, int, (useconds_t n), ); _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); # else # if !@HAVE_USLEEP@ -_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); +_GL_FUNCDECL_SYS (usleep, int, (useconds_t n), ); # endif /* Need to cast, because on Haiku, the first parameter is unsigned int n. */ @@ -2379,17 +2456,21 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " # undef write # define write rpl_write # endif -_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); +_GL_FUNCDECL_RPL (write, ssize_t, + (int fd, const void *buf, size_t count), + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD); +_GL_CXXALIAS_RPL (write, ssize_t, + (int fd, const void *buf, size_t count)); # elif defined _WIN32 && !defined __CYGWIN__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write # define write _write # endif -_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); +_GL_CXXALIAS_MDA (write, ssize_t, + (int fd, const void *buf, size_t count)); # else -_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); +_GL_CXXALIAS_SYS (write, ssize_t, + (int fd, const void *buf, size_t count)); # endif _GL_CXXALIASWARN (write); #elif @GNULIB_MDA_WRITE@ @@ -2401,13 +2482,11 @@ _GL_CXXALIASWARN (write); # undef write # define write _write # endif -# ifdef __MINGW32__ -_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); -# else -_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count)); -# endif +_GL_CXXALIAS_MDA_CAST (write, ssize_t, + (int fd, const void *buf, unsigned int count)); # else -_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); +_GL_CXXALIAS_SYS (write, ssize_t, + (int fd, const void *buf, size_t count)); # endif _GL_CXXALIASWARN (write); #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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Elementary types and macros for the GNU UniString library. + Copyright (C) 2002, 2005-2006, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNITYPES_H +#define _UNITYPES_H + +/* Get uint8_t, uint16_t, uint32_t. */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Type representing a Unicode character. */ +typedef uint32_t ucs4_t; + +/* Attribute of a function whose result depends only on the arguments + (not pointers!) and which has no side effects. */ +#ifndef _UC_ATTRIBUTE_CONST +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__ +# define _UC_ATTRIBUTE_CONST __attribute__ ((__const__)) +# else +# define _UC_ATTRIBUTE_CONST +# endif +#endif + +/* Attribute of a function whose result depends only on the arguments + (possibly pointers) and global memory, and which has no side effects. */ +#ifndef _UC_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _UC_ATTRIBUTE_PURE +# endif +#endif + +/* Qualifier in a function declaration, that asserts that the caller must + pass a pointer to a different object in the specified pointer argument + than in the other pointer arguments. */ +#ifndef _UC_RESTRICT +# if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 +# define _UC_RESTRICT __restrict +# elif 199901L <= __STDC_VERSION__ || defined restrict +# define _UC_RESTRICT restrict +# else +# define _UC_RESTRICT +# endif +#endif + + +#ifdef __cplusplus +} +#endif + +#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 @@ +/* Elementary types and macros for the GNU UniString library. + Copyright (C) 2002, 2005-2006, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNITYPES_H +#define _UNITYPES_H + +/* Get uint8_t, uint16_t, uint32_t. */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Type representing a Unicode character. */ +typedef uint32_t ucs4_t; + +/* Attribute of a function whose result depends only on the arguments + (not pointers!) and which has no side effects. */ +#ifndef _UC_ATTRIBUTE_CONST +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__ +# define _UC_ATTRIBUTE_CONST __attribute__ ((__const__)) +# else +# define _UC_ATTRIBUTE_CONST +# endif +#endif + +/* Attribute of a function whose result depends only on the arguments + (possibly pointers) and global memory, and which has no side effects. */ +#ifndef _UC_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _UC_ATTRIBUTE_PURE +# endif +#endif + +/* Qualifier in a function declaration, that asserts that the caller must + pass a pointer to a different object in the specified pointer argument + than in the other pointer arguments. */ +#ifndef _UC_RESTRICT +# if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 +# define _UC_RESTRICT __restrict +# elif 199901L <= __STDC_VERSION__ || defined restrict +# define _UC_RESTRICT restrict +# else +# define _UC_RESTRICT +# endif +#endif + + +#ifdef __cplusplus +} +#endif + +#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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Display width functions. + Copyright (C) 2001-2002, 2005, 2007, 2009-2025 Free Software Foundation, + Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNIWIDTH_H +#define _UNIWIDTH_H + +#include "unitypes.h" + +/* Get size_t. */ +#include + +/* Get locale_charset() declaration. */ +#include "localcharset.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Display width. */ + +/* These functions are locale dependent. The encoding argument identifies + the encoding (e.g. "ISO-8859-2" for Polish). */ + +/* Determine number of column positions required for UC. */ +extern int + uc_width (ucs4_t uc, const char *encoding) + _UC_ATTRIBUTE_PURE; + +/* Determine number of column positions required for first N units + (or fewer if S ends before this) in S. */ +extern int + u8_width (const uint8_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u16_width (const uint16_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u32_width (const uint32_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; + +/* Determine number of column positions required for S. */ +extern int + u8_strwidth (const uint8_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u16_strwidth (const uint16_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u32_strwidth (const uint32_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; + + +#ifdef __cplusplus +} +#endif + +#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 @@ +/* Display width functions. + Copyright (C) 2001-2002, 2005, 2007, 2009-2025 Free Software Foundation, + Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _UNIWIDTH_H +#define _UNIWIDTH_H + +#include "unitypes.h" + +/* Get size_t. */ +#include + +/* Get locale_charset() declaration. */ +#include "localcharset.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Display width. */ + +/* These functions are locale dependent. The encoding argument identifies + the encoding (e.g. "ISO-8859-2" for Polish). */ + +/* Determine number of column positions required for UC. */ +extern int + uc_width (ucs4_t uc, const char *encoding) + _UC_ATTRIBUTE_PURE; + +/* Determine number of column positions required for first N units + (or fewer if S ends before this) in S. */ +extern int + u8_width (const uint8_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u16_width (const uint16_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u32_width (const uint32_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; + +/* Determine number of column positions required for S. */ +extern int + u8_strwidth (const uint8_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u16_strwidth (const uint16_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u32_strwidth (const uint32_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; + + +#ifdef __cplusplus +} +#endif + +#endif /* _UNIWIDTH_H */ diff --git a/gl/uniwidth/.deps/.dirstamp b/gl/uniwidth/.deps/.dirstamp new file mode 100644 index 00000000..e69de29b 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 @@ +uniwidth/libgnu_a-width.o: uniwidth/width.c /usr/include/stdc-predef.h \ + ../config.h uniwidth.h unitypes.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/features-time64.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/timesize.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/time64.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \ + /usr/include/x86_64-linux-gnu/bits/stdint-least.h stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h localcharset.h \ + uniwidth/cjk.h streq.h string.h /usr/include/string.h \ + /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h strings.h \ + /usr/include/strings.h uniwidth/width0.h uniwidth/width2.h \ + unictype/bitmap.h +/usr/include/stdc-predef.h: +../config.h: +uniwidth.h: +unitypes.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h: +/usr/include/stdint.h: +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h: +/usr/include/features.h: +/usr/include/features-time64.h: +/usr/include/x86_64-linux-gnu/bits/wordsize.h: +/usr/include/x86_64-linux-gnu/bits/timesize.h: +/usr/include/x86_64-linux-gnu/sys/cdefs.h: +/usr/include/x86_64-linux-gnu/bits/long-double.h: +/usr/include/x86_64-linux-gnu/gnu/stubs.h: +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: +/usr/include/x86_64-linux-gnu/bits/types.h: +/usr/include/x86_64-linux-gnu/bits/typesizes.h: +/usr/include/x86_64-linux-gnu/bits/time64.h: +/usr/include/x86_64-linux-gnu/bits/wchar.h: +/usr/include/x86_64-linux-gnu/bits/stdint-intn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h: +/usr/include/x86_64-linux-gnu/bits/stdint-least.h: +stddef.h: +/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h: +localcharset.h: +uniwidth/cjk.h: +streq.h: +string.h: +/usr/include/string.h: +/usr/include/x86_64-linux-gnu/bits/types/locale_t.h: +/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h: +strings.h: +/usr/include/strings.h: +uniwidth/width0.h: +uniwidth/width2.h: +unictype/bitmap.h: diff --git a/gl/uniwidth/.dirstamp b/gl/uniwidth/.dirstamp new file mode 100644 index 00000000..e69de29b 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 @@ +/* Test for CJK encoding. + Copyright (C) 2001-2002, 2005-2007, 2009-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include "streq.h" + +static int +is_cjk_encoding (const char *encoding) +{ + if (0 + /* Legacy Japanese encodings */ + || STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0) + /* Legacy Chinese encodings */ + || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) + || STREQ_OPT (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0) + || STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0) + || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0) + /* Legacy Korean encodings */ + || STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + || STREQ_OPT (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0) + || STREQ_OPT (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0)) + return 1; + return 0; +} 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 @@ +/* Determine display width of Unicode character. + Copyright (C) 2001-2002, 2006-2025 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "uniwidth.h" + +#include "cjk.h" + +/* The non-spacing attribute table consists of: + * Non-spacing characters; generated from PropList.txt or + "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt" + * Format control characters; generated from + "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt" + * Zero width characters; generated from + "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt" + * Hangul Jamo characters that have conjoining behaviour: + - jungseong = syllable-middle vowels + - jongseong = syllable-final consonants + Rationale: + 1) These characters act like combining characters. They have no + equivalent in legacy character sets. Therefore the EastAsianWidth.txt + file does not really matter for them; UAX #11 East Asian Width + makes it clear that it focus + is on compatibility with traditional Japanese layout. + By contrast, the same glyphs without conjoining behaviour are available + in the U+3130..U+318F block, and these characters are mapped to legacy + character sets, and traditional Japanese layout matters for them. + 2) glibc does the same thing, see + + + */ +#include "uniwidth/width0.h" + +#include "uniwidth/width2.h" +#include "unictype/bitmap.h" + +#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) + + +/* Determine number of column positions required for UC. */ +int +uc_width (ucs4_t uc, const char *encoding) +{ + /* Test for non-spacing or control character. */ + if ((uc >> 9) < SIZEOF (nonspacing_table_ind)) + { + int ind = nonspacing_table_ind[uc >> 9]; + if (ind >= 0) + if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1) + { + if (uc > 0 && uc < 0xa0) + return -1; + else + return 0; + } + } + else if ((uc >> 9) == (0xe0000 >> 9)) + { + if (uc >= 0xe0100) + { + if (uc <= 0xe01ef) + return 0; + } + else + { + if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001) + return 0; + } + } + /* Test for double-width character. */ + if (bitmap_lookup (&u_width2, uc)) + return 2; + /* In ancient CJK encodings, Cyrillic and most other characters are + double-width as well. */ + if (uc >= 0x00A1 && uc < 0xFF61 && uc != 0x20A9 + && is_cjk_encoding (encoding)) + return 2; + return 1; +} 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Table of non-spacing or control characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +static const unsigned char nonspacing_table_data[49*64] = { + /* 0x0000-0x01ff */ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, /* 0x0080-0x00bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00c0-0x00ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0100-0x013f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0140-0x017f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0180-0x01bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x01c0-0x01ff */ + /* 0x0200-0x03ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0200-0x023f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0240-0x027f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0280-0x02bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x02c0-0x02ff */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x0300-0x033f */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x0340-0x037f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0380-0x03bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x03c0-0x03ff */ + /* 0x0400-0x05ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0400-0x043f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0440-0x047f */ + 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0480-0x04bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04c0-0x04ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0500-0x053f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0540-0x057f */ + 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, /* 0x0580-0x05bf */ + 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */ + /* 0x0600-0x07ff */ + 0x00, 0x00, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */ + 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */ + 0x00, 0x00, 0xc0, 0x9f, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */ + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */ + 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x20, /* 0x07c0-0x07ff */ + /* 0x0800-0x09ff */ + 0x00, 0x00, 0xc0, 0xfb, 0xef, 0x3e, 0x00, 0x00, /* 0x0800-0x083f */ + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */ + 0x00, 0x00, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */ + 0x00, 0xfc, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, /* 0x08c0-0x08ff */ + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, /* 0x0900-0x093f */ + 0xfe, 0x21, 0xfe, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */ + 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x40, /* 0x09c0-0x09ff */ + /* 0x0a00-0x0bff */ + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a00-0x0a3f */ + 0x86, 0x39, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, /* 0x0a40-0x0a7f */ + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a80-0x0abf */ + 0xbe, 0x21, 0x00, 0x00, 0x0c, 0x00, 0x00, 0xfc, /* 0x0ac0-0x0aff */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0x0b00-0x0b3f */ + 0x1e, 0x20, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0b40-0x0b7f */ + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */ + 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */ + /* 0x0c00-0x0dff */ + 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, /* 0x0c00-0x0c3f */ + 0xc1, 0x3d, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */ + 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, /* 0x0d00-0x0d3f */ + 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */ + 0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */ + /* 0x0e00-0x0fff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x07, /* 0x0e00-0x0e3f */ + 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0e40-0x0e7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1f, /* 0x0e80-0x0ebf */ + 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */ + 0xdf, 0xe0, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */ + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */ + /* 0x1000-0x11ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xfd, 0x66, /* 0x1000-0x103f */ + 0x00, 0x00, 0x00, 0xc3, 0x01, 0x00, 0x1e, 0x00, /* 0x1040-0x107f */ + 0x64, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */ + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x1140-0x117f */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x1180-0x11bf */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x11c0-0x11ff */ + /* 0x1200-0x13ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1200-0x123f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1240-0x127f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1280-0x12bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x12c0-0x12ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1300-0x133f */ + 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1380-0x13bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13c0-0x13ff */ + /* 0x1600-0x17ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1600-0x163f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1640-0x167f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1680-0x16bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16c0-0x16ff */ + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1700-0x173f */ + 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1740-0x177f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */ + 0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */ + /* 0x1800-0x19ff */ + 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */ + 0x60, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */ + 0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x04, 0x0e, /* 0x1900-0x193f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */ + /* 0x1a00-0x1bff */ + 0x00, 0x00, 0x80, 0x09, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */ + 0x00, 0x00, 0x40, 0x7f, 0xe5, 0x1f, 0xf8, 0x9f, /* 0x1a40-0x1a7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x1a80-0x1abf */ + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ac0-0x1aff */ + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */ + 0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */ + 0x03, 0x00, 0x00, 0x00, 0x3c, 0x3b, 0x00, 0x00, /* 0x1b80-0x1bbf */ + 0x00, 0x00, 0x00, 0x00, 0x40, 0xa3, 0x03, 0x00, /* 0x1bc0-0x1bff */ + /* 0x1c00-0x1dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x00, /* 0x1c00-0x1c3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */ + 0x00, 0x00, 0xf7, 0xff, 0xfd, 0x21, 0x10, 0x03, /* 0x1cc0-0x1cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x1dc0-0x1dff */ + /* 0x2000-0x21ff */ + 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */ + 0x00, 0x00, 0x00, 0x00, 0xdf, 0xff, 0x00, 0x00, /* 0x2040-0x207f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */ + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* 0x20c0-0x20ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2140-0x217f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2180-0x21bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x21c0-0x21ff */ + /* 0x2c00-0x2dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c00-0x2c3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c40-0x2c7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c80-0x2cbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, /* 0x2cc0-0x2cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d00-0x2d3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x2d40-0x2d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d80-0x2dbf */ + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x2dc0-0x2dff */ + /* 0x3000-0x31ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x3000-0x303f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */ + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3100-0x313f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3140-0x317f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3180-0x31bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */ + /* 0xa600-0xa7ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa600-0xa63f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf7, 0x3f, /* 0xa640-0xa67f */ + 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, /* 0xa680-0xa6bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0xa6c0-0xa6ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa700-0xa73f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa740-0xa77f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa780-0xa7bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa7c0-0xa7ff */ + /* 0xa800-0xa9ff */ + 0x44, 0x08, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, /* 0xa800-0xa83f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */ + 0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x80, /* 0xa8c0-0xa8ff */ + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, /* 0xa900-0xa93f */ + 0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */ + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x33, /* 0xa980-0xa9bf */ + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */ + /* 0xaa00-0xabff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x66, 0x00, /* 0xaa00-0xaa3f */ + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0xaa40-0xaa7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0xc1, /* 0xaa80-0xaabf */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x30, 0x40, 0x00, /* 0xaac0-0xaaff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab00-0xab3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab40-0xab7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab80-0xabbf */ + 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00, /* 0xabc0-0xabff */ + /* 0xd600-0xd7ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd600-0xd63f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd640-0xd67f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd680-0xd6bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd6c0-0xd6ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd700-0xd73f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd740-0xd77f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0xd780-0xd7bf */ + 0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, /* 0xd7c0-0xd7ff */ + /* 0xfa00-0xfbff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa80-0xfabf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfac0-0xfaff */ + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0xfb00-0xfb3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb40-0xfb7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */ + /* 0xfe00-0xffff */ + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, /* 0xfe00-0xfe3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff00-0xff3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff40-0xff7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff80-0xffbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, /* 0xffc0-0xffff */ + /* 0x10000-0x101ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10000-0x1003f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10040-0x1007f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10080-0x100bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x100c0-0x100ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10100-0x1013f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10140-0x1017f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10180-0x101bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, /* 0x101c0-0x101ff */ + /* 0x10200-0x103ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10200-0x1023f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10240-0x1027f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10280-0x102bf */ + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* 0x102c0-0x102ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10300-0x1033f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, /* 0x10340-0x1037f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10380-0x103bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x103c0-0x103ff */ + /* 0x10a00-0x10bff */ + 0x6e, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, /* 0x10a00-0x10a3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a40-0x10a7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a80-0x10abf */ + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b00-0x10b3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */ + /* 0x10c00-0x10dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c00-0x10c3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c40-0x10c7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c80-0x10cbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10cc0-0x10cff */ + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, /* 0x10d00-0x10d3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, /* 0x10d40-0x10d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10d80-0x10dbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10dc0-0x10dff */ + /* 0x10e00-0x10fff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10e00-0x10e3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10e40-0x10e7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, /* 0x10e80-0x10ebf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, /* 0x10ec0-0x10eff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f00-0x10f3f */ + 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f40-0x10f7f */ + 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f80-0x10fbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10fc0-0x10fff */ + /* 0x11000-0x111ff */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11000-0x1103f */ + 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x80, /* 0x11040-0x1107f */ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x06, /* 0x11080-0x110bf */ + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x110c0-0x110ff */ + 0x07, 0x00, 0x00, 0x00, 0x80, 0xef, 0x1f, 0x00, /* 0x11100-0x1113f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, /* 0x11140-0x1117f */ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, /* 0x11180-0x111bf */ + 0x00, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */ + /* 0x11200-0x113ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd3, 0x40, /* 0x11200-0x1123f */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11240-0x1127f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11280-0x112bf */ + 0x00, 0x00, 0x00, 0x80, 0xf8, 0x07, 0x00, 0x00, /* 0x112c0-0x112ff */ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, /* 0x11300-0x1133f */ + 0x01, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x1f, 0x00, /* 0x11340-0x1137f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, /* 0x11380-0x113bf */ + 0x01, 0x40, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, /* 0x113c0-0x113ff */ + /* 0x11400-0x115ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11400-0x1143f */ + 0x5c, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0x11440-0x1147f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x85, /* 0x11480-0x114bf */ + 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x114c0-0x114ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11500-0x1153f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11540-0x1157f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xb0, /* 0x11580-0x115bf */ + 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, /* 0x115c0-0x115ff */ + /* 0x11600-0x117ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xa7, /* 0x11600-0x1163f */ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11640-0x1167f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0xbf, 0x00, /* 0x11680-0x116bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x116c0-0x116ff */ + 0x00, 0x00, 0x00, 0xa0, 0xbc, 0x0f, 0x00, 0x00, /* 0x11700-0x1173f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11740-0x1177f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11780-0x117bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x117c0-0x117ff */ + /* 0x11800-0x119ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x06, /* 0x11800-0x1183f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11840-0x1187f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11880-0x118bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x118c0-0x118ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, /* 0x11900-0x1193f */ + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11940-0x1197f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11980-0x119bf */ + 0x00, 0x00, 0xf0, 0x0c, 0x01, 0x00, 0x00, 0x00, /* 0x119c0-0x119ff */ + /* 0x11a00-0x11bff */ + 0x7e, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x79, /* 0x11a00-0x11a3f */ + 0x80, 0x00, 0x7e, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x11a40-0x11a7f */ + 0x00, 0xfc, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x00, /* 0x11a80-0x11abf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11ac0-0x11aff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11b00-0x11b3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11b40-0x11b7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11b80-0x11bbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11bc0-0x11bff */ + /* 0x11c00-0x11dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x3f, /* 0x11c00-0x11c3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c40-0x11c7f */ + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xfc, 0x6d, 0x00, /* 0x11c80-0x11cbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11cc0-0x11cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xb4, /* 0x11d00-0x11d3f */ + 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d40-0x11d7f */ + 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d80-0x11dbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11dc0-0x11dff */ + /* 0x11e00-0x11fff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e00-0x11e3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e40-0x11e7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e80-0x11ebf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, /* 0x11ec0-0x11eff */ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, /* 0x11f00-0x11f3f */ + 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, /* 0x11f40-0x11f7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11f80-0x11fbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11fc0-0x11fff */ + /* 0x13400-0x135ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x13400-0x1343f */ + 0x81, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13440-0x1347f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13480-0x134bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x134c0-0x134ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13500-0x1353f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13540-0x1357f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13580-0x135bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x135c0-0x135ff */ + /* 0x16000-0x161ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16000-0x1603f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16040-0x1607f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16080-0x160bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x160c0-0x160ff */ + 0x00, 0x00, 0x00, 0xc0, 0xff, 0xe3, 0x00, 0x00, /* 0x16100-0x1613f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16140-0x1617f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16180-0x161bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x161c0-0x161ff */ + /* 0x16a00-0x16bff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a00-0x16a3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a40-0x16a7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a80-0x16abf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, /* 0x16ac0-0x16aff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, /* 0x16b00-0x16b3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b40-0x16b7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b80-0x16bbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16bc0-0x16bff */ + /* 0x16e00-0x16fff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e00-0x16e3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e40-0x16e7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e80-0x16ebf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16ec0-0x16eff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f00-0x16f3f */ + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f40-0x16f7f */ + 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f80-0x16fbf */ + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, /* 0x16fc0-0x16fff */ + /* 0x1bc00-0x1bdff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc00-0x1bc3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc40-0x1bc7f */ + 0x00, 0x00, 0x00, 0x60, 0x0f, 0x00, 0x00, 0x00, /* 0x1bc80-0x1bcbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bcc0-0x1bcff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd00-0x1bd3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd40-0x1bd7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd80-0x1bdbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bdc0-0x1bdff */ + /* 0x1ce00-0x1cfff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce00-0x1ce3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce40-0x1ce7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce80-0x1cebf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cec0-0x1ceff */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, /* 0x1cf00-0x1cf3f */ + 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cf40-0x1cf7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cf80-0x1cfbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cfc0-0x1cfff */ + /* 0x1d000-0x1d1ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xf8, 0xff, /* 0x1d140-0x1d17f */ + 0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d1c0-0x1d1ff */ + /* 0x1d200-0x1d3ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d200-0x1d23f */ + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d240-0x1d27f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d280-0x1d2bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d2c0-0x1d2ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d300-0x1d33f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d340-0x1d37f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d380-0x1d3bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d3c0-0x1d3ff */ + /* 0x1da00-0x1dbff */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf8, /* 0x1da00-0x1da3f */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x20, 0x00, /* 0x1da40-0x1da7f */ + 0x10, 0x00, 0x00, 0xf8, 0xfe, 0xff, 0x00, 0x00, /* 0x1da80-0x1dabf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dac0-0x1daff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db00-0x1db3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db40-0x1db7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db80-0x1dbbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dbc0-0x1dbff */ + /* 0x1e000-0x1e1ff */ + 0x7f, 0xff, 0xff, 0xf9, 0xdb, 0x07, 0x00, 0x00, /* 0x1e000-0x1e03f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e040-0x1e07f */ + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e080-0x1e0bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e0c0-0x1e0ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, /* 0x1e100-0x1e13f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e140-0x1e17f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e180-0x1e1bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e1c0-0x1e1ff */ + /* 0x1e200-0x1e3ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e200-0x1e23f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e240-0x1e27f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, /* 0x1e280-0x1e2bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, /* 0x1e2c0-0x1e2ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e300-0x1e33f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e340-0x1e37f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e380-0x1e3bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e3c0-0x1e3ff */ + /* 0x1e400-0x1e5ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e400-0x1e43f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e440-0x1e47f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e480-0x1e4bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, /* 0x1e4c0-0x1e4ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e500-0x1e53f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e540-0x1e57f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e580-0x1e5bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, /* 0x1e5c0-0x1e5ff */ + /* 0x1e800-0x1e9ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e800-0x1e83f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e840-0x1e87f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e880-0x1e8bf */ + 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e8c0-0x1e8ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e900-0x1e93f */ + 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e940-0x1e97f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e980-0x1e9bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1e9c0-0x1e9ff */ +}; +static const signed char nonspacing_table_ind[248] = { + 0, 1, 2, 3, 4, 5, 6, 7, /* 0x0000-0x0fff */ + 8, 9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */ + 14, -1, -1, -1, -1, -1, 15, -1, /* 0x2000-0x2fff */ + 16, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */ + -1, -1, -1, 17, 18, 19, -1, -1, /* 0xa000-0xafff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */ + -1, -1, -1, 20, -1, -1, -1, -1, /* 0xd000-0xdfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */ + -1, -1, -1, -1, -1, 21, -1, 22, /* 0xf000-0xffff */ + 23, 24, -1, -1, -1, 25, 26, 27, /* 0x10000-0x10fff */ + 28, 29, 30, 31, 32, 33, 34, 35, /* 0x11000-0x11fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */ + -1, -1, 36, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */ + 37, -1, -1, -1, -1, 38, -1, 39, /* 0x16000-0x16fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */ + -1, -1, -1, -1, -1, -1, 40, -1, /* 0x1b000-0x1bfff */ + -1, -1, -1, -1, -1, -1, -1, 41, /* 0x1c000-0x1cfff */ + 42, 43, -1, -1, -1, 44, -1, -1, /* 0x1d000-0x1dfff */ + 45, 46, 47, -1, 48, -1, -1, -1 /* 0x1e000-0x1efff */ +}; 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 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Width 2 property of Unicode characters. */ +/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */ + +/* Copyright (C) 2000-2024 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#define header_0 16 +#define header_2 9 +#define header_3 127 +#define header_4 15 +static const +struct + { + int header[1]; + int level1[4]; + short level2[3 << 7]; + unsigned int level3[28 << 4]; + } +u_width2 = +{ + { 4 }, + { + 5 * sizeof (int) / sizeof (short) + 0, + 5 * sizeof (int) / sizeof (short) + 128, + 5 * sizeof (int) / sizeof (short) + 256, + 5 * sizeof (int) / sizeof (short) + 256 + }, + { + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 16, + 5 + 384 * sizeof (short) / sizeof (int) + 32, + 5 + 384 * sizeof (short) / sizeof (int) + 48, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 64, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 80, + 5 + 384 * sizeof (short) / sizeof (int) + 96, + 5 + 384 * sizeof (short) / sizeof (int) + 112, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 144, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 160, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 176, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 192, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 208, + 5 + 384 * sizeof (short) / sizeof (int) + 224, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 240, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 256, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 272, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 288, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 304, + 5 + 384 * sizeof (short) / sizeof (int) + 320, + 5 + 384 * sizeof (short) / sizeof (int) + 336, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 352, + 5 + 384 * sizeof (short) / sizeof (int) + 368, + 5 + 384 * sizeof (short) / sizeof (int) + 384, + 5 + 384 * sizeof (short) / sizeof (int) + 400, + 5 + 384 * sizeof (short) / sizeof (int) + 416, + 5 + 384 * sizeof (short) / sizeof (int) + 432, + -1, + -1, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128, + 5 + 384 * sizeof (short) / sizeof (int) + 128 + }, + { + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x0C000000U, 0x00000600U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00091E00U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x60000000U, + 0x00300000U, 0x00000000U, 0x000FFF00U, 0x80000000U, + 0x00080000U, 0x60000C02U, 0x00104030U, 0x242C0400U, + 0x00000C20U, 0x00000100U, 0x00B85000U, 0x00000000U, + 0x00E00000U, 0x80010000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x18000000U, 0x00000000U, 0x00210000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x1FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFF0000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x0000FFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000001U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0000007FU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x0003000FU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U, + 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0x00000007U, 0x00070000U, 0xFFFF00F0U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000010U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00008000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x07FE4000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFBFE001U, 0xFFFFFFFFU, 0xDFFFFFFFU, + 0x000FFFFFU, 0xFFFFFFFFU, 0x000F87FFU, 0xFF11FFFFU, + 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFFFFFDU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU, + 0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF7800U, 0x040000FFU, + 0x00600000U, 0x00000010U, 0x00000000U, 0xF8000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xE0E7103FU, 0x1FF01800U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00010FFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0xFFFFF000U, 0xF7FFFFFFU, 0xFFFFFFBFU, 0xFFFFFFFFU, + 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x1F1F0000U, + 0xFFFF007FU, 0x07FF1FFFU, 0x03FF003FU, 0x007F00FFU, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, + 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U + } +}; 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 @@ /* Prefer faster, non-thread-safe stdio functions if available. - Copyright (C) 2001-2004, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2009-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ -/* Copyright (C) 1992, 1995-2002, 2005-2024 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2002, 2005-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is free software: you can redistribute it and/or modify @@ -57,7 +57,6 @@ int unsetenv (const char *name) { size_t len; - char **ep; if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { @@ -67,9 +66,37 @@ unsetenv (const char *name) len = strlen (name); +#if HAVE_DECL__PUTENV /* native Windows */ + /* The Microsoft documentation + + says: + "Don't change an environment entry directly: instead, + use _putenv or _wputenv to change it." + Note: Microsoft's _putenv updates not only the contents of _environ but + also the contents of _wenviron, so that both are in kept in sync. + + The way to remove an environment variable is to pass to _putenv a string + of the form "NAME=". (NB: This is a different convention than with glibc + putenv, which expects a string of the form "NAME"!) */ + { + int putenv_result; + char *name_ = malloc (len + 2); + if (name_ == NULL) + return -1; + memcpy (name_, name, len); + name_[len] = '='; + name_[len + 1] = 0; + putenv_result = _putenv (name_); + /* In this particular case it is OK to free() the argument passed to + _putenv. */ + free (name_); + return putenv_result; + } +#else + LOCK; - ep = __environ; + char **ep = __environ; while (*ep != NULL) if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { @@ -87,6 +114,7 @@ unsetenv (const char *name) UNLOCK; return 0; +#endif } #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 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2024 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -29,6 +29,7 @@ Depends on FCHAR_T. DCHAR_CPY memcpy like function for DCHAR_T[] arrays. DCHAR_SET memset like function for DCHAR_T[] arrays. + DCHAR_STRLEN strlen like function for DCHAR_T[] arrays. DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays. SNPRINTF The system's snprintf (or similar) function. This may be either snprintf or swprintf. @@ -64,7 +65,7 @@ /* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that main's use of CHECK macros expands to code that is too complicated for gcc -fanalyzer. Suppress the resulting bogus warnings. */ -#if 10 <= __GNUC__ +#if _GL_GNUC_PREREQ (10, 0) # pragma GCC diagnostic ignored "-Wanalyzer-null-argument" #endif @@ -80,14 +81,15 @@ #endif #include /* localeconv() */ +#include /* PTRDIFF_MAX */ #include /* snprintf(), sprintf() */ #include /* abort(), malloc(), realloc(), free() */ #include /* memcpy(), strlen() */ #include /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb(), mbszero() */ #include /* errno */ -#include /* CHAR_BIT, INT_WIDTH, LONG_WIDTH */ -#include /* DBL_MAX_EXP, LDBL_MAX_EXP */ -#if HAVE_NL_LANGINFO +#include /* CHAR_BIT, INT_MAX, INT_WIDTH, LONG_WIDTH */ +#include /* DBL_MAX_EXP, LDBL_MAX_EXP, LDBL_MANT_DIG */ +#if HAVE_NL_LANGINFO || __GLIBC__ >= 2 || defined __CYGWIN__ # include #endif #ifndef VASNPRINTF @@ -182,6 +184,20 @@ # define TCHAR_T char # endif #endif +#ifndef DCHAR_STRLEN +# if WIDE_CHAR_VERSION +# define DCHAR_STRLEN local_wcslen +# else +# define DCHAR_STRLEN strlen +# endif +#endif +#ifndef DCHAR_MBSNLEN +# if WIDE_CHAR_VERSION +# define DCHAR_MBSNLEN wcsnlen +# else +# define DCHAR_MBSNLEN mbsnlen +# endif +#endif #if !WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR /* TCHAR_T is char. */ /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. @@ -216,6 +232,12 @@ /* Here we need to call the native sprintf, not rpl_sprintf. */ #undef sprintf +/* macOS 12's "warning: 'sprintf' is deprecated" is pointless, + as sprintf is used safely here. */ +#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2) +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + /* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" warnings in this file. Use -Dlint to suppress them. */ #if defined GCC_LINT || defined lint @@ -224,6 +246,11 @@ # define IF_LINT(Code) /* empty */ #endif +/* Here we need only the most basic fields of 'struct lconv', and can + therefore use the system's localeconv() function, without needing a + dependency on module 'localeconv'. */ +#undef localeconv + /* Avoid some warnings from "gcc -Wshadow". This file doesn't use the exp() and remainder() functions. */ #undef exp @@ -231,7 +258,7 @@ #undef remainder #define remainder rem -#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && !WIDE_CHAR_VERSION +#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (PTRDIFF_MAX > INT_MAX)) && !WIDE_CHAR_VERSION # if (HAVE_STRNLEN && !defined _AIX) # define local_strnlen strnlen # else @@ -247,7 +274,7 @@ local_strnlen (const char *string, size_t maxlen) # endif #endif -#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 +#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) # if HAVE_WCSLEN # define local_wcslen wcslen # else @@ -270,7 +297,7 @@ local_wcslen (const wchar_t *s) # endif #endif -#if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T && WIDE_CHAR_VERSION +#if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && WIDE_CHAR_VERSION # if HAVE_WCSNLEN && HAVE_DECL_WCSNLEN # define local_wcsnlen wcsnlen # else @@ -289,7 +316,7 @@ local_wcsnlen (const wchar_t *s, size_t maxlen) # endif #endif -#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 +#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 # if ENABLE_WCHAR_FALLBACK static size_t wctomb_fallback (char *s, wchar_t wc) @@ -357,7 +384,7 @@ local_wctomb (char *s, wchar_t wc) # endif #endif -#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) +#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) /* Determine the decimal-point character according to the current locale. */ # ifndef decimal_point_char_defined # define decimal_point_char_defined 1 @@ -384,6 +411,217 @@ decimal_point_char (void) # endif #endif +#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)) +/* Determine the thousands-separator character according to the current + locale. + It is a single multibyte character. + In glibc: 35x ".", 90x ",", 23x U+202F, 1x U+2019, 1x U+066C, on other + systems also U+00A0. */ +# ifndef thousands_separator_char_defined +# define thousands_separator_char_defined 1 +static const char * +thousands_separator_char (char stackbuf[10]) +{ + /* Determine it in a multithread-safe way. + We know nl_langinfo is multithread-safe on glibc systems, on Mac OS X + systems, and on NetBSD, but is not required to be multithread-safe by + POSIX. + localeconv() is not guaranteed to be multithread-safe by POSIX either; + however, on native Windows it is (cf. test-localeconv-mt). + sprintf(), however, is multithread-safe. */ +# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __NetBSD__) + return nl_langinfo (THOUSEP); +# elif defined _WIN32 && !defined __CYGWIN__ + return localeconv () -> thousands_sep; +# else + sprintf (stackbuf, "%'.0f", 1000.0); + /* Now stackbuf = "1000". */ + stackbuf[strlen (stackbuf) - 3] = '\0'; +# if defined __sun + /* Solaris specific hack: Replace wrong result (0xC2 means U+00A0). */ + if (strcmp (&stackbuf[1], "\302") == 0) + strcpy (&stackbuf[1], MB_CUR_MAX > 1 ? "\302\240" : "\240"); +# endif + return &stackbuf[1]; +# endif +} +# endif +#endif +#if !WIDE_CHAR_VERSION && defined DCHAR_CONV_FROM_ENCODING && (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) +/* Determine the thousands-separator character, as a DCHAR_T[] array, + according to the current locale. + It is a single Unicode character. */ +# ifndef thousands_separator_DCHAR_defined +# define thousands_separator_DCHAR_defined 1 +static const DCHAR_T * +thousands_separator_DCHAR (DCHAR_T stackbuf[10]) +{ + /* Determine it in a multithread-safe way. */ + char tmpbuf[10]; + const char *tmp = thousands_separator_char (tmpbuf); + if (*tmp != '\0') + { + /* Convert it from char[] to DCHAR_T[]. */ + size_t converted_len = 10; + DCHAR_T *converted = + DCHAR_CONV_FROM_ENCODING (locale_charset (), + iconveh_question_mark, + tmp, strlen (tmp) + 1, + NULL, + stackbuf, &converted_len); + if (converted != NULL) + { + if (converted != stackbuf) + /* It should not be so long. */ + abort (); + return stackbuf; + } + } + stackbuf[0] = 0; + return stackbuf; +} +# endif +#endif +/* Maximum number of 'char' in the char[] or DCHAR_T[] representation of the + thousands separator. */ +#define THOUSEP_CHAR_MAXLEN 3 + +#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)) +/* Determine the thousands-separator character, as a wide character, according + to the current locale. + It is a single wide character. */ +# ifndef thousands_separator_wchar_defined +# define thousands_separator_wchar_defined 1 +static const wchar_t * +thousands_separator_wchar (wchar_t stackbuf[10]) +{ +# if __GLIBC__ >= 2 || defined __CYGWIN__ + /* On glibc, in the unibyte locale fr_FR, the *wprintf routines use U+202F + as separator, which cannot be represented in the locale encoding. */ + stackbuf[0] = + (wchar_t) (unsigned long) nl_langinfo (_NL_NUMERIC_THOUSANDS_SEP_WC); + stackbuf[1] = L'\0'; + return stackbuf; +# elif defined _WIN32 && !defined __CYGWIN__ + const char *tmp = localeconv () -> thousands_sep; + if (*tmp != '\0') + { + mbstate_t state; + mbszero (&state); + if ((int) mbrtowc (&stackbuf[0], tmp, strlen (tmp), &state) > 0) + stackbuf[1] = L'\0'; + else + stackbuf[0] = L'\0'; + } + else + stackbuf[0] = L'\0'; + return stackbuf; +# elif defined __sun + /* Use sprintf, because swprintf retrieves a wrong value for the + thousands-separator wide character (e.g. (wchar_t) 0xffffffa0). */ + char tmp[10]; + sprintf (tmp, "%'.0f", 1000.0); + /* Now tmp = L"1000". */ + tmp[strlen (tmp) - 3] = '\0'; + /* Solaris specific hack: Replace wrong result (0xC2 means U+00A0). */ + if (strcmp (&tmp[1], "\302") == 0) + strcpy (&tmp[1], MB_CUR_MAX > 1 ? "\302\240" : "\240"); + if (tmp[1] != '\0') + { + mbstate_t state; + mbszero (&state); + if ((int) mbrtowc (&stackbuf[0], &tmp[1], strlen (&tmp[1]), &state) > 0) + stackbuf[1] = L'\0'; + else + stackbuf[0] = L'\0'; + } + else + stackbuf[0] = L'\0'; + return stackbuf; +# else + swprintf (stackbuf, 10, L"%'.0f", 1000.0); + /* Now stackbuf = L"1000". */ + stackbuf[local_wcslen (stackbuf) - 3] = '\0'; + return &stackbuf[1]; +# endif +} +# endif +#endif +/* Maximum number of 'wchar_t' in the wchar_t[] representation of the thousands + separator. */ +#define THOUSEP_WCHAR_MAXLEN 1 + +#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) +# ifndef grouping_rule_defined +# define grouping_rule_defined 1 +/* Determine the grouping rule. + * As specified in POSIX + * + * + * it is a string whose elements are 'signed char' values, where + * "Each integer specifies the number of digits in each group, with the initial + * integer defining the size of the group immediately preceding the decimal + * delimiter, and the following integers defining the preceding groups. If + * the last integer is not -1, then the size of the previous group (if any) + * shall be repeatedly used for the remainder of the digits. If the last + * integer is -1, then no further grouping shall be performed." + * Platforms that have locales with grouping: + * glibc, FreeBSD, NetBSD, AIX, Solaris, Cygwin, Haiku. + * Platforms that don't: + * musl libc, macOS, OpenBSD, Android, mingw, MSVC. + * Typical grouping rules on glibc: + * 136x 3 (fr_FR etc.) + * 4x 4 (cmn_TW etc.) + * 9x 3;2 (ta_IN etc.) + * 1x 2;2;2;3 (umn_US) + * 21x -1 (C etc.) + */ +static const signed char * +grouping_rule (void) +{ + /* We know nl_langinfo is multithread-safe on glibc systems and on Cygwin, + but is not required to be multithread-safe by POSIX. + localeconv() is not guaranteed to be multithread-safe by POSIX either; + however, on all known systems it is (cf. test-localeconv-mt). */ +# if __GLIBC__ >= 2 + return (const signed char *) nl_langinfo (GROUPING); +# elif defined __CYGWIN__ + return (const signed char *) nl_langinfo (_NL_NUMERIC_GROUPING); +# else + return (const signed char *) localeconv () -> grouping; +# endif +} +/* Determines the number of thousands-separators to be inserted in a digit + sequence with ndigits digits (before the decimal point). */ +static size_t +num_thousands_separators (const signed char *grouping, size_t ndigits) +{ + const signed char *g = grouping; + int h = *g; + if (h <= 0 || ndigits == 0) + return 0; + size_t insert = 0; + for (;;) + { + /* Invariant: here h == *g, h > 0, ndigits > 0. */ + if (g[1] == 0) + /* h repeats endlessly. */ + return insert + (ndigits - 1) / h; + /* h does not repeat. */ + if (ndigits <= h) + return insert; + ndigits -= h; + insert++; + g++; + h = *g; + if (h < 0) + /* No further grouping. */ + return insert; + } +} +# endif +#endif + #if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE /* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ @@ -406,8 +644,45 @@ is_infinite_or_zerol (long double x) #endif +#if NEED_PRINTF_LONG_DOUBLE + +/* Like frexpl, except that it supports even "unsupported" numbers. */ +# 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__) +/* Don't assume that frexpl can handle pseudo-denormals; it does not on + macOS 12/x86_64. Therefore test for a pseudo-denormal explicitly. */ + +static +long double safe_frexpl (long double x, int *exp) +{ + union + { + long double value; + struct { unsigned int mant_word[2]; unsigned short sign_exp_word; } r; + } + u; + u.value = x; + if (u.r.sign_exp_word == 0 && (u.r.mant_word[1] & 0x80000000u) != 0) + { + /* Pseudo-Denormal. */ + *exp = LDBL_MIN_EXP; + u.r.sign_exp_word = 1 - LDBL_MIN_EXP; + return u.value; + } + else + return frexpl (x, exp); +} + +# else +# define safe_frexpl frexpl +# endif + +#endif + #if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE +/* An indicator for a failed memory allocation. */ +# define NOMEM_PTR ((void *) (-1)) + /* Converting 'long double' to decimal without rare rounding bugs requires real bignums. We use the naming conventions of GNU gmp, but vastly simpler (and slower) algorithms. */ @@ -428,8 +703,8 @@ typedef struct } mpn_t; /* Compute the product of two bignums >= 0. - Return the allocated memory in case of success, NULL in case of memory - allocation failure. */ + Return the allocated memory (possibly NULL) in case of success, NOMEM_PTR + in case of memory allocation failure. */ static void * multiply (mpn_t src1, mpn_t src2, mpn_t *dest) { @@ -457,7 +732,7 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest) { /* src1 or src2 is zero. */ dest->nlimbs = 0; - dest->limbs = (mp_limb_t *) malloc (1); + dest->limbs = NULL; } else { @@ -469,7 +744,7 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest) dlen = len1 + len2; dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); if (dp == NULL) - return NULL; + return NOMEM_PTR; for (k = len2; k > 0; ) dp[--k] = 0; for (i = 0; i < len1; i++) @@ -500,8 +775,8 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest) the remainder. Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, q is incremented. - Return the allocated memory in case of success, NULL in case of memory - allocation failure. */ + Return the allocated memory (possibly NULL) in case of success, NOMEM_PTR + in case of memory allocation failure. */ static void * divide (mpn_t a, mpn_t b, mpn_t *q) { @@ -572,7 +847,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q) final rounding of q.) */ roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); if (roomptr == NULL) - return NULL; + return NOMEM_PTR; /* Normalise a. */ while (a_len > 0 && a_ptr[a_len - 1] == 0) @@ -708,7 +983,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q) if (tmp_roomptr == NULL) { free (roomptr); - return NULL; + return NOMEM_PTR; } { const mp_limb_t *sourceptr = b_ptr; @@ -930,7 +1205,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q) /* Avoid pointless GCC warning "argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807", triggered by the use of xsum as argument of malloc. */ -# if __GNUC__ >= 7 +# if _GL_GNUC_PREREQ (7, 0) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Walloc-size-larger-than=" # endif @@ -991,7 +1266,7 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes) return c_ptr; } -# if __GNUC__ >= 7 +# if _GL_GNUC_PREREQ (7, 0) # pragma GCC diagnostic pop # endif @@ -1015,7 +1290,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp) if (m.limbs == NULL) return NULL; /* Split into exponential part and mantissa. */ - y = frexpl (x, &exp); + y = safe_frexpl (x, &exp); if (!(y >= 0.0L && y < 1.0L)) abort (); /* 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) mpn_t denominator; void *tmp_memory; tmp_memory = multiply (m, pow5, &numerator); - if (tmp_memory == NULL) + if (tmp_memory == NOMEM_PTR) { free (pow5_ptr); free (memory); @@ -1379,7 +1654,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ - if (z_memory == NULL) + if (z_memory == NOMEM_PTR) return NULL; digits = convert_to_decimal (z, extra_zeroes); free (z_memory); @@ -1442,7 +1717,7 @@ floorlog10l (long double x) double l; /* Split into exponential part and mantissa. */ - y = frexpl (x, &exp); + y = safe_frexpl (x, &exp); if (!(y >= 0.0L && y < 1.0L)) abort (); if (y == 0.0L) @@ -1801,8 +2076,17 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, } if (tmp_length < precision) tmp_length = precision; - /* Multiply by 2, as an estimate for FLAG_GROUP. */ - tmp_length = xsum (tmp_length, tmp_length); + /* Account for thousands separators. */ + if (flags & FLAG_GROUP) + { + /* A thousands separator needs to be inserted at most every 2 digits. + This is the case in the ta_IN locale. */ +# if WIDE_CHAR_VERSION + tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_WCHAR_MAXLEN); +# else + tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_CHAR_MAXLEN); +# endif + } /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; @@ -2050,12 +2334,18 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, tmp_length = xsum (tmp_length, 2); break; + case 'e': case 'E': + tmp_length = + 12; /* sign, decimal point, exponent etc. */ + tmp_length = xsum (tmp_length, precision); + break; + case 'f': case 'F': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_MAX_EXP * 0.30103 /* binary -> decimal */ - * 2 /* estimate for FLAG_GROUP */ + * 0.5 * 3 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ @@ -2063,17 +2353,20 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, tmp_length = (unsigned int) (DBL_MAX_EXP * 0.30103 /* binary -> decimal */ - * 2 /* estimate for FLAG_GROUP */ + * 0.5 * 3 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ tmp_length = xsum (tmp_length, precision); break; - case 'e': case 'E': case 'g': case 'G': + case 'g': case 'G': tmp_length = 12; /* sign, decimal point, exponent etc. */ - tmp_length = xsum (tmp_length, precision); + tmp_length = xsum (tmp_length, + precision + * 0.5 * 3 /* estimate for FLAG_GROUP */ + ); break; case 'a': case 'A': @@ -2111,10 +2404,9 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, break; case 's': -# if HAVE_WCHAR_T if (type == TYPE_WIDE_STRING) { -# if WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION /* ISO C says about %ls in fwprintf: "If the precision is not specified or is greater than the size 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, tmp_length = local_wcsnlen (arg, precision); else tmp_length = local_wcslen (arg); -# else +# else /* ISO C says about %ls in fprintf: "If a precision is specified, no more than that many bytes are 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, So if there is a precision, we must not use wcslen. */ /* This case has already been handled separately in VASNPRINTF. */ abort (); -# endif +# endif } else -# endif { # if WIDE_CHAR_VERSION /* ISO C says about %s in fwprintf: @@ -2226,7 +2517,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, TCHAR_T *buf; TCHAR_T *buf_malloced; const FCHAR_T *cp; - size_t i; + size_t di; DIRECTIVE *dp; /* Output string accumulator. */ DCHAR_T *result; @@ -2290,7 +2581,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #define ENSURE_ALLOCATION(needed) \ ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; ) - for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) + for (cp = format, di = 0, dp = &d.dir[0]; ; cp = dp->dir_end, di++, dp++) { if (cp != dp->dir_start) { @@ -2313,7 +2604,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, while (--n > 0); } } - if (i == d.count) + if (di == d.count) break; /* Execute a single directive. */ @@ -2423,6 +2714,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } + if (width > (size_t) INT_MAX) + goto overflow; has_width = 1; } @@ -2501,7 +2794,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* Use the entire string. */ arg_end = arg + u8_strlen (arg); - /* The number of characters doesn't matter. */ + /* The number of characters doesn't matter, + because !has_width and therefore width==0. */ characters = 0; } @@ -2542,7 +2836,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (converted != result + length) { ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), - { free (converted); goto out_of_memory; }); + { free (converted); goto out_of_memory; }); DCHAR_CPY (result + length, converted, converted_len); free (converted); } @@ -2603,7 +2897,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* Use the entire string. */ arg_end = arg + u16_strlen (arg); - /* The number of characters doesn't matter. */ + /* The number of characters doesn't matter, + because !has_width and therefore width==0. */ characters = 0; } @@ -2644,7 +2939,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (converted != result + length) { ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), - { free (converted); goto out_of_memory; }); + { free (converted); goto out_of_memory; }); DCHAR_CPY (result + length, converted, converted_len); free (converted); } @@ -2705,7 +3000,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* Use the entire string. */ arg_end = arg + u32_strlen (arg); - /* The number of characters doesn't matter. */ + /* The number of characters doesn't matter, + because !has_width and therefore width==0. */ characters = 0; } @@ -2746,7 +3042,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (converted != result + length) { ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), - { free (converted); goto out_of_memory; }); + { free (converted); goto out_of_memory; }); DCHAR_CPY (result + length, converted, converted_len); free (converted); } @@ -2769,7 +3065,190 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } } #endif -#if WIDE_CHAR_VERSION && (!DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC) +#if !WIDE_CHAR_VERSION && (PTRDIFF_MAX > INT_MAX) + else if (dp->conversion == 's' + && a.arg[dp->arg_index].type != TYPE_WIDE_STRING) + { + /* %s in vasnprintf. See the specification of fprintf. + We handle it ourselves here, because the string may be longer + than INT_MAX characters, whence snprintf or sprintf would + fail to process it. */ + int flags = dp->flags; + int has_width; + size_t width; + int has_precision; + size_t precision; + + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = -width; + } + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + if (width > (size_t) INT_MAX) + goto overflow; + has_width = 1; + } + + has_precision = 0; + precision = 6; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } + + { + const char *arg = a.arg[dp->arg_index].a.a_string; + size_t bytes; +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR + size_t characters; +# endif +# if !DCHAR_IS_TCHAR + /* This code assumes that TCHAR_T is 'char'. */ + static_assert (sizeof (TCHAR_T) == 1); + DCHAR_T *tmpdst; + size_t tmpdst_len; +# endif + size_t w; + + if (has_precision) + { + /* Use only at most PRECISION bytes, from the left. */ + bytes = local_strnlen (arg, precision); + } + else + { + /* Use the entire string, and count the number of + bytes. */ + bytes = strlen (arg); + } + +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR + if (has_width) + characters = mbsnlen (arg, bytes); + else + { + /* The number of characters doesn't matter, + because !has_width and therefore width==0. */ + characters = 0; + } +# endif + +# if !DCHAR_IS_TCHAR + /* Convert from TCHAR_T[] to DCHAR_T[]. */ + tmpdst = + DCHAR_CONV_FROM_ENCODING (locale_charset (), + iconveh_question_mark, + arg, bytes, + NULL, + NULL, &tmpdst_len); + if (tmpdst == NULL) + goto fail_with_errno; +# endif + + if (has_width) + { +# if ENABLE_UNISTDIO + /* Outside POSIX, it's preferable to compare the width + against the number of _characters_ of the converted + value. */ +# if DCHAR_IS_TCHAR + w = characters; +# else + w = DCHAR_MBSNLEN (tmpdst, tmpdst_len); +# endif +# else + /* The width is compared against the number of _bytes_ + of the converted value, says POSIX. */ + w = bytes; +# endif + } + else + /* w doesn't matter. */ + w = 0; + + { +# if DCHAR_IS_TCHAR + size_t total = bytes + (w < width ? width - w : 0); + ENSURE_ALLOCATION (xsum (length, total)); +# else + size_t total = tmpdst_len + (w < width ? width - w : 0); + ENSURE_ALLOCATION_ELSE (xsum (length, total), + { free (tmpdst); goto out_of_memory; }); +# endif + + if (w < width && !(flags & FLAG_LEFT)) + { + size_t n = width - w; + DCHAR_SET (result + length, ' ', n); + length += n; + } + +# if DCHAR_IS_TCHAR + memcpy (result + length, arg, bytes); + length += bytes; +# else + DCHAR_CPY (result + length, tmpdst, tmpdst_len); + free (tmpdst); + length += tmpdst_len; +# endif + + if (w < width && (flags & FLAG_LEFT)) + { + size_t n = width - w; + DCHAR_SET (result + length, ' ', n); + length += n; + } + } + } + } +#endif +#if WIDE_CHAR_VERSION && ((PTRDIFF_MAX > INT_MAX) || !DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC) else if ((dp->conversion == 's' && a.arg[dp->arg_index].type == TYPE_WIDE_STRING) || (dp->conversion == 'c' @@ -2810,6 +3289,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } + if (width > (size_t) INT_MAX) + goto overflow; } { @@ -2912,7 +3393,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } } #endif -#if (!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T +#if WIDE_CHAR_VERSION || !USE_SNPRINTF || (PTRDIFF_MAX > INT_MAX) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK else if (dp->conversion == 's' # if WIDE_CHAR_VERSION && a.arg[dp->arg_index].type != TYPE_WIDE_STRING @@ -2965,6 +3446,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } + if (width > (size_t) INT_MAX) + goto overflow; has_width = 1; } @@ -3145,11 +3628,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; const wchar_t *arg_end; + size_t bytes; +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR size_t characters; +# endif # if !DCHAR_IS_TCHAR /* This code assumes that TCHAR_T is 'char'. */ static_assert (sizeof (TCHAR_T) == 1); - TCHAR_T *tmpsrc; DCHAR_T *tmpdst; size_t tmpdst_len; # endif @@ -3164,7 +3649,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, mbszero (&state); # endif arg_end = arg; + bytes = 0; +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR characters = 0; +# endif while (precision > 0) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ @@ -3180,7 +3668,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (precision < (unsigned int) count) break; arg_end++; - characters += count; + bytes += count; +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR + characters += mbsnlen (cbuf, count); +# endif precision -= count; } } @@ -3197,7 +3688,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, mbszero (&state); # endif arg_end = arg; + bytes = 0; +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR characters = 0; +# endif for (;;) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ @@ -3211,7 +3705,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Cannot convert. */ goto fail_with_EILSEQ; arg_end++; - characters += count; + bytes += count; +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR + characters += mbsnlen (cbuf, count); +# endif } } # if DCHAR_IS_TCHAR @@ -3219,56 +3716,64 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { /* Use the entire string. */ arg_end = arg + local_wcslen (arg); - /* The number of bytes doesn't matter. */ + /* The number of bytes and characters doesn't matter, + because !has_width and therefore width==0. */ + bytes = 0; +# if ENABLE_UNISTDIO characters = 0; +# endif } # endif # if !DCHAR_IS_TCHAR - /* Convert the string into a piece of temporary memory. */ - tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T)); - if (tmpsrc == NULL) - goto out_of_memory; { - TCHAR_T *tmpptr = tmpsrc; - size_t remaining; + TCHAR_T *tmpsrc; + + /* Convert the string into a piece of temporary memory. */ + tmpsrc = (TCHAR_T *) malloc (bytes * sizeof (TCHAR_T)); + if (tmpsrc == NULL) + goto out_of_memory; + { + TCHAR_T *tmpptr = tmpsrc; + size_t remaining; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - mbstate_t state; - mbszero (&state); + mbstate_t state; + mbszero (&state); # endif - for (remaining = characters; remaining > 0; ) - { - char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; - - if (*arg == 0) - abort (); - count = local_wcrtomb (cbuf, *arg, &state); - if (count <= 0) - /* Inconsistency. */ - abort (); - memcpy (tmpptr, cbuf, count); - tmpptr += count; - arg++; - remaining -= count; - } - if (!(arg == arg_end)) - abort (); - } + for (remaining = bytes; remaining > 0; ) + { + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ + int count; - /* Convert from TCHAR_T[] to DCHAR_T[]. */ - tmpdst = - DCHAR_CONV_FROM_ENCODING (locale_charset (), - iconveh_question_mark, - tmpsrc, characters, - NULL, - NULL, &tmpdst_len); - if (tmpdst == NULL) - { - free (tmpsrc); - goto fail_with_errno; + if (*arg == 0) + abort (); + count = local_wcrtomb (cbuf, *arg, &state); + if (count <= 0) + /* Inconsistency. */ + abort (); + memcpy (tmpptr, cbuf, count); + tmpptr += count; + arg++; + remaining -= count; + } + if (!(arg == arg_end)) + abort (); } - free (tmpsrc); + + /* Convert from TCHAR_T[] to DCHAR_T[]. */ + tmpdst = + DCHAR_CONV_FROM_ENCODING (locale_charset (), + iconveh_question_mark, + tmpsrc, bytes, + NULL, + NULL, &tmpdst_len); + if (tmpdst == NULL) + { + free (tmpsrc); + goto fail_with_errno; + } + free (tmpsrc); + } # endif if (has_width) @@ -3277,11 +3782,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Outside POSIX, it's preferable to compare the width against the number of _characters_ of the converted value. */ - w = DCHAR_MBSNLEN (result + length, characters); +# if DCHAR_IS_TCHAR + w = characters; +# else + w = DCHAR_MBSNLEN (tmpdst, tmpdst_len); +# endif # else /* The width is compared against the number of _bytes_ of the converted value, says POSIX. */ - w = characters; + w = bytes; # endif } else @@ -3291,7 +3800,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (w < width && !(flags & FLAG_LEFT)) { size_t n = width - w; +# if DCHAR_IS_TCHAR ENSURE_ALLOCATION (xsum (length, n)); +# else + ENSURE_ALLOCATION_ELSE (xsum (length, n), + { free (tmpdst); goto out_of_memory; }); +# endif DCHAR_SET (result + length, ' ', n); length += n; } @@ -3305,8 +3819,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, mbstate_t state; mbszero (&state); # endif - ENSURE_ALLOCATION (xsum (length, characters)); - for (remaining = characters; remaining > 0; ) + ENSURE_ALLOCATION (xsum (length, bytes)); + for (remaining = bytes; remaining > 0; ) { char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; @@ -3350,7 +3864,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } # else ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), - { free (tmpdst); goto out_of_memory; }); + { free (tmpdst); goto out_of_memory; }); DCHAR_CPY (result + length, tmpdst, tmpdst_len); free (tmpdst); length += tmpdst_len; @@ -3406,17 +3920,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } + if (width > (size_t) INT_MAX) + goto overflow; has_width = 1; } /* %lc in vasnprintf. See the specification of fprintf. */ { wchar_t arg = (wchar_t) a.arg[dp->arg_index].a.a_wide_char; + size_t bytes; +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR size_t characters; +# endif # if !DCHAR_IS_TCHAR /* This code assumes that TCHAR_T is 'char'. */ static_assert (sizeof (TCHAR_T) == 1); - TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */ DCHAR_T *tmpdst; size_t tmpdst_len; # endif @@ -3427,7 +3945,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, # endif { /* Count the number of bytes. */ - characters = 0; char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ int count; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t @@ -3439,43 +3956,54 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (count < 0) /* Cannot convert. */ goto fail_with_EILSEQ; - characters = count; + bytes = count; +# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR + characters = mbsnlen (cbuf, count); +# endif } # if DCHAR_IS_TCHAR else { - /* The number of bytes doesn't matter. */ + /* The number of bytes and characters doesn't matter, + because !has_width and therefore width==0. */ + bytes = 0; +# if ENABLE_UNISTDIO characters = 0; +# endif } # endif # if !DCHAR_IS_TCHAR - /* Convert the string into a piece of temporary memory. */ - if (characters > 0) - { - char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ - int count; + { + TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */ + + /* Convert the string into a piece of temporary memory. */ + if (bytes > 0) + { + char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ + int count; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t - mbstate_t state; - mbszero (&state); + mbstate_t state; + mbszero (&state); # endif - count = local_wcrtomb (cbuf, arg, &state); - if (count <= 0) - /* Inconsistency. */ - abort (); - memcpy (tmpsrc, cbuf, count); - } + count = local_wcrtomb (cbuf, arg, &state); + if (count <= 0) + /* Inconsistency. */ + abort (); + memcpy (tmpsrc, cbuf, count); + } - /* Convert from TCHAR_T[] to DCHAR_T[]. */ - tmpdst = - DCHAR_CONV_FROM_ENCODING (locale_charset (), - iconveh_question_mark, - tmpsrc, characters, - NULL, - NULL, &tmpdst_len); - if (tmpdst == NULL) - goto fail_with_errno; + /* Convert from TCHAR_T[] to DCHAR_T[]. */ + tmpdst = + DCHAR_CONV_FROM_ENCODING (locale_charset (), + iconveh_question_mark, + tmpsrc, bytes, + NULL, + NULL, &tmpdst_len); + if (tmpdst == NULL) + goto fail_with_errno; + } # endif if (has_width) @@ -3484,11 +4012,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Outside POSIX, it's preferable to compare the width against the number of _characters_ of the converted value. */ - w = DCHAR_MBSNLEN (result + length, characters); +# if DCHAR_IS_TCHAR + w = characters; +# else + w = DCHAR_MBSNLEN (tmpdst, tmpdst_len); +# endif # else /* The width is compared against the number of _bytes_ of the converted value, says POSIX. */ - w = characters; + w = bytes; # endif } else @@ -3498,7 +4030,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (w < width && !(flags & FLAG_LEFT)) { size_t n = width - w; +# if DCHAR_IS_TCHAR ENSURE_ALLOCATION (xsum (length, n)); +# else + ENSURE_ALLOCATION_ELSE (xsum (length, n), + { free (tmpdst); goto out_of_memory; }); +# endif DCHAR_SET (result + length, ' ', n); length += n; } @@ -3507,8 +4044,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (has_width) { /* We know the number of bytes in advance. */ - ENSURE_ALLOCATION (xsum (length, characters)); - if (characters > 0) + ENSURE_ALLOCATION (xsum (length, bytes)); + if (bytes > 0) { int count; # if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t @@ -3542,7 +4079,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } # else ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), - { free (tmpdst); goto out_of_memory; }); + { free (tmpdst); goto out_of_memory; }); DCHAR_CPY (result + length, tmpdst, tmpdst_len); free (tmpdst); length += tmpdst_len; @@ -3594,6 +4131,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } + if (width > (size_t) INT_MAX) + goto overflow; } /* %c in vasnwprintf. See the specification of fwprintf. */ @@ -3608,24 +4147,26 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Invalid or incomplete multibyte character. */ goto fail_with_EILSEQ; - if (1 < width && !(flags & FLAG_LEFT)) - { - size_t n = width - 1; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } + { + size_t total = (1 < width ? width : 1); + ENSURE_ALLOCATION (xsum (length, total)); + + if (1 < width && !(flags & FLAG_LEFT)) + { + size_t n = width - 1; + DCHAR_SET (result + length, ' ', n); + length += n; + } - ENSURE_ALLOCATION (xsum (length, 1)); - result[length++] = wc; + result[length++] = wc; - if (1 < width && (flags & FLAG_LEFT)) - { - size_t n = width - 1; - ENSURE_ALLOCATION (xsum (length, n)); - DCHAR_SET (result + length, ' ', n); - length += n; - } + if (1 < width && (flags & FLAG_LEFT)) + { + size_t n = width - 1; + DCHAR_SET (result + length, ' ', n); + length += n; + } + } } } #endif @@ -3682,6 +4223,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } + if (width > (size_t) INT_MAX) + goto overflow; has_width = 1; } @@ -3933,7 +4476,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { size_t n = xsum (length, count); - ENSURE_ALLOCATION (n); + ENSURE_ALLOCATION_ELSE (n, + { if (tmp != tmpbuf) free (tmp); goto out_of_memory; }); } /* Append the result. */ @@ -3996,6 +4540,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } + if (width > (size_t) INT_MAX) + goto overflow; } has_precision = 0; @@ -4423,7 +4969,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { size_t n = xsum (length, count); - ENSURE_ALLOCATION (n); + ENSURE_ALLOCATION_ELSE (n, + { if (tmp != tmpbuf) free (tmp); goto out_of_memory; }); } /* Append the result. */ @@ -4501,6 +5048,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } + if (width > (size_t) INT_MAX) + goto overflow; } has_precision = 0; @@ -4587,6 +5136,17 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } } # endif + /* Account for thousands separators. */ + if (flags & FLAG_GROUP) + { + /* A thousands separator needs to be inserted at most every 2 digits. + This is the case in the ta_IN locale. */ +# if WIDE_CHAR_VERSION + tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_WCHAR_MAXLEN); +# else + tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_CHAR_MAXLEN); +# endif + } /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); @@ -4682,12 +5242,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, ndigits = strlen (digits); if (ndigits > precision) - do - { - --ndigits; - *p++ = digits[ndigits]; - } - while (ndigits > precision); + { + /* Number of digits before the decimal point. */ + size_t intpart_digits = ndigits - precision; + + const DCHAR_T *thousep = NULL; + DCHAR_T thousep_buf[10]; +# if !WIDE_CHAR_VERSION + size_t thousep_len = 0; +# endif + const signed char *grouping; + size_t insert = 0; + + if ((flags & FLAG_GROUP) && (intpart_digits > 1)) + { + /* Determine the thousands separator and + the grouping rule of the current locale. */ +# if WIDE_CHAR_VERSION + /* DCHAR_T is wchar_t. */ + thousep = thousands_separator_wchar (thousep_buf); +# define thousep_len 1 +# elif defined DCHAR_CONV_FROM_ENCODING + /* DCHAR_T is uintN_t. */ + thousep = thousands_separator_DCHAR (thousep_buf); + thousep_len = DCHAR_STRLEN (thousep); +# else + /* DCHAR_T is char. */ + thousep = thousands_separator_char (thousep_buf); + thousep_len = strlen (thousep); +# endif + if (*thousep == 0) + thousep = NULL; + if (thousep != NULL) + { + grouping = grouping_rule (); + insert = + num_thousands_separators (grouping, intpart_digits); + } + } + + const char *digitp = digits + precision; + DCHAR_T *p_before_intpart = p; + p += intpart_digits + insert * thousep_len; + DCHAR_T *p_after_intpart = p; + if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */ + { + const signed char *g = grouping; + for (;;) + { + int h = *g; + if (h <= 0) + abort (); + int i = h; + do + *--p = *digitp++; + while (--i > 0); +# if WIDE_CHAR_VERSION + *--p = thousep[0]; +# else + p -= thousep_len; + DCHAR_CPY (p, thousep, thousep_len); +# endif + insert--; + if (insert == 0) + break; + if (g[1] != 0) + g++; + } + } + for (;;) + { + *--p = *digitp++; + if (p == p_before_intpart) + break; + } + p = p_after_intpart; + ndigits = precision; +# undef thousep_len + } else *p++ = '0'; /* Here ndigits <= precision. */ @@ -4940,10 +5572,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, digits without trailing zeroes. */ if (exponent >= 0) { - size_t ecount = exponent + 1; - /* Note: count <= precision = ndigits. */ - for (; ecount > 0; ecount--) - *p++ = digits[--ndigits]; + /* Number of digits before the decimal point. */ + size_t intpart_digits = exponent + 1; + /* Note: intpart_digits <= precision = ndigits. */ + + const DCHAR_T *thousep = NULL; + DCHAR_T thousep_buf[10]; +# if !WIDE_CHAR_VERSION + size_t thousep_len = 0; +# endif + const signed char *grouping; + size_t insert = 0; + + if ((flags & FLAG_GROUP) && (intpart_digits > 1)) + { + /* Determine the thousands separator and + the grouping rule of the current locale. */ +# if WIDE_CHAR_VERSION + /* DCHAR_T is wchar_t. */ + thousep = thousands_separator_wchar (thousep_buf); +# define thousep_len 1 +# elif defined DCHAR_CONV_FROM_ENCODING + /* DCHAR_T is uintN_t. */ + thousep = thousands_separator_DCHAR (thousep_buf); + thousep_len = DCHAR_STRLEN (thousep); +# else + /* DCHAR_T is char. */ + thousep = thousands_separator_char (thousep_buf); + thousep_len = strlen (thousep); +# endif + if (*thousep == 0) + thousep = NULL; + if (thousep != NULL) + { + grouping = grouping_rule (); + insert = + num_thousands_separators (grouping, intpart_digits); + } + } + + const char *digitp = digits + ndigits - intpart_digits; + DCHAR_T *p_before_intpart = p; + p += intpart_digits + insert * thousep_len; + DCHAR_T *p_after_intpart = p; + if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */ + { + const signed char *g = grouping; + for (;;) + { + int h = *g; + if (h <= 0) + abort (); + int i = h; + do + *--p = *digitp++; + while (--i > 0); +# if WIDE_CHAR_VERSION + *--p = thousep[0]; +# else + p -= thousep_len; + DCHAR_CPY (p, thousep, thousep_len); +# endif + insert--; + if (insert == 0) + break; + if (g[1] != 0) + g++; + } + } + for (;;) + { + *--p = *digitp++; + if (p == p_before_intpart) + break; + } + p = p_after_intpart; + ndigits -= intpart_digits; +# undef thousep_len + if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); @@ -5144,12 +5850,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, ndigits = strlen (digits); if (ndigits > precision) - do - { - --ndigits; - *p++ = digits[ndigits]; - } - while (ndigits > precision); + { + /* Number of digits before the decimal point. */ + size_t intpart_digits = ndigits - precision; + + const DCHAR_T *thousep = NULL; + DCHAR_T thousep_buf[10]; +# if !WIDE_CHAR_VERSION + size_t thousep_len = 0; +# endif + const signed char *grouping; + size_t insert = 0; + + if ((flags & FLAG_GROUP) && (intpart_digits > 1)) + { + /* Determine the thousands separator and + the grouping rule of the current locale. */ +# if WIDE_CHAR_VERSION + /* DCHAR_T is wchar_t. */ + thousep = thousands_separator_wchar (thousep_buf); +# define thousep_len 1 +# elif defined DCHAR_CONV_FROM_ENCODING + /* DCHAR_T is uintN_t. */ + thousep = thousands_separator_DCHAR (thousep_buf); + thousep_len = DCHAR_STRLEN (thousep); +# else + /* DCHAR_T is char. */ + thousep = thousands_separator_char (thousep_buf); + thousep_len = strlen (thousep); +# endif + if (*thousep == 0) + thousep = NULL; + if (thousep != NULL) + { + grouping = grouping_rule (); + insert = + num_thousands_separators (grouping, intpart_digits); + } + } + + const char *digitp = digits + precision; + DCHAR_T *p_before_intpart = p; + p += intpart_digits + insert * thousep_len; + DCHAR_T *p_after_intpart = p; + if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */ + { + const signed char *g = grouping; + for (;;) + { + int h = *g; + if (h <= 0) + abort (); + int i = h; + do + *--p = *digitp++; + while (--i > 0); +# if WIDE_CHAR_VERSION + *--p = thousep[0]; +# else + p -= thousep_len; + DCHAR_CPY (p, thousep, thousep_len); +# endif + insert--; + if (insert == 0) + break; + if (g[1] != 0) + g++; + } + } + for (;;) + { + *--p = *digitp++; + if (p == p_before_intpart) + break; + } + p = p_after_intpart; + ndigits = precision; +# undef thousep_len + } else *p++ = '0'; /* Here ndigits <= precision. */ @@ -5410,10 +6188,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, digits without trailing zeroes. */ if (exponent >= 0) { - size_t ecount = exponent + 1; - /* Note: ecount <= precision = ndigits. */ - for (; ecount > 0; ecount--) - *p++ = digits[--ndigits]; + /* Number of digits before the decimal point. */ + size_t intpart_digits = exponent + 1; + /* Note: intpart_digits <= precision = ndigits. */ + + const DCHAR_T *thousep = NULL; + DCHAR_T thousep_buf[10]; +# if !WIDE_CHAR_VERSION + size_t thousep_len = 0; +# endif + const signed char *grouping; + size_t insert = 0; + + if ((flags & FLAG_GROUP) && (intpart_digits > 1)) + { + /* Determine the thousands separator and + the grouping rule of the current locale. */ +# if WIDE_CHAR_VERSION + /* DCHAR_T is wchar_t. */ + thousep = thousands_separator_wchar (thousep_buf); +# define thousep_len 1 +# elif defined DCHAR_CONV_FROM_ENCODING + /* DCHAR_T is uintN_t. */ + thousep = thousands_separator_DCHAR (thousep_buf); + thousep_len = DCHAR_STRLEN (thousep); +# else + /* DCHAR_T is char. */ + thousep = thousands_separator_char (thousep_buf); + thousep_len = strlen (thousep); +# endif + if (*thousep == 0) + thousep = NULL; + if (thousep != NULL) + { + grouping = grouping_rule (); + insert = + num_thousands_separators (grouping, intpart_digits); + } + } + + const char *digitp = digits + ndigits - intpart_digits; + DCHAR_T *p_before_intpart = p; + p += intpart_digits + insert * thousep_len; + DCHAR_T *p_after_intpart = p; + if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */ + { + const signed char *g = grouping; + for (;;) + { + int h = *g; + if (h <= 0) + abort (); + int i = h; + do + *--p = *digitp++; + while (--i > 0); +# if WIDE_CHAR_VERSION + *--p = thousep[0]; +# else + p -= thousep_len; + DCHAR_CPY (p, thousep, thousep_len); +# endif + insert--; + if (insert == 0) + break; + if (g[1] != 0) + g++; + } + } + for (;;) + { + *--p = *digitp++; + if (p == p_before_intpart) + break; + } + p = p_after_intpart; + ndigits -= intpart_digits; +# undef thousep_len + if ((flags & FLAG_ALT) || ndigits > nzeroes) { *p++ = decimal_point_char (); @@ -5606,7 +6458,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { size_t n = xsum (length, count); - ENSURE_ALLOCATION (n); + ENSURE_ALLOCATION_ELSE (n, + { if (tmp != tmpbuf) free (tmp); goto out_of_memory; }); } /* Append the result. */ @@ -5620,13 +6473,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; -#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 +#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 int has_width; #endif -#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 +#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 size_t width; #endif -#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 +#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 int has_precision; size_t precision; #endif @@ -5635,9 +6488,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #else # define prec_ourselves 0 #endif +#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT + int group_ourselves; +#else +# define group_ourselves 0 +#endif #if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST # define pad_ourselves 1 -#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION +#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 int pad_ourselves; #else # define pad_ourselves 0 @@ -5652,10 +6510,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, TCHAR_T *tmp; #endif -#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 +#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 has_width = 0; #endif -#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 +#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 width = 0; if (dp->width_start != dp->width_end) { @@ -5683,13 +6541,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, width = xsum (xtimes (width, 10), *digitp++ - '0'); while (digitp != dp->width_end); } -# 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 + if (width > (size_t) INT_MAX) + goto overflow; +# define WIDTH_IS_CHECKED 1 +# 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 has_width = 1; # endif } #endif -#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 +#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 has_precision = 0; precision = 6; if (dp->precision_start != dp->precision_end) @@ -5754,8 +6615,37 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } #endif + /* Decide whether to add the thousands separators ourselves. */ +#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT + if (flags & FLAG_GROUP) + { + switch (dp->conversion) + { + case 'd': case 'i': case 'u': +# if NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT + group_ourselves = 1; +# else + group_ourselves = prec_ourselves; +# endif + break; + case 'f': case 'F': case 'g': case 'G': +# if NEED_PRINTF_FLAG_GROUPING + group_ourselves = 1; +# else + group_ourselves = prec_ourselves; +# endif + break; + default: + group_ourselves = 0; + break; + } + } + else + group_ourselves = 0; +#endif + /* Decide whether to perform the padding ourselves. */ -#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) +#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) switch (dp->conversion) { # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO @@ -5772,7 +6662,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, pad_ourselves = 1; break; default: - pad_ourselves = prec_ourselves; + pad_ourselves = prec_ourselves | group_ourselves; break; } #endif @@ -5805,14 +6695,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, sprintf. */ fbp = buf; *fbp++ = '%'; -#if NEED_PRINTF_FLAG_GROUPING - /* The underlying implementation doesn't support the ' flag. - Produce no grouping characters in this case; this is - acceptable because the grouping is locale dependent. */ -#else - if (flags & FLAG_GROUP) + if ((flags & FLAG_GROUP) && !group_ourselves) *fbp++ = '\''; -#endif if (flags & FLAG_LEFT) *fbp++ = '-'; if (flags & FLAG_SHOWSIGN) @@ -5832,6 +6716,43 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (dp->width_start != dp->width_end) { size_t n = dp->width_end - dp->width_start; +#if !WIDTH_IS_CHECKED + size_t width; + /* Reject an out-of-range width. + The underlying SNPRINTF already does this on some + platforms (glibc, musl, macOS, FreeBSD, NetBSD, + OpenBSD, Cygwin, Solaris, MSVC). However, on others + (AIX, mingw), it doesn't; thus this vasnprintf + invocation would succeed and produce a wrong result. + So, this is redundant on some platforms, but it's a + quick check anyway. */ + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + width = arg; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + width = -width; + } + } + else + { + const FCHAR_T *digitp = dp->width_start; + + width = 0; + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + if (width > (size_t) INT_MAX) + goto overflow; +#endif /* The width specification is known to consist only of standard ASCII characters. */ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) @@ -5870,7 +6791,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } } - switch (type) + switch (+type) { case TYPE_LONGLONGINT: case TYPE_ULONGLONGINT: @@ -5984,9 +6905,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #if HAVE_WINT_T case TYPE_WIDE_CHAR: #endif - #if HAVE_WCHAR_T case TYPE_WIDE_STRING: - #endif *fbp++ = 'l'; break; case TYPE_LONGDOUBLE: @@ -6168,7 +7087,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #endif errno = 0; - switch (type) + switch (+type) { case TYPE_SCHAR: { @@ -6358,14 +7277,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, SNPRINTF_BUF (arg); } break; -#if HAVE_WCHAR_T case TYPE_WIDE_STRING: { const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; SNPRINTF_BUF (arg); } break; -#endif case TYPE_POINTER: { void *arg = a.arg[dp->arg_index].a.a_pointer; @@ -6539,10 +7456,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, || *prec_ptr == ' ')) prefix_count = 1; /* Put the additional zeroes after the 0x prefix if - (flags & FLAG_ALT) || (dp->conversion == 'p'). */ + (flags & FLAG_ALT) || (dp->conversion == 'p'), or + after the 0b prefix if (flags & FLAG_ALT). */ else if (count >= 2 && prec_ptr[0] == '0' - && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) + && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X' + || prec_ptr[1] == 'b' + || prec_ptr[1] == 'B')) prefix_count = 2; move = count - prefix_count; @@ -6591,6 +7511,135 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, } #endif +#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT + if (group_ourselves) /* implies (flags & FLAG_GROUP) */ + /* Handle the grouping. */ + switch (dp->conversion) + { + /* These are the only conversion to which grouping + applies. */ + case 'd': case 'i': case 'u': + case 'f': case 'F': case 'g': case 'G': + { + /* Determine the thousands separator of the current + locale. */ + const TCHAR_T *thousep; + TCHAR_T thousep_buf[10]; + +# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR + /* TCHAR_T is wchar_t. */ + thousep = thousands_separator_wchar (thousep_buf); +# else + /* TCHAR_T is char. */ + thousep = thousands_separator_char (thousep_buf); +# endif + + /* Nothing to do in locales where thousep is the empty + string. */ + if (*thousep != 0) + { + /* Since FLAG_LOCALIZED is only supported on glibc + systems, here we can assume that all digits are + the ASCII digits '0'..'9'. */ + TCHAR_T *number_ptr = +# if USE_SNPRINTF + (TCHAR_T *) (result + length); +# else + tmp; +# endif + TCHAR_T *end_ptr = number_ptr + count; + + /* Find where the leading digits start. */ + TCHAR_T *digits_ptr = number_ptr; + if (count >= 1 + && (*digits_ptr == '-' || *digits_ptr == '+' + || *digits_ptr == ' ')) + digits_ptr++; + + /* Find where the leading digits end. */ + TCHAR_T *digits_end_ptr; + switch (dp->conversion) + { + case 'd': case 'i': case 'u': + digits_end_ptr = end_ptr; + break; + case 'f': case 'F': case 'g': case 'G': + { + TCHAR_T decimal_point = decimal_point_char (); + for (digits_end_ptr = digits_ptr; + digits_end_ptr < end_ptr; + digits_end_ptr++) + if (*digits_end_ptr == decimal_point + || *digits_end_ptr == 'e') + break; + } + break; + } + + /* Determine the number of thousands separators + to insert. */ + const signed char *grouping = grouping_rule (); + size_t insert = + num_thousands_separators (grouping, digits_end_ptr - digits_ptr); + if (insert > 0) + { +# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR +# define thousep_len 1 +# else + size_t thousep_len = strlen (thousep); +# endif +# if USE_SNPRINTF + size_t digits_offset = digits_ptr - number_ptr; + size_t digits_end_offset = digits_end_ptr - number_ptr; + size_t n = + xsum (length, + (count + insert * thousep_len + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR); + length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; + ENSURE_ALLOCATION (n); + length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; + number_ptr = (TCHAR_T *) (result + length); + end_ptr = number_ptr + count; + digits_ptr = number_ptr + digits_offset; + digits_end_ptr = number_ptr + digits_end_offset; +# endif + + count += insert * thousep_len; + + const TCHAR_T *p = end_ptr; + TCHAR_T *q = end_ptr + insert * thousep_len; + while (p > digits_end_ptr) + *--q = *--p; + const signed char *g = grouping; + for (;;) + { + int h = *g; + if (h <= 0) + abort (); + int i = h; + do + *--q = *--p; + while (--i > 0); +# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR + *--q = *thousep; +# else + q -= thousep_len; + memcpy (q, thousep, thousep_len); +# endif + insert--; + if (insert == 0) + break; + if (g[1] != 0) + g++; + } + /* Here q == p. Done with the insertions. */ + } + } + } + break; + } +#endif + #if !USE_SNPRINTF if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the @@ -6601,6 +7650,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #if !DCHAR_IS_TCHAR /* Convert from TCHAR_T[] to DCHAR_T[]. */ if (dp->conversion == 'c' || dp->conversion == 's' + || (flags & FLAG_GROUP) # if __GLIBC__ >= 2 && !defined __UCLIBC__ || (flags & FLAG_LOCALIZED) # endif @@ -6677,7 +7727,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, goto fail_with_errno; # endif ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), - { free (tmpdst); goto out_of_memory; }); + { free (tmpdst); goto out_of_memory; }); DCHAR_CPY (result + length, tmpdst, tmpdst_len); free (tmpdst); count = tmpdst_len; @@ -6742,7 +7792,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Here count <= allocated - length. */ /* Perform padding. */ -#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 +#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 if (pad_ourselves && has_width) { size_t w; @@ -6751,6 +7801,23 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, against the number of _characters_ of the converted value. */ w = DCHAR_MBSNLEN (result + length, count); +# elif __GLIBC__ >= 2 + /* glibc prefers to compare the width against the number + of characters as well, but only for numeric conversion + specifiers. See + + + */ + switch (dp->conversion) + { + case 'd': case 'i': case 'u': + case 'f': case 'F': case 'g': case 'G': + w = DCHAR_MBSNLEN (result + length, count); + break; + default: + w = count; + break; + } # else /* The width is compared against the number of _bytes_ of the converted value, says POSIX. */ @@ -6929,17 +7996,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, not have this limitation. */ return result; -#if USE_SNPRINTF overflow: errno = EOVERFLOW; goto fail_with_errno; -#endif out_of_memory: errno = ENOMEM; goto fail_with_errno; -#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) +#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) fail_with_EILSEQ: errno = EILSEQ; 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 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2024 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -25,6 +25,7 @@ #include #include +#include #include #include "vasnprintf.h" @@ -37,12 +38,21 @@ vasprintf (char **resultp, const char *format, va_list args) if (result == NULL) return -1; +#if PTRDIFF_MAX > INT_MAX if (length > INT_MAX) { free (result); - errno = EOVERFLOW; + errno = (length > PTRDIFF_MAX ? ENOMEM : EOVERFLOW); return -1; } +#else + if (length > PTRDIFF_MAX) + { + free (result); + errno = ENOMEM; + return -1; + } +#endif *resultp = result; /* 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 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -34,11 +34,12 @@ #ifndef __cplusplus # if (201112 <= __STDC_VERSION__ \ || (!defined __STRICT_ANSI__ \ - && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) + && ((4 < __GNUC__ + (6 <= __GNUC_MINOR__) && !defined __clang__) \ + || 5 <= __clang_major__))) # define _GL_HAVE__STATIC_ASSERT 1 # endif # if (202311 <= __STDC_VERSION__ \ - || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) + || (!defined __STRICT_ANSI__ && 9 <= __GNUC__ && !defined __clang__)) # define _GL_HAVE__STATIC_ASSERT1 1 # endif #endif @@ -156,9 +157,10 @@ #define _GL_CONCAT0(x, y) x##y /* _GL_COUNTER is an integer, preferably one that changes each time we - use it. Use __COUNTER__ if it works, falling back on __LINE__ - otherwise. __LINE__ isn't perfect, but it's better than a - constant. */ + use it. Use __COUNTER__ if it works (it does so with most compilers, + see ), + falling back on __LINE__ otherwise. __LINE__ isn't perfect, but it's + better than a constant. */ #if defined __COUNTER__ && __COUNTER__ != __COUNTER__ # define _GL_COUNTER __COUNTER__ #else @@ -215,7 +217,7 @@ template # define _GL_VERIFY(R, DIAGNOSTIC, ...) \ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] -# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) && !defined __clang__ # pragma GCC diagnostic ignored "-Wnested-externs" # endif #endif @@ -254,16 +256,32 @@ template # endif # endif /* Define static_assert if needed. */ +# if defined __cplusplus && defined __clang__ && __clang_major__ < 9 +/* clang++ before commit 5c739665a8721228cf6143fd4ef95870a59f55ae had a + two-arguments static_assert but not the one-argument static_assert. */ +# undef static_assert +# endif # if (!defined static_assert \ && __STDC_VERSION__ < 202311 \ && (!defined __cplusplus \ || (__cpp_static_assert < 201411 \ && __GNUG__ < 6 && __clang_major__ < 6 && _MSC_VER < 1910))) -# if defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__ +# if (defined __cplusplus && defined __GNUG__ && __GNUG__ < 6 \ + && __cplusplus == 201103L && !defined __clang__) +/* g++ >= 4.7, < 6 with option -std=c++11 or -std=gnu++11 supports the + two-arguments static_assert but not the one-argument static_assert, and + it does not support _Static_assert. + We have to play preprocessor tricks to distinguish the two cases. */ +# define _GL_SA1(a1) static_assert ((a1), "static assertion failed") +# define _GL_SA2 static_assert +# define _GL_SA3 static_assert +# define _GL_SA_PICK(x1,x2,x3,x4,...) x4 +# define static_assert(...) _GL_SA_PICK(__VA_ARGS__,_GL_SA3,_GL_SA2,_GL_SA1) (__VA_ARGS__) +# elif defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__ /* MSVC 14 in C++ mode supports the two-arguments static_assert but not the one-argument static_assert, and it does not support _Static_assert. We have to play preprocessor tricks to distinguish the two cases. - Since the MSVC preprocessor is not ISO C compliant (see above),. + Since the MSVC preprocessor is not ISO C compliant (see above), the solution is specific to MSVC. */ # define _GL_EXPAND(x) x # define _GL_SA1(a1) static_assert ((a1), "static assertion failed") @@ -294,7 +312,7 @@ template #ifndef _GL_HAS_BUILTIN_UNREACHABLE # if defined __clang_major__ && __clang_major__ < 5 # define _GL_HAS_BUILTIN_UNREACHABLE 0 -# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) +# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__ # define _GL_HAS_BUILTIN_UNREACHABLE 1 # elif defined __has_builtin # 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 @@ /* Formatted output to strings. - Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc. - Written by Simon Josefsson and Yoann Vandoorselaere . + Copyright (C) 2004, 2006-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -25,46 +24,20 @@ #include #include #include -#include -#include +#include -#include "vasnprintf.h" - -/* Print formatted output to string STR. Similar to vsprintf, but - additional length SIZE limit how much is written into STR. Returns - string length of formatted string (which may be larger than SIZE). - STR may be NULL, in which case nothing will be written. On error, - return a negative value. */ int vsnprintf (char *str, size_t size, const char *format, va_list args) { - char *output; - size_t len; - size_t lenbuf = size; - - output = vasnprintf (str, &lenbuf, format, args); - len = lenbuf; - - if (!output) - return -1; - - if (output != str) - { - if (size) - { - size_t pruned_len = (len < size ? len : size - 1); - memcpy (str, output, pruned_len); - str[pruned_len] = '\0'; - } - - free (output); - } + ptrdiff_t ret = vsnzprintf (str, size, format, args); - if (len > INT_MAX) +#if PTRDIFF_MAX > INT_MAX + if (ret > INT_MAX) { errno = EOVERFLOW; return -1; } +#endif - return len; + return ret; } 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 @@ +/* Formatted output to strings. + Copyright (C) 2004, 2006-2025 Free Software Foundation, Inc. + Written by Simon Josefsson and Yoann Vandoorselaere . + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +/* Specification. */ +#include + +#include +#include +#include +#include +#include + +#include "vasnprintf.h" + +ptrdiff_t +vsnzprintf (char *str, size_t size, const char *format, va_list args) +{ + char *output; + size_t len; + size_t lenbuf = size; + + output = vasnprintf (str, &lenbuf, format, args); + len = lenbuf; + + if (!output) + return -1; + + if (output != str) + { + if (size) + { + size_t pruned_len = (len < size ? len : size - 1); + memcpy (str, output, pruned_len); + str[pruned_len] = '\0'; + } + + free (output); + } + + if (len > PTRDIFF_MAX) + { + errno = ENOMEM; + return -1; + } + + return len; +} 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 @@ /* w32sock.h --- internal auxiliary functions for Windows socket functions - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2010-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -85,7 +85,7 @@ */ #ifndef _GL_WARN_ON_USE -# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) @@ -98,7 +98,7 @@ _GL_WARN_EXTERN_C __typeof__ (function) function \ __attribute__ ((__diagnose_if__ (1, message, "warning"))) # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ __attribute__ ((__diagnose_if__ (1, message, "warning"))) -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C __typeof__ (function) function @@ -121,7 +121,7 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ _GL_WARN_ON_USE (function, msg) # else -# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__ /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern rettype_gcc function parameters_and_attributes \ @@ -131,7 +131,7 @@ extern rettype_gcc function parameters_and_attributes \ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern rettype_clang function parameters_and_attributes \ __attribute__ ((__diagnose_if__ (1, msg, "warning"))) -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING /* Verify the existence of the function. */ # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ extern 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 @@ /* A substitute for ISO C99 , for platforms that have issues. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -37,7 +37,7 @@ && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \ || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ - || defined _GL_ALREADY_INCLUDING_WCHAR_H) + || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_WCHAR_H) /* Special invocation convention: - Inside glibc and uClibc header files, but not MinGW. - On HP-UX 11.00 we have a sequence of nested includes @@ -53,13 +53,16 @@ is completely included or is still being included. */ #@INCLUDE_NEXT@ @NEXT_WCHAR_H@ +/* The glibc 2.5 /usr/include/wchar.h defines __need_wint_t but never undefines + it. We need to do that here. */ +#undef __need_wint_t #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_WCHAR_H -#define _GL_ALREADY_INCLUDING_WCHAR_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_WCHAR_H #if @HAVE_FEATURES_H@ # include /* for __GLIBC__ */ @@ -79,7 +82,7 @@ # @INCLUDE_NEXT@ @NEXT_WCHAR_H@ #endif -#undef _GL_ALREADY_INCLUDING_WCHAR_H +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_WCHAR_H #ifndef _@GUARD_PREFIX@_WCHAR_H #define _@GUARD_PREFIX@_WCHAR_H @@ -95,7 +98,7 @@ that can be freed by passing them as the Ith argument to the function F. */ #ifndef _GL_ATTRIBUTE_DEALLOC -# if __GNUC__ >= 11 +# if __GNUC__ >= 11 && !defined __clang__ # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) # else # define _GL_ATTRIBUTE_DEALLOC(f, i) @@ -137,11 +140,23 @@ # endif #endif +/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP + (a pointer) must not be NULL if the argument NI (an integer) is != 0. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO +# if __GNUC__ >= 15 && !defined __clang__ +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \ + __attribute__ ((__nonnull_if_nonzero__ (np, ni))) +# else +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) +# endif +#endif + /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 +# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -198,11 +213,12 @@ typedef unsigned int rpl_wint_t; /* Override mbstate_t if it is too small. On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for implementing mbrtowc for encodings like UTF-8. - On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is - large enough and overriding it would cause problems in C++ mode. */ + On AIX, MSVC, and OpenBSD 6.0, mbrtowc needs to be overridden, but + mbstate_t exists and is large enough and overriding it would cause problems + in C++ mode. */ #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ # if !GNULIB_defined_mbstate_t -# if !(defined _AIX || defined _MSC_VER) +# if !(defined _AIX || defined _MSC_VER || defined __OpenBSD__) typedef int rpl_mbstate_t; # undef mbstate_t # define mbstate_t rpl_mbstate_t @@ -262,6 +278,55 @@ _GL_EXTERN_C void free (void *); #endif +/* Declarations for ISO C N3322. */ +#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ +_GL_EXTERN_C wchar_t *wmemcpy (wchar_t *__dest, const wchar_t *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C wchar_t *wmemmove (wchar_t *__dest, const wchar_t *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C wchar_t *wcsncpy (wchar_t *__dest, const wchar_t *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C wchar_t *wcsncat (wchar_t *__dest, const wchar_t *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +# ifndef __cplusplus +_GL_EXTERN_C wchar_t *wmemchr (const wchar_t *__s, wchar_t __wc, size_t __n) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3); +# endif +_GL_EXTERN_C wchar_t *wmemset (wchar_t *__s, wchar_t __wc, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3); +#endif + + /* Convert a single-byte character to a wide character. */ #if @GNULIB_BTOWC@ # if @REPLACE_BTOWC@ @@ -269,11 +334,11 @@ _GL_EXTERN_C void free (void *); # undef btowc # define btowc rpl_btowc # endif -_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_RPL (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); # else # if !@HAVE_BTOWC@ -_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_SYS (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE); # endif /* Need to cast, because on mingw, the return type is 'unsigned short'. */ _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); @@ -297,12 +362,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - " # undef wctob # define wctob rpl_wctob # endif -_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_RPL (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); # else # if !defined wctob && !@HAVE_DECL_WCTOB@ /* wctob is provided by gnulib, or wctob exists but is not declared. */ -_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_SYS (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); # endif @@ -325,11 +390,11 @@ _GL_WARN_ON_USE (wctob, "wctob is unportable - " # undef mbsinit # define mbsinit rpl_mbsinit # endif -_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); +_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps), ); _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); # else # if !@HAVE_MBSINIT@ -_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); +_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps), ); # endif _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); # endif @@ -531,16 +596,19 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " # define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t) # endif _GL_BEGIN_C_LINKAGE -# if defined IN_MBSZERO +# if !GNULIB_defined_mbszero +# if defined IN_MBSZERO _GL_EXTERN_INLINE -# else +# else _GL_INLINE -# endif +# endif _GL_ARG_NONNULL ((1)) void mbszero (mbstate_t *ps) { memset (ps, 0, _GL_MBSTATE_ZERO_SIZE); } +# define GNULIB_defined_mbszero 1 +# endif _GL_END_C_LINKAGE _GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps)); _GL_CXXALIASWARN (mbszero); @@ -556,7 +624,7 @@ _GL_CXXALIASWARN (mbszero); # endif _GL_FUNCDECL_RPL (mbrtowc, size_t, (wchar_t *restrict pwc, const char *restrict s, size_t n, - mbstate_t *restrict ps)); + mbstate_t *restrict ps), ); _GL_CXXALIAS_RPL (mbrtowc, size_t, (wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps)); @@ -564,7 +632,7 @@ _GL_CXXALIAS_RPL (mbrtowc, size_t, # if !@HAVE_MBRTOWC@ _GL_FUNCDECL_SYS (mbrtowc, size_t, (wchar_t *restrict pwc, const char *restrict s, size_t n, - mbstate_t *restrict ps)); + mbstate_t *restrict ps), ); # endif _GL_CXXALIAS_SYS (mbrtowc, size_t, (wchar_t *restrict pwc, const char *restrict s, size_t n, @@ -590,13 +658,13 @@ _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " # define mbrlen rpl_mbrlen # endif _GL_FUNCDECL_RPL (mbrlen, size_t, - (const char *restrict s, size_t n, mbstate_t *restrict ps)); + (const char *restrict s, size_t n, mbstate_t *restrict ps), ); _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *restrict s, size_t n, mbstate_t *restrict ps)); # else # if !@HAVE_MBRLEN@ _GL_FUNCDECL_SYS (mbrlen, size_t, - (const char *restrict s, size_t n, mbstate_t *restrict ps)); + (const char *restrict s, size_t n, mbstate_t *restrict ps), ); # endif _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *restrict s, size_t n, mbstate_t *restrict ps)); @@ -623,7 +691,7 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " _GL_FUNCDECL_RPL (mbsrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t len, - mbstate_t *restrict ps) + mbstate_t *restrict ps), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mbsrtowcs, size_t, (wchar_t *restrict dest, @@ -634,7 +702,7 @@ _GL_CXXALIAS_RPL (mbsrtowcs, size_t, _GL_FUNCDECL_SYS (mbsrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t len, - mbstate_t *restrict ps) + mbstate_t *restrict ps), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mbsrtowcs, size_t, @@ -664,7 +732,7 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t srclen, size_t len, - mbstate_t *restrict ps) + mbstate_t *restrict ps), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, (wchar_t *restrict dest, @@ -675,7 +743,7 @@ _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, (wchar_t *restrict dest, const char **restrict srcp, size_t srclen, size_t len, - mbstate_t *restrict ps) + mbstate_t *restrict ps), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, @@ -703,13 +771,13 @@ _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " # define wcrtomb rpl_wcrtomb # endif _GL_FUNCDECL_RPL (wcrtomb, size_t, - (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); + (char *restrict s, wchar_t wc, mbstate_t *restrict ps), ); _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); # else # if !@HAVE_WCRTOMB@ _GL_FUNCDECL_SYS (wcrtomb, size_t, - (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); + (char *restrict s, wchar_t wc, mbstate_t *restrict ps), ); # endif _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); @@ -736,7 +804,7 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " _GL_FUNCDECL_RPL (wcsrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t len, - mbstate_t *restrict ps) + mbstate_t *restrict ps), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (wcsrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, @@ -747,7 +815,7 @@ _GL_CXXALIAS_RPL (wcsrtombs, size_t, _GL_FUNCDECL_SYS (wcsrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t len, - mbstate_t *restrict ps) + mbstate_t *restrict ps), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (wcsrtombs, size_t, @@ -778,7 +846,7 @@ _GL_FUNCDECL_RPL (wcsnrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t srclen, size_t len, - mbstate_t *restrict ps) + mbstate_t *restrict ps), _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (wcsnrtombs, size_t, (char *restrict dest, @@ -791,7 +859,7 @@ _GL_FUNCDECL_SYS (wcsnrtombs, size_t, (char *restrict dest, const wchar_t **restrict srcp, size_t srclen, size_t len, - mbstate_t *restrict ps) + mbstate_t *restrict ps), _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (wcsnrtombs, size_t, @@ -819,12 +887,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " # undef wcwidth # define wcwidth rpl_wcwidth # endif -_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); # else # if !@HAVE_DECL_WCWIDTH@ /* wcwidth exists but is not declared. */ -_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); # endif @@ -843,8 +911,9 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " /* Search N wide characters of S for C. */ #if @GNULIB_WMEMCHR@ # if !@HAVE_WMEMCHR@ -_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) - _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_SYS (wmemchr, wchar_t *, + (const wchar_t *s, wchar_t c, size_t n), + _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { @@ -855,11 +924,12 @@ _GL_CXXALIAS_SYS_CAST2 (wmemchr, wchar_t *, (const wchar_t *, wchar_t, size_t), const wchar_t *, (const wchar_t *, wchar_t, size_t)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \ + && !defined __clang__ _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, (const wchar_t *s, wchar_t c, size_t n)); -# elif __GLIBC__ >= 2 +# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO _GL_CXXALIASWARN (wmemchr); # endif #elif defined GNULIB_POSIXCHECK @@ -879,15 +949,19 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " # define wmemcmp rpl_wmemcmp # endif _GL_FUNCDECL_RPL (wmemcmp, int, - (const wchar_t *s1, const wchar_t *s2, size_t n) - _GL_ATTRIBUTE_PURE); + (const wchar_t *s1, const wchar_t *s2, size_t n), + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); _GL_CXXALIAS_RPL (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); # else # if !@HAVE_WMEMCMP@ _GL_FUNCDECL_SYS (wmemcmp, int, - (const wchar_t *s1, const wchar_t *s2, size_t n) - _GL_ATTRIBUTE_PURE); + (const wchar_t *s1, const wchar_t *s2, size_t n), + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); @@ -909,7 +983,9 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " # if !@HAVE_WMEMCPY@ _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, (wchar_t *restrict dest, - const wchar_t *restrict src, size_t n)); + const wchar_t *restrict src, size_t n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, (wchar_t *restrict dest, @@ -931,7 +1007,9 @@ _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " #if @GNULIB_WMEMMOVE@ # if !@HAVE_WMEMMOVE@ _GL_FUNCDECL_SYS (wmemmove, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *dest, const wchar_t *src, size_t n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wmemmove, wchar_t *, (wchar_t *dest, const wchar_t *src, size_t n)); @@ -957,7 +1035,7 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " # endif _GL_FUNCDECL_RPL (wmempcpy, wchar_t *, (wchar_t *restrict dest, - const wchar_t *restrict src, size_t n)); + const wchar_t *restrict src, size_t n), ); _GL_CXXALIAS_RPL (wmempcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); @@ -965,7 +1043,7 @@ _GL_CXXALIAS_RPL (wmempcpy, wchar_t *, # if !@HAVE_WMEMPCPY@ _GL_FUNCDECL_SYS (wmempcpy, wchar_t *, (wchar_t *restrict dest, - const wchar_t *restrict src, size_t n)); + const wchar_t *restrict src, size_t n), ); # endif _GL_CXXALIAS_SYS (wmempcpy, wchar_t *, (wchar_t *restrict dest, @@ -986,7 +1064,8 @@ _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - " /* Set N wide characters of S to C. */ #if @GNULIB_WMEMSET@ # if !@HAVE_WMEMSET@ -_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)); # endif _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); # if __GLIBC__ >= 2 @@ -1004,7 +1083,7 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " /* Return the number of wide characters in S. */ #if @GNULIB_WCSLEN@ # if !@HAVE_WCSLEN@ -_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s), _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); # if __GLIBC__ >= 2 @@ -1025,7 +1104,7 @@ _GL_WARN_ON_USE (wcslen, "wcslen is unportable - " namespace, not in the global namespace. So, force a declaration in the global namespace. */ # if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus) -_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) +_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen), _GL_ATTRIBUTE_PURE); # endif _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 - " #if @GNULIB_WCSCPY@ # if !@HAVE_WCSCPY@ _GL_FUNCDECL_SYS (wcscpy, wchar_t *, - (wchar_t *restrict dest, const wchar_t *restrict src)); + (wchar_t *restrict dest, const wchar_t *restrict src), ); # endif _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); @@ -1066,7 +1145,7 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " the global namespace. */ # if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus) _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, - (wchar_t *restrict dest, const wchar_t *restrict src)); + (wchar_t *restrict dest, const wchar_t *restrict src), ); # endif _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); @@ -1085,7 +1164,9 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " # if !@HAVE_WCSNCPY@ _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, (wchar_t *restrict dest, - const wchar_t *restrict src, size_t n)); + const wchar_t *restrict src, size_t n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, (wchar_t *restrict dest, @@ -1111,7 +1192,7 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " # if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus) _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, (wchar_t *restrict dest, - const wchar_t *restrict src, size_t n)); + const wchar_t *restrict src, size_t n), ); # endif _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, (wchar_t *restrict dest, @@ -1130,7 +1211,7 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " #if @GNULIB_WCSCAT@ # if !@HAVE_WCSCAT@ _GL_FUNCDECL_SYS (wcscat, wchar_t *, - (wchar_t *restrict dest, const wchar_t *restrict src)); + (wchar_t *restrict dest, const wchar_t *restrict src), ); # endif _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); @@ -1148,14 +1229,31 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " /* Append no more than N wide characters of SRC onto DEST. */ #if @GNULIB_WCSNCAT@ -# if !@HAVE_WCSNCAT@ -_GL_FUNCDECL_SYS (wcsncat, wchar_t *, +# if @REPLACE_WCSNCAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcsncat +# define wcsncat rpl_wcsncat +# endif +_GL_FUNCDECL_RPL (wcsncat, wchar_t *, + (wchar_t *restrict dest, const wchar_t *restrict src, + size_t n), + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); +_GL_CXXALIAS_RPL (wcsncat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); -# endif +# else +# if !@HAVE_WCSNCAT@ +_GL_FUNCDECL_SYS (wcsncat, wchar_t *, + (wchar_t *restrict dest, const wchar_t *restrict src, + size_t n), + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); +# endif _GL_CXXALIAS_SYS (wcsncat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); +# endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncat); # endif @@ -1175,12 +1273,12 @@ _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " # undef wcscmp # define wcscmp rpl_wcscmp # endif -_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) +_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2), _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); # else # if !@HAVE_WCSCMP@ -_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) +_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2), _GL_ATTRIBUTE_PURE); # endif _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 - " # define wcsncmp rpl_wcsncmp # endif _GL_FUNCDECL_RPL (wcsncmp, int, - (const wchar_t *s1, const wchar_t *s2, size_t n) - _GL_ATTRIBUTE_PURE); + (const wchar_t *s1, const wchar_t *s2, size_t n), + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); _GL_CXXALIAS_RPL (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); # else # if !@HAVE_WCSNCMP@ _GL_FUNCDECL_SYS (wcsncmp, int, - (const wchar_t *s1, const wchar_t *s2, size_t n) - _GL_ATTRIBUTE_PURE); + (const wchar_t *s1, const wchar_t *s2, size_t n), + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); @@ -1236,7 +1338,7 @@ _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " namespace, not in the global namespace. So, force a declaration in the global namespace. */ # if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus) -_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) +_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2), _GL_ATTRIBUTE_PURE); # endif _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 - " the global namespace. */ # if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus) _GL_FUNCDECL_SYS (wcsncasecmp, int, - (const wchar_t *s1, const wchar_t *s2, size_t n) + (const wchar_t *s1, const wchar_t *s2, size_t n), _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcsncasecmp, int, @@ -1276,7 +1378,7 @@ _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " category of the current locale. */ #if @GNULIB_WCSCOLL@ # if !@HAVE_WCSCOLL@ -_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); +_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2), ); # endif _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); # if __GLIBC__ >= 2 @@ -1297,7 +1399,7 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " #if @GNULIB_WCSXFRM@ # if !@HAVE_WCSXFRM@ _GL_FUNCDECL_SYS (wcsxfrm, size_t, - (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); + (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n), ); # endif _GL_CXXALIAS_SYS (wcsxfrm, size_t, (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)); /* On Solaris 11.3, the header files declare the function in the std:: namespace, not in the global namespace. So, force a declaration in the global namespace. */ -# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11 +# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) \ + || (__GNUC__ >= 11 && !defined __clang__) # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, - (const wchar_t *s) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (const wchar_t *s), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (wcsdup, wchar_t *, - (const wchar_t *s) + (const wchar_t *s), _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # endif @@ -1341,16 +1444,16 @@ _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); # endif _GL_CXXALIASWARN (wcsdup); #else -# if __GNUC__ >= 11 && !defined wcsdup +# if (__GNUC__ >= 11 && !defined __clang__) && !defined wcsdup /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */ # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, - (const wchar_t *s) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (const wchar_t *s), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (wcsdup, wchar_t *, - (const wchar_t *s) + (const wchar_t *s), _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # endif @@ -1373,12 +1476,12 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); # else # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 _GL_FUNCDECL_SYS (wcsdup, wchar_t *, - (const wchar_t *s) - _GL_ATTRIBUTE_NOTHROW - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); + (const wchar_t *s), + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE) + _GL_ATTRIBUTE_NOTHROW; # else _GL_FUNCDECL_SYS (wcsdup, wchar_t *, - (const wchar_t *s) + (const wchar_t *s), _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); # endif # if @HAVE_DECL_WCSDUP@ @@ -1395,7 +1498,7 @@ _GL_CXXALIASWARN (wcsdup); /* Find the first occurrence of WC in WCS. */ #if @GNULIB_WCSCHR@ # if !@HAVE_WCSCHR@ -_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) +_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc), _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: @@ -1407,10 +1510,11 @@ _GL_CXXALIAS_SYS_CAST2 (wcschr, wchar_t *, (const wchar_t *, wchar_t), const wchar_t *, (const wchar_t *, wchar_t)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \ + && !defined __clang__ _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); -# elif __GLIBC__ >= 2 +# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO _GL_CXXALIASWARN (wcschr); # endif #elif defined GNULIB_POSIXCHECK @@ -1425,7 +1529,7 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - " /* Find the last occurrence of WC in WCS. */ #if @GNULIB_WCSRCHR@ # if !@HAVE_WCSRCHR@ -_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) +_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc), _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: @@ -1437,10 +1541,11 @@ _GL_CXXALIAS_SYS_CAST2 (wcsrchr, wchar_t *, (const wchar_t *, wchar_t), const wchar_t *, (const wchar_t *, wchar_t)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \ + && !defined __clang__ _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); -# elif __GLIBC__ >= 2 +# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO _GL_CXXALIASWARN (wcsrchr); # endif #elif defined GNULIB_POSIXCHECK @@ -1456,7 +1561,7 @@ _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " of wide characters not in REJECT. */ #if @GNULIB_WCSCSPN@ # if !@HAVE_WCSCSPN@ -_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) +_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject), _GL_ATTRIBUTE_PURE); # endif _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 - " of wide characters in ACCEPT. */ #if @GNULIB_WCSSPN@ # if !@HAVE_WCSSPN@ -_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) +_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept), _GL_ATTRIBUTE_PURE); # endif _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 - " #if @GNULIB_WCSPBRK@ # if !@HAVE_WCSPBRK@ _GL_FUNCDECL_SYS (wcspbrk, wchar_t *, - (const wchar_t *wcs, const wchar_t *accept) + (const wchar_t *wcs, const wchar_t *accept), _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: @@ -1508,12 +1613,13 @@ _GL_CXXALIAS_SYS_CAST2 (wcspbrk, wchar_t *, (const wchar_t *, const wchar_t *), const wchar_t *, (const wchar_t *, const wchar_t *)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \ + && !defined __clang__ _GL_CXXALIASWARN1 (wcspbrk, wchar_t *, (wchar_t *wcs, const wchar_t *accept)); _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, (const wchar_t *wcs, const wchar_t *accept)); -# elif __GLIBC__ >= 2 +# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO _GL_CXXALIASWARN (wcspbrk); # endif #elif defined GNULIB_POSIXCHECK @@ -1534,7 +1640,7 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " # endif _GL_FUNCDECL_RPL (wcsstr, wchar_t *, (const wchar_t *restrict haystack, - const wchar_t *restrict needle) + const wchar_t *restrict needle), _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wcsstr, wchar_t *, (const wchar_t *restrict haystack, @@ -1543,7 +1649,7 @@ _GL_CXXALIAS_RPL (wcsstr, wchar_t *, # if !@HAVE_WCSSTR@ _GL_FUNCDECL_SYS (wcsstr, wchar_t *, (const wchar_t *restrict haystack, - const wchar_t *restrict needle) + const wchar_t *restrict needle), _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: @@ -1558,14 +1664,15 @@ _GL_CXXALIAS_SYS_CAST2 (wcsstr, (const wchar_t *restrict, const wchar_t *restrict)); # endif # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ - && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \ + && !defined __clang__ _GL_CXXALIASWARN1 (wcsstr, wchar_t *, (wchar_t *restrict haystack, const wchar_t *restrict needle)); _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, (const wchar_t *restrict haystack, const wchar_t *restrict needle)); -# elif __GLIBC__ >= 2 +# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO _GL_CXXALIASWARN (wcsstr); # endif #elif defined GNULIB_POSIXCHECK @@ -1586,7 +1693,7 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " # endif _GL_FUNCDECL_RPL (wcstok, wchar_t *, (wchar_t *restrict wcs, const wchar_t *restrict delim, - wchar_t **restrict ptr)); + wchar_t **restrict ptr), ); _GL_CXXALIAS_RPL (wcstok, wchar_t *, (wchar_t *restrict wcs, const wchar_t *restrict delim, wchar_t **restrict ptr)); @@ -1594,7 +1701,7 @@ _GL_CXXALIAS_RPL (wcstok, wchar_t *, # if !@HAVE_WCSTOK@ _GL_FUNCDECL_SYS (wcstok, wchar_t *, (wchar_t *restrict wcs, const wchar_t *restrict delim, - wchar_t **restrict ptr)); + wchar_t **restrict ptr), ); # endif _GL_CXXALIAS_SYS (wcstok, wchar_t *, (wchar_t *restrict wcs, const wchar_t *restrict delim, @@ -1620,12 +1727,12 @@ _GL_WARN_ON_USE (wcstok, "wcstok is unportable - " # undef wcswidth # define wcswidth rpl_wcswidth # endif -_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) +_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n), _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); # else # if !@HAVE_WCSWIDTH@ -_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) +_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n), _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); @@ -1653,7 +1760,7 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " _GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *restrict __buf, size_t __bufsize, const wchar_t *restrict __fmt, - const struct tm *restrict __tp) + const struct tm *restrict __tp), _GL_ARG_NONNULL ((1, 3, 4))); _GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *restrict __buf, size_t __bufsize, @@ -1664,7 +1771,7 @@ _GL_CXXALIAS_RPL (wcsftime, size_t, _GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *restrict __buf, size_t __bufsize, const wchar_t *restrict __fmt, - const struct tm *restrict __tp) + const struct tm *restrict __tp), _GL_ARG_NONNULL ((1, 3, 4))); # endif _GL_CXXALIAS_SYS (wcsftime, size_t, @@ -1698,7 +1805,7 @@ _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " Possible errno values include: - ERANGE if SIZE is too small. - ENOMEM if the memory could no be allocated. */ -_GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size)); +_GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size), ); #endif 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 @@ /* Convert wide character to multibyte character. - Copyright (C) 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2008-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2008. 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 @@ /* Inline functions for . - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -17,7 +17,7 @@ /* Normally this would be wctype.c, but that name's already taken. */ +#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE #include -#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE #include 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 @@ /* Get descriptor for a wide character property. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 @@ /* Get descriptor for a wide character property. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. Written by Bruno Haible , 2011. 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 @@ /* A substitute for ISO C99 , for platforms that lack it. - Copyright (C) 2006-2024 Free Software Foundation, Inc. + Copyright (C) 2006-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -478,9 +478,9 @@ towupper # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define iswblank rpl_iswblank # endif -_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); +_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc), ); # else -_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); +_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc), ); # endif # endif @@ -490,7 +490,7 @@ _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); # undef iswdigit # define iswdigit rpl_iswdigit # endif -_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc)); +_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc), ); # endif # endif @@ -500,7 +500,7 @@ _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc)); # undef iswpunct # define iswpunct rpl_iswpunct # endif -_GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc)); +_GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc), ); # endif # endif @@ -510,7 +510,7 @@ _GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc)); # undef iswxdigit # define iswxdigit rpl_iswxdigit # endif -_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc)); +_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc), ); # endif # endif @@ -659,12 +659,12 @@ typedef void *rpl_wctype_t; # undef wctype # define wctype rpl_wctype # endif -_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name) +_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name)); # else # if !@HAVE_WCTYPE_T@ -_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name) +_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); @@ -689,11 +689,11 @@ _GL_WARN_ON_USE (wctype, "wctype is unportable - " # undef iswctype # define iswctype rpl_iswctype # endif -_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc)); +_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc), ); _GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc)); # else # if !@HAVE_WCTYPE_T@ -_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); +_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc), ); # endif _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); # endif @@ -741,12 +741,12 @@ typedef void *rpl_wctrans_t; # undef wctrans # define wctrans rpl_wctrans # endif -_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name) +_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name)); # else # if !@HAVE_WCTRANS_T@ -_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name) +_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name), _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); @@ -771,11 +771,11 @@ _GL_WARN_ON_USE (wctrans, "wctrans is unportable - " # undef towctrans # define towctrans rpl_towctrans # endif -_GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc)); +_GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc), ); _GL_CXXALIAS_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc)); # else # if !@HAVE_WCTRANS_T@ -_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); +_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc), ); # endif _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); # 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 @@ +/* Determine the number of screen columns needed for a character. + Copyright (C) 2006-2007, 2010-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +/* Get iswprint. */ +#include + +#include "localcharset.h" +#include "streq.h" +#include "uniwidth.h" + +/* Returns 1 if the current locale is an UTF-8 locale, 0 otherwise. */ +static inline int +is_locale_utf8 (void) +{ + const char *encoding = locale_charset (); + return STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0); +} + +#if GNULIB_WCHAR_SINGLE_LOCALE +/* When we know that the locale does not change, provide a speedup by + caching the value of is_locale_utf8. */ +static int cached_is_locale_utf8 = -1; +static inline int +is_locale_utf8_cached (void) +{ + if (cached_is_locale_utf8 < 0) + cached_is_locale_utf8 = is_locale_utf8 (); + return cached_is_locale_utf8; +} +#else +/* By default, don't make assumptions, hence no caching. */ +# define is_locale_utf8_cached is_locale_utf8 +#endif + +int +wcwidth (wchar_t wc) +#undef wcwidth +{ + /* In UTF-8 locales, use a Unicode aware width function. */ + if (is_locale_utf8_cached ()) + { + /* We assume that in a UTF-8 locale, a wide character is the same as a + Unicode character. */ + return uc_width (wc, "UTF-8"); + } + else + { + /* Otherwise, fall back to the system's wcwidth function. */ +#if HAVE_WCWIDTH + return wcwidth (wc); +#else + return wc == 0 ? 0 : iswprint (wc) ? 1 : -1; +#endif + } +} 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 @@ /* Init guards, somewhat like spinlocks (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Plain mutexes (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -23,10 +23,12 @@ #include "windows-mutex.h" #include +#include void glwthread_mutex_init (glwthread_mutex_t *mutex) { + mutex->owner = 0; InitializeCriticalSection (&mutex->lock); mutex->guard.done = 1; } @@ -49,7 +51,13 @@ glwthread_mutex_lock (glwthread_mutex_t *mutex) Sleep (0); } } + /* If this thread already owns the mutex, POSIX pthread_mutex_lock() is + required to deadlock here. But let's not do that on purpose. */ EnterCriticalSection (&mutex->lock); + { + DWORD self = GetCurrentThreadId (); + mutex->owner = self; + } return 0; } @@ -72,6 +80,21 @@ glwthread_mutex_trylock (glwthread_mutex_t *mutex) } if (!TryEnterCriticalSection (&mutex->lock)) return EBUSY; + { + DWORD self = GetCurrentThreadId (); + /* TryEnterCriticalSection succeeded. This means that the mutex was either + previously unlocked (and thus mutex->owner == 0) or previously locked by + this thread (and thus mutex->owner == self). Since the mutex is meant to + be plain, we need to fail in the latter case. */ + if (mutex->owner == self) + { + LeaveCriticalSection (&mutex->lock); + return EBUSY; + } + if (mutex->owner != 0) + abort (); + mutex->owner = self; + } return 0; } @@ -80,6 +103,7 @@ glwthread_mutex_unlock (glwthread_mutex_t *mutex) { if (!mutex->guard.done) return EINVAL; + mutex->owner = 0; LeaveCriticalSection (&mutex->lock); return 0; } 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 @@ /* Plain mutexes (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -28,6 +28,7 @@ typedef struct { glwthread_initguard_t guard; /* protects the initialization */ + DWORD owner; CRITICAL_SECTION lock; } 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 @@ /* Once-only control (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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)) { if (once_control->inited <= 0) { - if (InterlockedIncrement (&once_control->started) == 0) + InterlockedIncrement (&once_control->num_threads); + /* If once_control->started is == -1, set it to 0. */ + if (InterlockedCompareExchange (&once_control->started, 0, -1) < 0) { /* This thread is the first one to come to this once_control. */ InitializeCriticalSection (&once_control->lock); @@ -41,8 +43,6 @@ glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void)) } else { - /* Don't let once_control->started grow and wrap around. */ - InterlockedDecrement (&once_control->started); /* Some other thread has already started the initialization. Yield the CPU while waiting for the other thread to finish initializing and taking the lock. */ @@ -58,5 +58,48 @@ glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void)) abort (); } } + /* Here once_control->started == 0 and once_control->inited > 0. */ + if (InterlockedDecrement (&once_control->num_threads) == 0) + /* once_control->num_threads is now zero, and + once_control->started == 0 and once_control->inited > 0. + No other thread will need to use the lock. + We can therefore destroy the lock, to free resources. */ + /* If once_control->inited is == 1, set it to 2. */ + if (InterlockedCompareExchange (&once_control->inited, 2, 1) == 1) + DeleteCriticalSection (&once_control->lock); } + /* Proof of correctness: + * num_threads is incremented and then decremented by some threads. + Therefore, num_threads always stays >= 0, and is == 0 at the end. + * The first thread to go through the once_control->started fence + initializes the lock and moves inited from <= 0 to > 0. The other + threads don't move inited from <= 0 to > 0. + * started, once == 0, stays == 0. + * inited, once > 0, stays > 0 (since at the place where it is assigned 0, + it cannot be > 0). + * inited does not change any more once it is 2. + Therefore, it can be changed from 1 to 2 only once. + * DeleteCriticalSection gets invoked right after inited has been changed + from 1 to 2. Therefore, DeleteCriticalSection gets invoked only once. + * After a moment where num_threads was 0 and started was 0 and + inited was > 0, no thread can reach an InitializeCriticalSection or + EnterCriticalSection invocation. Proof: + - At such a moment, no thread is in the code range between + InterlockedIncrement (&once_control->num_threads) + and + InterlockedDecrement (&once_control->num_threads) + - After such a moment, some thread can increment num_threads, but from + there they cannot reach the InitializeCriticalSection invocation, + because the once_control->started test prevents that, and they cannot + reach the EnterCriticalSection invocation in the other branch because + the + if (once_control->inited <= 0) + test prevents that. + * From this it follows that: + - DeleteCriticalSection cannot be executed while the lock is taken + (because DeleteCriticalSection is only executed after a moment where + num_threads was 0 and started was 0 and inited was > 0). + - Once DeleteCriticalSection has been executed, the lock is not used any + more. + */ } 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 @@ /* Once-only control (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -25,13 +25,14 @@ typedef struct { - volatile int inited; + volatile LONG inited; + volatile LONG num_threads; volatile LONG started; CRITICAL_SECTION lock; } glwthread_once_t; -#define GLWTHREAD_ONCE_INIT { -1, -1 } +#define GLWTHREAD_ONCE_INIT { -1, 0, -1 } #ifdef __cplusplus extern "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 @@ /* Plain recursive mutexes (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Plain recursive mutexes (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Read-write locks (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Read-write locks (native Windows implementation). - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* Report a memory allocation failure and exit. - Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2024 Free Software + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -26,7 +26,7 @@ #include "exitfail.h" #include "gettext.h" -#define _(msgid) gettext (msgid) +#define _(msgid) dgettext ("gnulib", msgid) void xalloc_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 @@ /* xalloc-oversized.h -- memory allocation size checking - Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -47,7 +47,8 @@ #if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX # define xalloc_oversized(n, s) \ __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) -#elif 5 <= __GNUC__ && !defined __ICC && PTRDIFF_MAX < SIZE_MAX +#elif 5 <= __GNUC__ && !defined __clang__ && !defined __ICC \ + && PTRDIFF_MAX < SIZE_MAX # define xalloc_oversized(n, s) \ (__builtin_constant_p (n) && __builtin_constant_p (s) \ ? __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 @@ /* xalloc.h -- malloc with out-of-memory checking - Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify 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 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-2000, 2002-2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,7 +64,7 @@ void * xrealloc (void *p, size_t s) { void *r = realloc (p, s); - if (!r && (!p || s)) + if (!r) xalloc_die (); return r; } @@ -82,7 +82,7 @@ void * xreallocarray (void *p, size_t n, size_t s) { void *r = reallocarray (p, n, s); - if (!r && (!p || (n && s))) + if (!r) xalloc_die (); return r; } 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 @@ /* Checked size_t computations. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify 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 @@ /* xsize.h -- Checked size_t computations. - Copyright (C) 2003, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2003, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -26,7 +26,7 @@ /* Get size_t. */ #include -/* Get SIZE_MAX. */ +/* Get INT_MAX, SIZE_MAX. */ #include #if HAVE_STDINT_H # include @@ -61,7 +61,8 @@ extern "C" { void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); */ -/* Convert an arbitrary value >= 0 to type size_t. */ +/* Convert an arbitrary N >= 0 to type size_t. + N should not have side effects. */ #define xcast_size_t(N) \ ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) @@ -69,8 +70,15 @@ extern "C" { XSIZE_INLINE size_t ATTRIBUTE_PURE xsum (size_t size1, size_t size2) { - size_t sum = size1 + size2; - return (sum >= size1 ? sum : SIZE_MAX); + if (INT_MAX < SIZE_MAX) + { + /* Optimize for the common case where size_t arithmetic wraps + around without undefined behavior. */ + size_t sum = size1 + size2; + return size1 <= sum ? sum : SIZE_MAX; + } + + return size1 <= SIZE_MAX - size2 ? size1 + size2 : SIZE_MAX; } /* Sum of three sizes, with overflow check. */ @@ -98,6 +106,8 @@ xmax (size_t size1, size_t size2) /* Multiplication of a count with an element size, with overflow check. The count must be >= 0 and the element size must be > 0. + Arguments should not have side effects. + The element size's type should be no wider than size_t. This is a macro, not a function, so that it works correctly even when N is of a wider type and N > SIZE_MAX. */ #define xtimes(N, ELSIZE) \ -- cgit v1.2.3-74-g34f1