aboutsummaryrefslogtreecommitdiff
path: root/gnulib/import
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@google.com>2020-08-26 15:37:28 -0700
committerJoel Brobecker <brobecker@adacore.com>2020-08-26 15:37:28 -0700
commit698be2d8e5dbd23eddb5aa464b50cdfab000e553 (patch)
tree009d82919309b6df0d282e875032d270a35e3db0 /gnulib/import
parent05fd99cc80b1955e8c846dacfa57fe52816d4869 (diff)
downloadgdb-698be2d8e5dbd23eddb5aa464b50cdfab000e553.zip
gdb-698be2d8e5dbd23eddb5aa464b50cdfab000e553.tar.gz
gdb-698be2d8e5dbd23eddb5aa464b50cdfab000e553.tar.bz2
Update gnulib to current trunk
This fixes two issues on Windows: Update. https://sourceware.org/pipermail/gdb-patches/2020-June/169978.html gnulib/ChangeLog: 2020-08-26 Christian Biesinger <cbiesinger@google.com> Pedro Alves <palves@redhat.com> Joel Brobecker <brobecker@adacore.com> * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.in: Regenerate. * configure: Regenerate. * import/Makefile.am: Update. * import/Makefile.in: Regenerate. * import/alloca.in.h (if): Update. * import/assure.h (affirm): Update. * import/at-func.c: Update. * import/attribute.h: New file. * import/btowc.c: New file. * import/canonicalize-lgpl.c: Update. * import/count-one-bits.h (COUNT_ONE_BITS_GENERIC): Update. (COUNT_ONE_BITS): Update. (intrinsic): Update. (__popcnt64): Update. (popcount_supported): Update. * import/ctype.in.h: New file. * import/dirent-private.h (WIN32_FIND_DATA): Update. * import/dirent.in.h (_GL_ATTRIBUTE_PURE): Update. * import/dirname.h: Update. * import/dosname.h: Remove. * import/error.h (_GL_ATTRIBUTE_FORMAT): Update. * import/extra/update-copyright: Update. * import/fchdir.c: Update. * import/fcntl.in.h (GNULIB_defined_rpl_fcntl): Update. (GNULIB_defined_fcntl): Update. * import/filename.h (HAS_DEVICE): Update. (IS_ABSOLUTE_PATH): Update. (IS_PATH_WITH_DIR): Update. (FILE_SYSTEM_PREFIX_LEN): Update. (_IS_DRIVE_LETTER): Update. (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE): Update. (IS_ABSOLUTE_FILE_NAME): Update. (IS_RELATIVE_FILE_NAME): Update. (IS_FILE_NAME_WITH_DIR): Update. * import/filenamecat-lgpl.c (mfile_name_concat): Update. * import/fnmatch.c (WIDE_CHAR_SUPPORT): Update. (btowc): Update. (iswctype): Update. (mempcpy): Update. (strnlen): Update. (towlower): Update. (wcscat): Update. (wcslen): Update. (wctype): Update. (wmemchr): Update. (wmempcpy): Update. (SIZE_MAX): Update. (isblank): Update. (__libc_use_alloca): Update. (alloca): Update. (alloca_account): Update. (STREQ): Update. (CHAR_CLASS_MAX_LENGTH): Update. (IS_CHAR_CLASS): Update. (ISWCTYPE): Update. (if): Update. (HANDLE_MULTIBYTE): Update. (internal_function): Update. (FOLD): Update. (CHAR): Update. (UCHAR): Update. (INT): Update. (FCT): Update. (EXT): Update. (END): Update. (L_): Update. (BTOWC): Update. (STRLEN): Update. (STRCAT): Update. (MEMPCPY): Update. (MEMCHR): Update. (WIDE_CHAR_VERSION): Update. (STRUCT): Update. (FINDIDX): Update. (findidx): Update. (ALLOCA_LIMIT): Update. (SHLIB_COMPAT): Update. * import/fnmatch_loop.c (struct STRUCT): Update. (FCT): Update. (EXT): Update. (END): Update. (str): Update. (NEW_PATTERN): Update. * import/getcwd.c: Update. * import/getlogin_r.c (GetUserName): Update. * import/getprogname.c (getprogname): Update. * import/getrandom.c: New file. * import/gettimeofday.c: Remove. * import/glob.in.h (_Restrict_): Update. * import/inttypes.in.h (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. * import/isblank.c: New file. * import/isnanl-nolibm.h (__has_builtin): Update. * import/libc-config.h (versioned_symbol): Update. (compat_symbol): Update. * import/limits.in.h (_GL_ALREADY_INCLUDING_LIMITS_H): Update. * import/m4/btowc.m4: New file. * import/m4/ctype.m4: New file. * import/m4/exponentl.m4: Update. * import/m4/fnmatch.m4: Update. * import/m4/getrandom.m4: New file. * import/m4/glob.m4: Update. * import/m4/gnulib-cache.m4: Update. * import/m4/gnulib-common.m4: Update. * import/m4/gnulib-comp.m4: Update. * import/m4/inttypes.m4: Update. * import/m4/isblank.m4: New file. * import/m4/isnanl.m4: Update. * import/m4/largefile.m4: Update. * import/m4/mbtowc.m4: New file. * import/m4/memmem.m4: Update. * import/m4/minmax.m4: New file. * import/m4/signal_h.m4: Update. * import/m4/stdio_h.m4: Update. * import/m4/stdlib_h.m4: Update. * import/m4/string_h.m4: Update. * import/m4/strnlen.m4: New file. * import/m4/sys_random_h.m4: New file. * import/m4/sys_socket_h.m4: Update. * import/m4/sys_stat_h.m4: Update. * import/m4/time_h.m4: Update. * import/m4/unistd_h.m4: Update. * import/m4/wchar_h.m4: Update. * import/m4/wint_t.m4: Update. * import/m4/wmemchr.m4: New file. * import/m4/wmempcpy.m4: New file. * import/math.in.h (__has_builtin): Update. * import/mbrtowc.c (FALLTHROUGH): Update. * import/mbtowc-impl.h: New file. * import/mbtowc.c: New file. * import/minmax.h: New file. * import/open.c (open): Update. * import/openat-proc.c (openat_proc_name): Update. * import/openat.c (rpl_openat): Update. (openat_needs_fchdir): Update. * import/openat.h (FCHOWNAT_INLINE): Update. (CHOWNAT_INLINE): Update. (FCHMODAT_INLINE): Update. (CHMODAT_INLINE): Update. * import/opendir.c (WIN32_FIND_DATA): Update. (GetFullPathName): Update. (FindFirstFile): Update. * import/readdir.c (FindNextFile): Update. * import/rename.c (MoveFileEx): Update. * import/rewinddir.c (FindFirstFile): Update. * import/rmdir.c: Update. * import/signal.in.h (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. * import/stat-w32.c (_WIN32_WINNT): Update. (LoadLibrary): Update. (GetFinalPathNameByHandle): Update. (GetProcAddress): Update. (DWORD): Update. (GetFileInformationByHandleExFunc): Update. (GetFinalPathNameByHandleFunc): Update. * import/stat.c (WIN32_FIND_DATA): Update. (CreateFile): Update. (FindFirstFile): Update. * import/stdio.in.h (_GL_ATTRIBUTE_FORMAT): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. (_GL_FUNCDECL_RPL_1): Update. (_GL_CXXALIAS_RPL_1): Update. (_GL_CXXALIAS_SYS_CAST): Update. * import/stdlib.in.h (_GL_ATTRIBUTE_PURE): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. * import/string.in.h (_GL_ATTRIBUTE_PURE): Update. (_GL_WARN_ON_USE): Update. (_GL_WARN_ON_USE_CXX): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_CXXALIAS_SYS): Update. (mbstok_r): Update. * import/strnlen.c: New file. * import/sys_random.in.h: New file. * import/sys_socket.in.h (GNULIB_defined_socklen_t): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_CXXALIAS_SYS_CAST): Update. * import/sys_stat.in.h (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. (lchmod): Update. (_GL_CXXALIAS_RPL_1): Update. (stat): Update. * import/tempname.c (__set_errno): Update. (__secure_getenv): Update. (__try_tempname): Update. (__getpid): Update. (__gettimeofday): Update. (RANDOM_BITS): Update. (uint64_t): Update. (RANDOM_VALUE_MAX): Update. (BASE_62_DIGITS): Update. (BASE_62_POWER): Update. (try_tempname_len): Update. (try_file): Update. (try_dir): Update. (try_nocreate): Update. (gen_tempname_len): Update. (__gen_tempname): Update. (try_tempname): Update. * import/tempname.h (gen_tempname_len): Update. (try_tempname_len): Update. * import/time.in.h (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_CXXALIAS_SYS): Update. * import/unistd.in.h (if): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. (_GL_CXXALIASWARN): Update. (_GL_WARN_ON_USE): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. * import/verify.h: Update. * import/warn-on-use.h (_GL_WARN_ON_USE_CXX): Update. * import/wchar.in.h (_GL_ATTRIBUTE_PURE): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. (_GL_CXXALIASWARN): Update. (_GL_WARN_ON_USE): Update. (_GL_CXXALIAS_SYS_CAST2): Update. (_GL_CXXALIASWARN1): Update. * import/windows-rwlock.c (CreateEvent): Update. * import/wmemchr-impl.h: New file. * import/wmemchr.c: New file. * import/wmempcpy.c: New file. * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add gettimeofday. (GNULIB_COMMIT_SHA1): Update gnulib revision.
Diffstat (limited to 'gnulib/import')
-rw-r--r--gnulib/import/Makefile.am149
-rw-r--r--gnulib/import/Makefile.in186
-rw-r--r--gnulib/import/alloca.in.h15
-rw-r--r--gnulib/import/assure.h24
-rw-r--r--gnulib/import/at-func.c2
-rw-r--r--gnulib/import/attribute.h215
-rw-r--r--gnulib/import/btowc.c39
-rw-r--r--gnulib/import/canonicalize-lgpl.c2
-rw-r--r--gnulib/import/count-one-bits.h85
-rw-r--r--gnulib/import/ctype.in.h57
-rw-r--r--gnulib/import/dirent-private.h4
-rw-r--r--gnulib/import/dirent.in.h10
-rw-r--r--gnulib/import/dirname.h2
-rw-r--r--gnulib/import/dosname.h52
-rw-r--r--gnulib/import/error.h12
-rwxr-xr-xgnulib/import/extra/update-copyright4
-rw-r--r--gnulib/import/fchdir.c9
-rw-r--r--gnulib/import/fcntl.in.h6
-rw-r--r--gnulib/import/filename.h88
-rw-r--r--gnulib/import/filenamecat-lgpl.c22
-rw-r--r--gnulib/import/fnmatch.c429
-rw-r--r--gnulib/import/fnmatch_loop.c573
-rw-r--r--gnulib/import/getcwd.c8
-rw-r--r--gnulib/import/getlogin_r.c3
-rw-r--r--gnulib/import/getprogname.c2
-rw-r--r--gnulib/import/getrandom.c187
-rw-r--r--gnulib/import/gettimeofday.c18
-rw-r--r--gnulib/import/glob.in.h9
-rw-r--r--gnulib/import/inttypes.in.h24
-rw-r--r--gnulib/import/isblank.c33
-rw-r--r--gnulib/import/isnanl-nolibm.h5
-rw-r--r--gnulib/import/libc-config.h3
-rw-r--r--gnulib/import/limits.in.h23
-rw-r--r--gnulib/import/m4/btowc.m4120
-rw-r--r--gnulib/import/m4/ctype.m432
-rw-r--r--gnulib/import/m4/exponentl.m414
-rw-r--r--gnulib/import/m4/fnmatch.m46
-rw-r--r--gnulib/import/m4/getrandom.m465
-rw-r--r--gnulib/import/m4/glob.m43
-rw-r--r--gnulib/import/m4/gnulib-cache.m42
-rw-r--r--gnulib/import/m4/gnulib-common.m4229
-rw-r--r--gnulib/import/m4/gnulib-comp.m481
-rw-r--r--gnulib/import/m4/inttypes.m44
-rw-r--r--gnulib/import/m4/isblank.m417
-rw-r--r--gnulib/import/m4/isnanl.m417
-rw-r--r--gnulib/import/m4/largefile.m43
-rw-r--r--gnulib/import/m4/mbtowc.m424
-rw-r--r--gnulib/import/m4/memmem.m44
-rw-r--r--gnulib/import/m4/minmax.m444
-rw-r--r--gnulib/import/m4/signal_h.m44
-rw-r--r--gnulib/import/m4/stdio_h.m44
-rw-r--r--gnulib/import/m4/stdlib_h.m44
-rw-r--r--gnulib/import/m4/string_h.m45
-rw-r--r--gnulib/import/m4/strnlen.m430
-rw-r--r--gnulib/import/m4/sys_random_h.m452
-rw-r--r--gnulib/import/m4/sys_socket_h.m44
-rw-r--r--gnulib/import/m4/sys_stat_h.m47
-rw-r--r--gnulib/import/m4/time_h.m46
-rw-r--r--gnulib/import/m4/unistd_h.m49
-rw-r--r--gnulib/import/m4/wchar_h.m49
-rw-r--r--gnulib/import/m4/wint_t.m412
-rw-r--r--gnulib/import/m4/wmemchr.m432
-rw-r--r--gnulib/import/m4/wmempcpy.m421
-rw-r--r--gnulib/import/math.in.h16
-rw-r--r--gnulib/import/mbrtowc.c9
-rw-r--r--gnulib/import/mbtowc-impl.h44
-rw-r--r--gnulib/import/mbtowc.c26
-rw-r--r--gnulib/import/minmax.h60
-rw-r--r--gnulib/import/open.c6
-rw-r--r--gnulib/import/openat-proc.c5
-rw-r--r--gnulib/import/openat.c10
-rw-r--r--gnulib/import/openat.h20
-rw-r--r--gnulib/import/opendir.c10
-rw-r--r--gnulib/import/readdir.c4
-rw-r--r--gnulib/import/rename.c4
-rw-r--r--gnulib/import/rewinddir.c4
-rw-r--r--gnulib/import/rmdir.c2
-rw-r--r--gnulib/import/signal.in.h24
-rw-r--r--gnulib/import/stat-w32.c37
-rw-r--r--gnulib/import/stat.c7
-rw-r--r--gnulib/import/stdio.in.h280
-rw-r--r--gnulib/import/stdlib.in.h82
-rw-r--r--gnulib/import/string.in.h50
-rw-r--r--gnulib/import/strnlen.c30
-rw-r--r--gnulib/import/sys_random.in.h92
-rw-r--r--gnulib/import/sys_socket.in.h75
-rw-r--r--gnulib/import/sys_stat.in.h44
-rw-r--r--gnulib/import/tempname.c280
-rw-r--r--gnulib/import/tempname.h7
-rw-r--r--gnulib/import/time.in.h17
-rw-r--r--gnulib/import/unistd.in.h51
-rw-r--r--gnulib/import/verify.h20
-rw-r--r--gnulib/import/warn-on-use.h21
-rw-r--r--gnulib/import/wchar.in.h252
-rw-r--r--gnulib/import/windows-rwlock.c4
-rw-r--r--gnulib/import/wmemchr-impl.h27
-rw-r--r--gnulib/import/wmemchr.c23
-rw-r--r--gnulib/import/wmempcpy.c28
98 files changed, 3520 insertions, 1315 deletions
diff --git a/gnulib/import/Makefile.am b/gnulib/import/Makefile.am
index e0a1e0f..84de424 100644
--- a/gnulib/import/Makefile.am
+++ b/gnulib/import/Makefile.am
@@ -42,6 +42,7 @@
# fnmatch-gnu \
# frexpl \
# getcwd \
+# gettimeofday \
# glob \
# inet_ntop \
# inttypes \
@@ -190,6 +191,22 @@ libgnu_a_SOURCES += openat-priv.h openat-proc.c
## end gnulib module at-internal
+## begin gnulib module attribute
+
+
+EXTRA_DIST += attribute.h
+
+## end gnulib module attribute
+
+## begin gnulib module btowc
+
+
+EXTRA_DIST += btowc.c
+
+EXTRA_libgnu_a_SOURCES += btowc.c
+
+## end gnulib module btowc
+
## begin gnulib module canonicalize-lgpl
@@ -242,6 +259,33 @@ EXTRA_DIST += count-one-bits.h
## end gnulib module count-one-bits
+## begin gnulib module ctype
+
+BUILT_SOURCES += ctype.h
+
+# We need the following in order to create <ctype.h> when the system
+# doesn't have one that works with the given compiler.
+ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -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_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \
+ -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
+ -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+ < $(srcdir)/ctype.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += ctype.h ctype.h-t
+
+EXTRA_DIST += ctype.in.h
+
+## end gnulib module ctype
+
## begin gnulib module dirent
BUILT_SOURCES += dirent.h
@@ -307,13 +351,6 @@ EXTRA_DIST += dirname.h
## end gnulib module dirname-lgpl
-## begin gnulib module dosname
-
-
-EXTRA_DIST += dosname.h
-
-## end gnulib module dosname
-
## begin gnulib module dup
@@ -642,6 +679,15 @@ libgnu_a_SOURCES += getprogname.h getprogname.c
## end gnulib module getprogname
+## begin gnulib module getrandom
+
+
+EXTRA_DIST += getrandom.c
+
+EXTRA_libgnu_a_SOURCES += getrandom.c
+
+## end gnulib module getrandom
+
## begin gnulib module gettext-h
libgnu_a_SOURCES += gettext.h
@@ -770,6 +816,15 @@ EXTRA_DIST += inttypes.in.h
## end gnulib module inttypes-incomplete
+## begin gnulib module isblank
+
+
+EXTRA_DIST += isblank.c
+
+EXTRA_libgnu_a_SOURCES += isblank.c
+
+## end gnulib module isblank
+
## begin gnulib module isnand-nolibm
@@ -1240,6 +1295,15 @@ EXTRA_libgnu_a_SOURCES += mbsrtowcs-state.c mbsrtowcs.c
## end gnulib module mbsrtowcs
+## begin gnulib module mbtowc
+
+
+EXTRA_DIST += mbtowc-impl.h mbtowc.c
+
+EXTRA_libgnu_a_SOURCES += mbtowc.c
+
+## end gnulib module mbtowc
+
## begin gnulib module memchr
@@ -1276,6 +1340,12 @@ EXTRA_libgnu_a_SOURCES += memrchr.c
## end gnulib module memrchr
+## begin gnulib module minmax
+
+libgnu_a_SOURCES += minmax.h
+
+## end gnulib module minmax
+
## begin gnulib module mkdir
@@ -2139,6 +2209,15 @@ EXTRA_DIST += string.in.h
## end gnulib module string
+## begin gnulib module strnlen
+
+
+EXTRA_DIST += strnlen.c
+
+EXTRA_libgnu_a_SOURCES += strnlen.c
+
+## end gnulib module strnlen
+
## begin gnulib module strnlen1
libgnu_a_SOURCES += strnlen1.h strnlen1.c
@@ -2163,6 +2242,38 @@ EXTRA_libgnu_a_SOURCES += strtok_r.c
## end gnulib module strtok_r
+## begin gnulib module sys_random
+
+BUILT_SOURCES += sys/random.h
+
+# We need the following in order to create <sys/random.h> when the system
+# doesn't have one.
+sys/random.h: sys_random.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+ $(AM_V_at)$(MKDIR_P) sys
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -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_SYS_RANDOM_H''@|$(NEXT_SYS_RANDOM_H)|g' \
+ -e 's|@''HAVE_SYS_RANDOM_H''@|$(HAVE_SYS_RANDOM_H)|g' \
+ -e 's/@''GNULIB_GETRANDOM''@/$(GNULIB_GETRANDOM)/g' \
+ -e 's/@''HAVE_GETRANDOM''@/$(HAVE_GETRANDOM)/g' \
+ -e 's/@''REPLACE_GETRANDOM''@/$(REPLACE_GETRANDOM)/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)/sys_random.in.h; \
+ } > $@-t && \
+ mv -f $@-t $@
+MOSTLYCLEANFILES += sys/random.h sys/random.h-t
+MOSTLYCLEANDIRS += sys
+
+EXTRA_DIST += sys_random.in.h
+
+## end gnulib module sys_random
+
## begin gnulib module sys_socket
BUILT_SOURCES += sys/socket.h
@@ -2261,7 +2372,6 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
-e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
-e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
- -e 's|@''REPLACE_LCHMOD''@|$(REPLACE_LCHMOD)|g' \
-e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
-e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
-e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
@@ -2481,6 +2591,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
-e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \
-e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \
+ -e 's/@''GNULIB_GETENTROPY''@/$(GNULIB_GETENTROPY)/g' \
-e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \
-e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \
-e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \
@@ -2529,6 +2640,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
-e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
-e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
+ -e 's|@''HAVE_GETENTROPY''@|$(HAVE_GETENTROPY)|g' \
-e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
-e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
-e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
@@ -2598,6 +2710,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
-e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
-e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
+ -e 's|@''UNISTD_H_HAVE_SYS_RANDOM_H''@|$(UNISTD_H_HAVE_SYS_RANDOM_H)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -2675,6 +2788,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \
-e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \
-e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \
+ -e 's/@''GNULIB_WMEMPCPY''@/$(GNULIB_WMEMPCPY)/g' \
-e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \
-e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \
-e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \
@@ -2715,6 +2829,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
-e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
-e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
+ -e 's|@''HAVE_WMEMPCPY''@|$(HAVE_WMEMPCPY)|g' \
-e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
-e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
-e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
@@ -2851,6 +2966,24 @@ EXTRA_libgnu_a_SOURCES += windows-rwlock.c
## end gnulib module windows-rwlock
+## begin gnulib module wmemchr
+
+
+EXTRA_DIST += wmemchr-impl.h wmemchr.c
+
+EXTRA_libgnu_a_SOURCES += wmemchr.c
+
+## end gnulib module wmemchr
+
+## begin gnulib module wmempcpy
+
+
+EXTRA_DIST += wmempcpy.c
+
+EXTRA_libgnu_a_SOURCES += wmempcpy.c
+
+## end gnulib module wmempcpy
+
## begin gnulib module xalloc-oversized
diff --git a/gnulib/import/Makefile.in b/gnulib/import/Makefile.in
index 9316e8d..476cde8 100644
--- a/gnulib/import/Makefile.in
+++ b/gnulib/import/Makefile.in
@@ -56,6 +56,7 @@
# fnmatch-gnu \
# frexpl \
# getcwd \
+# gettimeofday \
# glob \
# inet_ntop \
# inttypes \
@@ -173,12 +174,14 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/import/m4/absolute-header.m4 \
$(top_srcdir)/import/m4/alloca.m4 \
$(top_srcdir)/import/m4/arpa_inet_h.m4 \
+ $(top_srcdir)/import/m4/btowc.m4 \
$(top_srcdir)/import/m4/builtin-expect.m4 \
$(top_srcdir)/import/m4/canonicalize.m4 \
$(top_srcdir)/import/m4/chdir-long.m4 \
$(top_srcdir)/import/m4/close.m4 \
$(top_srcdir)/import/m4/closedir.m4 \
$(top_srcdir)/import/m4/codeset.m4 \
+ $(top_srcdir)/import/m4/ctype.m4 \
$(top_srcdir)/import/m4/d-ino.m4 \
$(top_srcdir)/import/m4/d-type.m4 \
$(top_srcdir)/import/m4/dirent_h.m4 \
@@ -217,6 +220,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/import/m4/getlogin_r.m4 \
$(top_srcdir)/import/m4/getpagesize.m4 \
$(top_srcdir)/import/m4/getprogname.m4 \
+ $(top_srcdir)/import/m4/getrandom.m4 \
$(top_srcdir)/import/m4/gettimeofday.m4 \
$(top_srcdir)/import/m4/glob.m4 \
$(top_srcdir)/import/m4/glob_h.m4 \
@@ -226,6 +230,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/import/m4/inet_ntop.m4 \
$(top_srcdir)/import/m4/inttypes-pri.m4 \
$(top_srcdir)/import/m4/inttypes.m4 \
+ $(top_srcdir)/import/m4/isblank.m4 \
$(top_srcdir)/import/m4/isnand.m4 \
$(top_srcdir)/import/m4/isnanl.m4 \
$(top_srcdir)/import/m4/largefile.m4 \
@@ -245,10 +250,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/import/m4/mbsinit.m4 \
$(top_srcdir)/import/m4/mbsrtowcs.m4 \
$(top_srcdir)/import/m4/mbstate_t.m4 \
+ $(top_srcdir)/import/m4/mbtowc.m4 \
$(top_srcdir)/import/m4/memchr.m4 \
$(top_srcdir)/import/m4/memmem.m4 \
$(top_srcdir)/import/m4/mempcpy.m4 \
$(top_srcdir)/import/m4/memrchr.m4 \
+ $(top_srcdir)/import/m4/minmax.m4 \
$(top_srcdir)/import/m4/mkdir.m4 \
$(top_srcdir)/import/m4/mkdtemp.m4 \
$(top_srcdir)/import/m4/mkostemp.m4 \
@@ -295,8 +302,10 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/import/m4/strerror.m4 \
$(top_srcdir)/import/m4/strerror_r.m4 \
$(top_srcdir)/import/m4/string_h.m4 \
+ $(top_srcdir)/import/m4/strnlen.m4 \
$(top_srcdir)/import/m4/strstr.m4 \
$(top_srcdir)/import/m4/strtok_r.m4 \
+ $(top_srcdir)/import/m4/sys_random_h.m4 \
$(top_srcdir)/import/m4/sys_socket_h.m4 \
$(top_srcdir)/import/m4/sys_stat_h.m4 \
$(top_srcdir)/import/m4/sys_time_h.m4 \
@@ -314,6 +323,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/import/m4/wchar_t.m4 \
$(top_srcdir)/import/m4/wctype_h.m4 \
$(top_srcdir)/import/m4/wint_t.m4 \
+ $(top_srcdir)/import/m4/wmemchr.m4 \
+ $(top_srcdir)/import/m4/wmempcpy.m4 \
$(top_srcdir)/import/m4/zzgnulib.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -568,6 +579,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
GNULIB_GETDELIM = @GNULIB_GETDELIM@
GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@
GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@
+GNULIB_GETENTROPY = @GNULIB_GETENTROPY@
GNULIB_GETGROUPS = @GNULIB_GETGROUPS@
GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@
GNULIB_GETLINE = @GNULIB_GETLINE@
@@ -578,6 +590,7 @@ GNULIB_GETOPT_POSIX = @GNULIB_GETOPT_POSIX@
GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
GNULIB_GETPASS = @GNULIB_GETPASS@
GNULIB_GETPEERNAME = @GNULIB_GETPEERNAME@
+GNULIB_GETRANDOM = @GNULIB_GETRANDOM@
GNULIB_GETSOCKNAME = @GNULIB_GETSOCKNAME@
GNULIB_GETSOCKOPT = @GNULIB_GETSOCKOPT@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
@@ -597,6 +610,7 @@ GNULIB_IMAXDIV = @GNULIB_IMAXDIV@
GNULIB_INET_NTOP = @GNULIB_INET_NTOP@
GNULIB_INET_PTON = @GNULIB_INET_PTON@
GNULIB_ISATTY = @GNULIB_ISATTY@
+GNULIB_ISBLANK = @GNULIB_ISBLANK@
GNULIB_ISFINITE = @GNULIB_ISFINITE@
GNULIB_ISINF = @GNULIB_ISINF@
GNULIB_ISNAN = @GNULIB_ISNAN@
@@ -851,6 +865,7 @@ GNULIB_WMEMCHR = @GNULIB_WMEMCHR@
GNULIB_WMEMCMP = @GNULIB_WMEMCMP@
GNULIB_WMEMCPY = @GNULIB_WMEMCPY@
GNULIB_WMEMMOVE = @GNULIB_WMEMMOVE@
+GNULIB_WMEMPCPY = @GNULIB_WMEMPCPY@
GNULIB_WMEMSET = @GNULIB_WMEMSET@
GNULIB_WRITE = @GNULIB_WRITE@
GNULIB__EXIT = @GNULIB__EXIT@
@@ -1000,11 +1015,13 @@ HAVE_FTELLO = @HAVE_FTELLO@
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
HAVE_FUTIMENS = @HAVE_FUTIMENS@
HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@
+HAVE_GETENTROPY = @HAVE_GETENTROPY@
HAVE_GETGROUPS = @HAVE_GETGROUPS@
HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@
HAVE_GETLOGIN = @HAVE_GETLOGIN@
HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
HAVE_GETPASS = @HAVE_GETPASS@
+HAVE_GETRANDOM = @HAVE_GETRANDOM@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
HAVE_GLOB = @HAVE_GLOB@
@@ -1020,6 +1037,7 @@ HAVE_ILOGBL = @HAVE_ILOGBL@
HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
HAVE_INITSTATE = @HAVE_INITSTATE@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
+HAVE_ISBLANK = @HAVE_ISBLANK@
HAVE_ISNAND = @HAVE_ISNAND@
HAVE_ISNANF = @HAVE_ISNANF@
HAVE_ISNANL = @HAVE_ISNANL@
@@ -1143,6 +1161,7 @@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
+HAVE_SYS_RANDOM_H = @HAVE_SYS_RANDOM_H@
HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
@@ -1200,6 +1219,7 @@ HAVE_WMEMCHR = @HAVE_WMEMCHR@
HAVE_WMEMCMP = @HAVE_WMEMCMP@
HAVE_WMEMCPY = @HAVE_WMEMCPY@
HAVE_WMEMMOVE = @HAVE_WMEMMOVE@
+HAVE_WMEMPCPY = @HAVE_WMEMPCPY@
HAVE_WMEMSET = @HAVE_WMEMSET@
HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
HAVE_XLOCALE_H = @HAVE_XLOCALE_H@
@@ -1228,6 +1248,7 @@ LIBS = @LIBS@
LIBSTDTHREAD = @LIBSTDTHREAD@
LIBTHREAD = @LIBTHREAD@
LIB_GETLOGIN = @LIB_GETLOGIN@
+LIB_GETRANDOM = @LIB_GETRANDOM@
LIB_HARD_LOCALE = @LIB_HARD_LOCALE@
LIB_MBRTOWC = @LIB_MBRTOWC@
LIB_SCHED_YIELD = @LIB_SCHED_YIELD@
@@ -1249,6 +1270,7 @@ MKDIR_P = @MKDIR_P@
NETINET_IN_H = @NETINET_IN_H@
NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@
NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@
+NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@
NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@
NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@
NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@
@@ -1266,6 +1288,7 @@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@
@@ -1275,6 +1298,7 @@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@
NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@
+NEXT_CTYPE_H = @NEXT_CTYPE_H@
NEXT_DIRENT_H = @NEXT_DIRENT_H@
NEXT_ERRNO_H = @NEXT_ERRNO_H@
NEXT_FCNTL_H = @NEXT_FCNTL_H@
@@ -1292,6 +1316,7 @@ NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_STRING_H = @NEXT_STRING_H@
+NEXT_SYS_RANDOM_H = @NEXT_SYS_RANDOM_H@
NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
@@ -1393,6 +1418,7 @@ REPLACE_GETLINE = @REPLACE_GETLINE@
REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_GETPASS = @REPLACE_GETPASS@
+REPLACE_GETRANDOM = @REPLACE_GETRANDOM@
REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
REPLACE_GLOB = @REPLACE_GLOB@
REPLACE_GLOB_PATTERN_P = @REPLACE_GLOB_PATTERN_P@
@@ -1416,7 +1442,6 @@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@
REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@
REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@
REPLACE_ITOLD = @REPLACE_ITOLD@
-REPLACE_LCHMOD = @REPLACE_LCHMOD@
REPLACE_LCHOWN = @REPLACE_LCHOWN@
REPLACE_LDEXPL = @REPLACE_LDEXPL@
REPLACE_LINK = @REPLACE_LINK@
@@ -1579,6 +1604,7 @@ UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@
UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@
UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
+UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@
UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
VERSION = @VERSION@
@@ -1654,17 +1680,18 @@ noinst_LIBRARIES = libgnu.a
noinst_LTLIBRARIES =
# No GNU Make output.
EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \
- assure.h canonicalize-lgpl.c chdir-long.c chdir-long.h \
- cloexec.h close.c closedir.c dirent-private.h count-one-bits.h \
- dirent.in.h dirfd.c dirname.h dosname.h dup.c dup2.c \
- errno.in.h error.c error.h exitfail.h fchdir.c fcntl.c \
- fcntl.in.h fd-hook.h fdopendir.c filename.h filenamecat.h \
- flexmember.h float.c float.in.h itold.c fnmatch.c \
- fnmatch_loop.c fnmatch.in.h fpucw.h frexp.c frexp.c frexpl.c \
- fstat.c stat-w32.c stat-w32.h at-func.c fstatat.c getcwd.c \
- getcwd-lgpl.c getdtablesize.c getlogin_r.c gettimeofday.c \
- glob.c glob_internal.h glob_pattern_p.c globfree.c glob-libc.h \
- glob.in.h hard-locale.h inet_ntop.c intprops.h inttypes.in.h \
+ assure.h attribute.h btowc.c canonicalize-lgpl.c chdir-long.c \
+ chdir-long.h cloexec.h close.c closedir.c dirent-private.h \
+ count-one-bits.h ctype.in.h dirent.in.h dirfd.c dirname.h \
+ dup.c dup2.c errno.in.h error.c error.h exitfail.h fchdir.c \
+ fcntl.c fcntl.in.h fd-hook.h fdopendir.c filename.h \
+ filenamecat.h flexmember.h float.c float.in.h itold.c \
+ fnmatch.c fnmatch_loop.c fnmatch.in.h fpucw.h frexp.c frexp.c \
+ frexpl.c fstat.c stat-w32.c stat-w32.h at-func.c fstatat.c \
+ getcwd.c getcwd-lgpl.c getdtablesize.c getlogin_r.c \
+ getrandom.c gettimeofday.c glob.c glob_internal.h \
+ glob_pattern_p.c globfree.c glob-libc.h glob.in.h \
+ hard-locale.h inet_ntop.c intprops.h inttypes.in.h isblank.c \
float+.h isnan.c isnand-nolibm.h isnand.c float+.h isnan.c \
isnanl-nolibm.h isnanl.c cdefs.h libc-config.h limits.in.h \
localcharset.h locale.in.h localtime-buffer.c \
@@ -1672,11 +1699,11 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \
lc-charset-dispatch.c lc-charset-dispatch.h \
mbrtowc-impl-utf8.h mbrtowc-impl.h mbrtowc.c mbtowc-lock.c \
mbtowc-lock.h windows-initguard.h mbsinit.c mbsrtowcs-impl.h \
- mbsrtowcs-state.c mbsrtowcs.c memchr.c memchr.valgrind \
- memmem.c str-two-way.h mempcpy.c memrchr.c mkdir.c mkdtemp.c \
- mkostemp.c msvc-inval.c msvc-inval.h msvc-nothrow.c \
- msvc-nothrow.h netinet_in.in.h open.c openat.c openat.h \
- dirent-private.h opendir.c pathmax.h rawmemchr.c \
+ mbsrtowcs-state.c mbsrtowcs.c mbtowc-impl.h mbtowc.c memchr.c \
+ memchr.valgrind memmem.c str-two-way.h mempcpy.c memrchr.c \
+ mkdir.c mkdtemp.c mkostemp.c msvc-inval.c msvc-inval.h \
+ msvc-nothrow.c msvc-nothrow.h netinet_in.in.h open.c openat.c \
+ openat.h dirent-private.h opendir.c pathmax.h rawmemchr.c \
rawmemchr.valgrind dirent-private.h readdir.c readlink.c \
realloc.c rename.c dirent-private.h rewinddir.c rmdir.c \
same-inode.h save-cwd.h malloc/scratch_buffer.h \
@@ -1686,36 +1713,37 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \
stat-time.h stdalign.in.h stdbool.in.h stddef.in.h stdint.in.h \
stdio.in.h stdlib.in.h strchrnul.c strchrnul.valgrind strdup.c \
streq.h strerror.c strerror-override.c strerror-override.h \
- strerror_r.c string.in.h str-two-way.h strstr.c strtok_r.c \
- sys_socket.in.h sys_stat.in.h sys_time.in.h sys_types.in.h \
- sys_uio.in.h tempname.h time.in.h time_r.c unistd.in.h \
- unistd--.h unistd-safer.h unsetenv.c \
+ strerror_r.c string.in.h strnlen.c str-two-way.h strstr.c \
+ strtok_r.c sys_random.in.h sys_socket.in.h sys_stat.in.h \
+ sys_time.in.h sys_types.in.h sys_uio.in.h tempname.h time.in.h \
+ time_r.c unistd.in.h unistd--.h unistd-safer.h unsetenv.c \
$(top_srcdir)/import/extra/update-copyright verify.h \
wchar.in.h wctype.in.h windows-initguard.h windows-mutex.c \
windows-mutex.h windows-once.c windows-once.h \
windows-initguard.h windows-recmutex.c windows-recmutex.h \
windows-initguard.h windows-rwlock.c windows-rwlock.h \
- xalloc-oversized.h
-BUILT_SOURCES = $(ALLOCA_H) arpa/inet.h dirent.h $(ERRNO_H) fcntl.h \
- $(FLOAT_H) $(FNMATCH_H) $(GLOB_H) inttypes.h $(LIMITS_H) \
- locale.h math.h $(NETINET_IN_H) signal.h $(STDALIGN_H) \
- $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h stdlib.h string.h \
- sys/socket.h sys/stat.h sys/time.h sys/types.h sys/uio.h \
- time.h unistd.h wchar.h wctype.h
+ wmemchr-impl.h wmemchr.c wmempcpy.c xalloc-oversized.h
+BUILT_SOURCES = $(ALLOCA_H) arpa/inet.h ctype.h dirent.h $(ERRNO_H) \
+ fcntl.h $(FLOAT_H) $(FNMATCH_H) $(GLOB_H) inttypes.h \
+ $(LIMITS_H) locale.h math.h $(NETINET_IN_H) signal.h \
+ $(STDALIGN_H) $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h \
+ stdlib.h string.h sys/random.h sys/socket.h sys/stat.h \
+ sys/time.h sys/types.h sys/uio.h time.h unistd.h wchar.h \
+ wctype.h
SUFFIXES =
MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \
- arpa/inet.h-t dirent.h dirent.h-t errno.h errno.h-t fcntl.h \
- fcntl.h-t float.h float.h-t fnmatch.h fnmatch.h-t glob.h \
- glob.h-t inttypes.h inttypes.h-t limits.h limits.h-t locale.h \
- locale.h-t math.h math.h-t netinet/in.h netinet/in.h-t \
- signal.h signal.h-t stdalign.h stdalign.h-t stdbool.h \
- stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdio.h \
- stdio.h-t stdlib.h stdlib.h-t string.h string.h-t sys/socket.h \
- sys/socket.h-t sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t \
- sys/types.h sys/types.h-t sys/uio.h sys/uio.h-t time.h \
- time.h-t unistd.h unistd.h-t wchar.h wchar.h-t wctype.h \
- wctype.h-t
-MOSTLYCLEANDIRS = arpa netinet sys sys sys
+ arpa/inet.h-t ctype.h ctype.h-t dirent.h dirent.h-t errno.h \
+ errno.h-t fcntl.h fcntl.h-t float.h float.h-t fnmatch.h \
+ fnmatch.h-t glob.h glob.h-t inttypes.h inttypes.h-t limits.h \
+ limits.h-t locale.h locale.h-t math.h math.h-t netinet/in.h \
+ netinet/in.h-t signal.h signal.h-t stdalign.h stdalign.h-t \
+ stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t \
+ stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t \
+ sys/random.h sys/random.h-t sys/socket.h sys/socket.h-t \
+ sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t sys/types.h \
+ sys/types.h-t sys/uio.h sys/uio.h-t time.h time.h-t unistd.h \
+ unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t
+MOSTLYCLEANDIRS = arpa netinet sys sys sys sys
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
@@ -1726,7 +1754,7 @@ libgnu_a_SOURCES = openat-priv.h openat-proc.c cloexec.c \
exitfail.c fd-hook.c fd-safer-flag.c dup-safer-flag.c \
filenamecat-lgpl.c getprogname.h getprogname.c gettext.h \
hard-locale.c localcharset.c glthread/lock.h glthread/lock.c \
- malloca.c math.c openat-die.c save-cwd.c \
+ malloca.c math.c minmax.h openat-die.c save-cwd.c \
malloc/scratch_buffer_grow.c \
malloc/scratch_buffer_grow_preserve.c \
malloc/scratch_buffer_set_array_size.c setlocale_null.c \
@@ -1735,22 +1763,23 @@ libgnu_a_SOURCES = openat-priv.h openat-proc.c cloexec.c \
pipe-safer.c wctype-h.c
libgnu_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@
-EXTRA_libgnu_a_SOURCES = alloca.c canonicalize-lgpl.c chdir-long.c \
- close.c closedir.c dirfd.c dup.c dup2.c error.c fchdir.c \
- fcntl.c fdopendir.c float.c itold.c fnmatch.c fnmatch_loop.c \
- frexp.c frexp.c frexpl.c fstat.c stat-w32.c at-func.c \
- fstatat.c getcwd.c getcwd-lgpl.c getdtablesize.c getlogin_r.c \
- gettimeofday.c glob.c glob_pattern_p.c globfree.c inet_ntop.c \
- isnan.c isnand.c isnan.c isnanl.c localtime-buffer.c lstat.c \
- malloc.c lc-charset-dispatch.c mbrtowc.c mbtowc-lock.c \
- mbsinit.c mbsrtowcs-state.c mbsrtowcs.c memchr.c memmem.c \
+EXTRA_libgnu_a_SOURCES = alloca.c btowc.c canonicalize-lgpl.c \
+ chdir-long.c close.c closedir.c dirfd.c dup.c dup2.c error.c \
+ fchdir.c fcntl.c fdopendir.c float.c itold.c fnmatch.c \
+ fnmatch_loop.c frexp.c frexp.c frexpl.c fstat.c stat-w32.c \
+ at-func.c fstatat.c getcwd.c getcwd-lgpl.c getdtablesize.c \
+ getlogin_r.c getrandom.c gettimeofday.c glob.c \
+ glob_pattern_p.c globfree.c inet_ntop.c isblank.c isnan.c \
+ isnand.c isnan.c isnanl.c localtime-buffer.c lstat.c malloc.c \
+ lc-charset-dispatch.c mbrtowc.c mbtowc-lock.c mbsinit.c \
+ mbsrtowcs-state.c mbsrtowcs.c mbtowc.c memchr.c memmem.c \
mempcpy.c memrchr.c mkdir.c mkdtemp.c mkostemp.c msvc-inval.c \
msvc-nothrow.c open.c openat.c opendir.c rawmemchr.c readdir.c \
readlink.c realloc.c rename.c rewinddir.c rmdir.c setenv.c \
setlocale-lock.c stat-w32.c stat.c strchrnul.c strdup.c \
- strerror.c strerror-override.c strerror_r.c strstr.c \
+ strerror.c strerror-override.c strerror_r.c strnlen.c strstr.c \
strtok_r.c time_r.c unsetenv.c windows-mutex.c windows-once.c \
- windows-recmutex.c windows-rwlock.c
+ windows-recmutex.c windows-rwlock.c wmemchr.c wmempcpy.c
# Use this preprocessor expression to decide whether #include_next works.
# Do not rely on a 'configure'-time test for this, since the expression
@@ -1863,6 +1892,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloca.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename-lgpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btowc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonicalize-lgpl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chdir-long.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@
@@ -1896,12 +1926,14 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdtablesize.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getlogin_r.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getprogname.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getrandom.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glob.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glob_pattern_p.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globfree.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hard-locale.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_ntop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isblank.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnan.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnanl.Po@am__quote@
@@ -1918,6 +1950,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsrtowcs-state.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsrtowcs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbtowc-lock.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbtowc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memmem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mempcpy.Po@am__quote@
@@ -1953,6 +1986,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror_r.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strstr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtok_r.Po@am__quote@
@@ -1966,6 +2000,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-once.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-recmutex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-rwlock.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wmemchr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wmempcpy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/lock.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/threadlib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@malloc/$(DEPDIR)/scratch_buffer_grow.Po@am__quote@
@@ -2261,6 +2297,24 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON
} > $@-t && \
mv $@-t $@
+# We need the following in order to create <ctype.h> when the system
+# doesn't have one that works with the given compiler.
+ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -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_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \
+ -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
+ -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+ < $(srcdir)/ctype.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+
# We need the following in order to create <dirent.h> when the system
# doesn't have one that works with the given compiler.
dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
@@ -3238,6 +3292,28 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
} > $@-t && \
mv $@-t $@
+# We need the following in order to create <sys/random.h> when the system
+# doesn't have one.
+sys/random.h: sys_random.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+ $(AM_V_at)$(MKDIR_P) sys
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -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_SYS_RANDOM_H''@|$(NEXT_SYS_RANDOM_H)|g' \
+ -e 's|@''HAVE_SYS_RANDOM_H''@|$(HAVE_SYS_RANDOM_H)|g' \
+ -e 's/@''GNULIB_GETRANDOM''@/$(GNULIB_GETRANDOM)/g' \
+ -e 's/@''HAVE_GETRANDOM''@/$(HAVE_GETRANDOM)/g' \
+ -e 's/@''REPLACE_GETRANDOM''@/$(REPLACE_GETRANDOM)/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)/sys_random.in.h; \
+ } > $@-t && \
+ mv -f $@-t $@
+
# We need the following in order to create <sys/socket.h> when the system
# doesn't have one that works with the given compiler.
sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
@@ -3321,7 +3397,6 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
-e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
-e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
- -e 's|@''REPLACE_LCHMOD''@|$(REPLACE_LCHMOD)|g' \
-e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
-e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
-e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \
@@ -3470,6 +3545,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
-e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \
-e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \
+ -e 's/@''GNULIB_GETENTROPY''@/$(GNULIB_GETENTROPY)/g' \
-e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \
-e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \
-e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \
@@ -3518,6 +3594,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
-e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
-e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
+ -e 's|@''HAVE_GETENTROPY''@|$(HAVE_GETENTROPY)|g' \
-e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
-e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
-e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
@@ -3587,6 +3664,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
-e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
-e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
+ -e 's|@''UNISTD_H_HAVE_SYS_RANDOM_H''@|$(UNISTD_H_HAVE_SYS_RANDOM_H)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -3624,6 +3702,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \
-e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \
-e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \
+ -e 's/@''GNULIB_WMEMPCPY''@/$(GNULIB_WMEMPCPY)/g' \
-e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \
-e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \
-e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \
@@ -3664,6 +3743,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
-e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
-e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
+ -e 's|@''HAVE_WMEMPCPY''@|$(HAVE_WMEMPCPY)|g' \
-e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
-e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
-e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
diff --git a/gnulib/import/alloca.in.h b/gnulib/import/alloca.in.h
index c7187e6..5686b08 100644
--- a/gnulib/import/alloca.in.h
+++ b/gnulib/import/alloca.in.h
@@ -35,13 +35,16 @@
*/
#ifndef alloca
+ /* Some version of mingw have an <alloca.h> that causes trouble when
+ included after 'alloca' gets defined as a macro. As a workaround,
+ include this <alloca.h> first and define 'alloca' as a macro afterwards
+ if needed. */
+# if defined __GNUC__ && (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@
+# include_next <alloca.h>
+# endif
+#endif
+#ifndef alloca
# ifdef __GNUC__
- /* Some version of mingw have an <alloca.h> that causes trouble when
- included after 'alloca' gets defined as a macro. As a workaround, include
- this <alloca.h> first and define 'alloca' as a macro afterwards. */
-# if (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@
-# include_next <alloca.h>
-# endif
# define alloca __builtin_alloca
# elif defined _AIX
# define alloca __alloca
diff --git a/gnulib/import/assure.h b/gnulib/import/assure.h
index 8ea2f6e..09a4edf 100644
--- a/gnulib/import/assure.h
+++ b/gnulib/import/assure.h
@@ -21,12 +21,32 @@
#define _GL_ASSURE_H
#include <assert.h>
+#include "verify.h"
+
+/* Evaluate an assertion E that is guaranteed to be true.
+ If NDEBUG is not defined, abort the program if E is false.
+ If NDEBUG is defined, the compiler can assume E and behavior is
+ undefined if E is false, fails to evaluate, or has side effects.
+
+ Unlike standard 'assert', this macro evaluates E even when NDEBUG
+ is defined, so as to catch typos, avoid some GCC warnings, and
+ improve performance when E is simple enough.
+
+ Also see the documentation for 'assume' in verify.h. */
+
+#ifdef NDEBUG
+# define affirm(E) assume (E)
+#else
+# define affirm(E) assert (E)
+#endif
/* Check E's value at runtime, and report an error and abort if not.
However, do nothing if NDEBUG is defined.
- Unlike standard 'assert', this macro always compiles E even when NDEBUG
- is defined, so as to catch typos and avoid some GCC warnings. */
+ Unlike standard 'assert', this macro compiles E even when NDEBUG
+ is defined, so as to catch typos and avoid some GCC warnings.
+ Unlike 'affirm', it is OK for E to use hard-to-optimize features,
+ since E is not executed if NDEBUG is defined. */
#ifdef NDEBUG
# define assure(E) ((void) (0 && (E)))
diff --git a/gnulib/import/at-func.c b/gnulib/import/at-func.c
index 4a1c909..90022e0 100644
--- a/gnulib/import/at-func.c
+++ b/gnulib/import/at-func.c
@@ -16,7 +16,7 @@
/* written by Jim Meyering */
-#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "filename.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
# include <errno.h>
diff --git a/gnulib/import/attribute.h b/gnulib/import/attribute.h
new file mode 100644
index 0000000..2836b99
--- /dev/null
+++ b/gnulib/import/attribute.h
@@ -0,0 +1,215 @@
+/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers
+
+ Copyright 2020 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
+ (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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+/* 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. */
+
+#ifndef _GL_ATTRIBUTE_H
+#define _GL_ATTRIBUTE_H
+
+
+/* This file defines two types of attributes:
+ * C2X standard attributes. These have macro names that do not begin with
+ 'ATTRIBUTE_'.
+ * Selected GCC attributes; see:
+ https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
+ https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
+ https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html
+ These names begin with 'ATTRIBUTE_' to avoid name clashes. */
+
+
+/* =============== Attributes for specific kinds of functions =============== */
+
+/* Attributes for functions that should not be used. */
+
+/* Warn if the entity is used. */
+/* Applies to:
+ - function, variable,
+ - struct, union, struct/union member,
+ - enumeration, enumeration item,
+ - typedef,
+ in C++ also: namespace, class, template specialization. */
+#define DEPRECATED _GL_ATTRIBUTE_DEPRECATED
+
+/* If a function call is not optimized way, warn with MSG. */
+/* Applies to: functions. */
+#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING (msg)
+
+/* If a function call is not optimized way, report an error with MSG. */
+/* Applies to: functions. */
+#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR (msg)
+
+
+/* Attributes for memory-allocating functions. */
+
+/* The function returns a pointer to freshly allocated memory. */
+/* Applies to: functions. */
+#define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC
+
+/* ATTRIBUTE_ALLOC_SIZE ((N)) - The Nth argument of the function
+ 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. */
+#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args)
+
+
+/* Attributes for variadic functions. */
+
+/* The variadic function expects a trailing NULL argument.
+ ATTRIBUTE_SENTINEL () - The last argument is NULL.
+ ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */
+/* Applies to: functions. */
+#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL (pos)
+
+
+/* ================== Attributes for compiler diagnostics ================== */
+
+/* Attributes that help the compiler diagnose programmer mistakes.
+ Some of them may also help for some compiler optimizations. */
+
+/* ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) -
+ The STRING-INDEXth function argument is a format string of style
+ ARCHETYPE, which is one of:
+ printf, gnu_printf
+ scanf, gnu_scanf,
+ strftime, gnu_strftime,
+ strfmon,
+ or the same thing prefixed and suffixed with '__'.
+ If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK
+ are suitable for the format string. */
+/* Applies to: functions. */
+#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT (spec)
+
+/* ATTRIBUTE_NONNULL ((N1, N2,...)) - Arguments N1, N2,... must not be NULL.
+ ATTRIBUTE_NONNULL () - All pointer arguments must not be null. */
+/* Applies to: functions. */
+#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args)
+
+/* The function's return value is a non-NULL pointer. */
+/* Applies to: functions. */
+#define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL
+
+/* Warn if the caller does not use the return value,
+ unless the caller uses something like ignore_value. */
+/* Applies to: function, enumeration, class. */
+#define NODISCARD _GL_ATTRIBUTE_NODISCARD
+
+
+/* Attributes that disable false alarms when the compiler diagnoses
+ programmer "mistakes". */
+
+/* Do not warn if the entity is not used. */
+/* Applies to:
+ - function, variable,
+ - struct, union, struct/union member,
+ - enumeration, enumeration item,
+ - typedef,
+ in C++ also: class. */
+#define MAYBE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
+
+/* 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
+ type '[[un]signed] char'. */
+#define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING
+
+/* Do not warn if control flow falls through to the immediately
+ following 'case' or 'default' label. */
+/* Applies to: Empty statement (;), inside a 'switch' statement. */
+#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH
+
+
+/* ================== Attributes for debugging information ================== */
+
+/* Attributes regarding debugging information emitted by the compiler. */
+
+/* Omit the function from stack traces when debugging. */
+/* Applies to: function. */
+#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL
+
+/* Make the entity visible to debuggers etc., even with '-fwhole-program'. */
+/* Applies to: functions, variables. */
+#define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
+
+
+/* ========== Attributes that mainly direct compiler optimizations ========== */
+
+/* The function does not throw exceptions. */
+/* Applies to: functions. */
+#define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW
+
+/* Do not inline the function. */
+/* Applies to: functions. */
+#define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE
+
+/* Always inline the function, and report an error if the compiler
+ cannot inline. */
+/* Applies to: function. */
+#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
+
+/* The function does not affect observable state, and always returns a value.
+ Compilers can omit duplicate calls with the same arguments if
+ observable state is not changed between calls. (This attribute is
+ looser than ATTRIBUTE_CONST.) */
+/* Applies to: functions. */
+#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
+
+/* The function neither depends on nor affects observable state,
+ and always returns a value. Compilers can omit duplicate calls with
+ the same arguments. (This attribute is stricter than ATTRIBUTE_PURE.) */
+/* Applies to: functions. */
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+
+/* The function is rarely executed. */
+/* Applies to: functions. */
+#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD
+
+/* If called from some other compilation unit, the function executes
+ code from that unit only by return or by exception handling,
+ letting the compiler optimize that unit more aggressively. */
+/* Applies to: functions. */
+#define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF
+
+/* For struct members: The member has the smallest possible alignment.
+ For struct, union, class: All members have the smallest possible alignment,
+ minimizing the memory required. */
+/* Applies to: struct members, struct, union,
+ in C++ also: class. */
+#define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED
+
+
+/* ================ Attributes that make invalid code valid ================ */
+
+/* Attributes that prevent fatal compiler optimizations for code that is not
+ fully ISO C compliant. */
+
+/* Pointers to the type may point to the same storage as pointers to
+ other types, thus disabling strict aliasing optimization. */
+/* Applies to: types. */
+#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS
+
+
+#endif /* _GL_ATTRIBUTE_H */
diff --git a/gnulib/import/btowc.c b/gnulib/import/btowc.c
new file mode 100644
index 0000000..6828b70
--- /dev/null
+++ b/gnulib/import/btowc.c
@@ -0,0 +1,39 @@
+/* Convert unibyte character to wide character.
+ Copyright (C) 2008, 2010-2020 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+ 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,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <wchar.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+wint_t
+btowc (int c)
+{
+ if (c != EOF)
+ {
+ char buf[1];
+ wchar_t wc;
+
+ buf[0] = c;
+ if (mbtowc (&wc, buf, 1) >= 0)
+ return wc;
+ }
+ return WEOF;
+}
diff --git a/gnulib/import/canonicalize-lgpl.c b/gnulib/import/canonicalize-lgpl.c
index 7d3c710..9f99098 100644
--- a/gnulib/import/canonicalize-lgpl.c
+++ b/gnulib/import/canonicalize-lgpl.c
@@ -51,7 +51,7 @@
# define __realpath realpath
# include "pathmax.h"
# include "malloca.h"
-# include "dosname.h"
+# include "filename.h"
# if HAVE_GETCWD
# if IN_RELOCWRAPPER
/* When building the relocatable program wrapper, use the system's getcwd
diff --git a/gnulib/import/count-one-bits.h b/gnulib/import/count-one-bits.h
index eea56d8..6c5b757 100644
--- a/gnulib/import/count-one-bits.h
+++ b/gnulib/import/count-one-bits.h
@@ -34,29 +34,13 @@ _GL_INLINE_HEADER_BEGIN
extern "C" {
#endif
-/* Expand to code that computes the number of 1-bits of the local
- variable 'x' of type TYPE (an unsigned integer type) and return it
- from the current function. */
-#define COUNT_ONE_BITS_GENERIC(TYPE) \
- do \
- { \
- int count = 0; \
- int bits; \
- for (bits = 0; bits < sizeof (TYPE) * CHAR_BIT; bits += 32) \
- { \
- count += count_one_bits_32 (x); \
- x = x >> 31 >> 1; \
- } \
- return count; \
- } \
- while (0)
-
-/* Assuming the GCC builtin is BUILTIN and the MSC builtin is MSC_BUILTIN,
+/* Assuming the GCC builtin is GCC_BUILTIN and the MSC builtin is MSC_BUILTIN,
expand to code that computes the number of 1-bits of the local
variable 'x' of type TYPE (an unsigned integer type) and return it
from the current function. */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-# define COUNT_ONE_BITS(BUILTIN, MSC_BUILTIN, TYPE) return BUILTIN (x)
+# define COUNT_ONE_BITS(GCC_BUILTIN, MSC_BUILTIN, TYPE) \
+ return GCC_BUILTIN (x)
#else
/* Compute and return the number of 1-bits set in the least
@@ -71,14 +55,46 @@ count_one_bits_32 (unsigned int x)
return (x >> 8) + (x & 0x00ff);
}
+/* Expand to code that computes the number of 1-bits of the local
+ variable 'x' of type TYPE (an unsigned integer type) and return it
+ from the current function. */
+# define COUNT_ONE_BITS_GENERIC(TYPE) \
+ do \
+ { \
+ int count = 0; \
+ int bits; \
+ for (bits = 0; bits < sizeof (TYPE) * CHAR_BIT; bits += 32) \
+ { \
+ count += count_one_bits_32 (x); \
+ x = x >> 31 >> 1; \
+ } \
+ return count; \
+ } \
+ while (0)
+
# if 1500 <= _MSC_VER && (defined _M_IX86 || defined _M_X64)
/* While gcc falls back to its own generic code if the machine
on which it's running doesn't support popcount, with Microsoft's
compiler we need to detect and fallback ourselves. */
-# pragma intrinsic __cpuid
-# pragma intrinsic __popcnt
-# pragma intrinsic __popcnt64
+
+# if 0
+# include <intrin.h>
+# else
+ /* Don't pollute the namespace with too many MSVC intrinsics. */
+# pragma intrinsic (__cpuid)
+# pragma intrinsic (__popcnt)
+# if defined _M_X64
+# pragma intrinsic (__popcnt64)
+# endif
+# endif
+
+# if !defined _M_X64
+static inline __popcnt64 (unsigned long long x)
+{
+ return __popcnt ((unsigned int) (x >> 32)) + __popcnt ((unsigned int) x);
+}
+# endif
/* Return nonzero if popcount is supported. */
@@ -90,25 +106,30 @@ popcount_supported (void)
{
if (popcount_support < 0)
{
+ /* Do as described in
+ <https://docs.microsoft.com/en-us/cpp/intrinsics/popcnt16-popcnt-popcnt64> */
int cpu_info[4];
__cpuid (cpu_info, 1);
- popcount_support = (cpu_info[2] >> 23) & 1; /* See MSDN. */
+ popcount_support = (cpu_info[2] >> 23) & 1;
}
return popcount_support;
}
-# define COUNT_ONE_BITS(BUILTIN, MSC_BUILTIN, TYPE) \
- do \
- { \
- if (popcount_supported ()) \
- return MSC_BUILTIN (x); \
- else \
- COUNT_ONE_BITS_GENERIC (TYPE); \
- } \
+# define COUNT_ONE_BITS(GCC_BUILTIN, MSC_BUILTIN, TYPE) \
+ do \
+ { \
+ if (popcount_supported ()) \
+ return MSC_BUILTIN (x); \
+ else \
+ COUNT_ONE_BITS_GENERIC (TYPE); \
+ } \
while (0)
+
# else
-# define COUNT_ONE_BITS(BUILTIN, MSC_BUILTIN, TYPE) \
+
+# define COUNT_ONE_BITS(GCC_BUILTIN, MSC_BUILTIN, TYPE) \
COUNT_ONE_BITS_GENERIC (TYPE)
+
# endif
#endif
diff --git a/gnulib/import/ctype.in.h b/gnulib/import/ctype.in.h
new file mode 100644
index 0000000..555677a
--- /dev/null
+++ b/gnulib/import/ctype.in.h
@@ -0,0 +1,57 @@
+/* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
+
+ Copyright (C) 2009-2020 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, 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible. */
+
+/*
+ * ISO C 99 <ctype.h> for platforms on which it is incomplete.
+ * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html>
+ */
+
+#ifndef _@GUARD_PREFIX@_CTYPE_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* Include the original <ctype.h>. */
+/* The include_next requires a split double-inclusion guard. */
+#@INCLUDE_NEXT@ @NEXT_CTYPE_H@
+
+#ifndef _@GUARD_PREFIX@_CTYPE_H
+#define _@GUARD_PREFIX@_CTYPE_H
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
+/* The definition of _GL_WARN_ON_USE is copied here. */
+
+/* Return non-zero if c is a blank, i.e. a space or tab character. */
+#if @GNULIB_ISBLANK@
+# if !@HAVE_ISBLANK@
+_GL_EXTERN_C int isblank (int c);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef isblank
+# if HAVE_RAW_DECL_ISBLANK
+_GL_WARN_ON_USE (isblank, "isblank is unportable - "
+ "use gnulib module isblank for portability");
+# endif
+#endif
+
+#endif /* _@GUARD_PREFIX@_CTYPE_H */
+#endif /* _@GUARD_PREFIX@_CTYPE_H */
diff --git a/gnulib/import/dirent-private.h b/gnulib/import/dirent-private.h
index 4b4eba4..a3c6844 100644
--- a/gnulib/import/dirent-private.h
+++ b/gnulib/import/dirent-private.h
@@ -20,6 +20,10 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+/* Don't assume that UNICODE is not defined. */
+#undef WIN32_FIND_DATA
+#define WIN32_FIND_DATA WIN32_FIND_DATAA
+
struct gl_directory
{
/* Status, or error code to produce in next readdir() call.
diff --git a/gnulib/import/dirent.in.h b/gnulib/import/dirent.in.h
index f7c2681..6fa44f0 100644
--- a/gnulib/import/dirent.in.h
+++ b/gnulib/import/dirent.in.h
@@ -57,10 +57,12 @@ typedef struct gl_directory DIR;
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE /* empty */
+# endif
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
diff --git a/gnulib/import/dirname.h b/gnulib/import/dirname.h
index 8c12d93..5379e8e 100644
--- a/gnulib/import/dirname.h
+++ b/gnulib/import/dirname.h
@@ -21,7 +21,7 @@
# include <stdbool.h>
# include <stddef.h>
-# include "dosname.h"
+# include "filename.h"
# ifndef DIRECTORY_SEPARATOR
# define DIRECTORY_SEPARATOR '/'
diff --git a/gnulib/import/dosname.h b/gnulib/import/dosname.h
deleted file mode 100644
index 5782960..0000000
--- a/gnulib/import/dosname.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* File names on MS-DOS/Windows systems.
-
- Copyright (C) 2000-2001, 2004-2006, 2009-2020 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
- (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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-
- From Paul Eggert and Jim Meyering. */
-
-#ifndef _DOSNAME_H
-#define _DOSNAME_H
-
-#if (defined _WIN32 || defined __CYGWIN__ \
- || defined __EMX__ || defined __MSDOS__ || defined __DJGPP__)
- /* This internal macro assumes ASCII, but all hosts that support drive
- letters use ASCII. */
-# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \
- <= 'z' - 'a')
-# define FILE_SYSTEM_PREFIX_LEN(Filename) \
- (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
-# ifndef __CYGWIN__
-# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
-# endif
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-#else
-# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
-# define ISSLASH(C) ((C) == '/')
-#endif
-
-#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
-#endif
-
-#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
-# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
-# else
-# define IS_ABSOLUTE_FILE_NAME(F) \
- (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
-#endif
-#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
-
-#endif /* DOSNAME_H_ */
diff --git a/gnulib/import/error.h b/gnulib/import/error.h
index bad47a1..a351606 100644
--- a/gnulib/import/error.h
+++ b/gnulib/import/error.h
@@ -19,18 +19,6 @@
#ifndef _ERROR_H
#define _ERROR_H 1
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
- The __-protected variants of the attributes 'format' and 'printf' are
- accepted by gcc versions 2.6.4 (effectively 2.7) and later.
- We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
- gnulib and libintl do '#define printf __printf__' when they override
- the 'printf' function. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
-#endif
-
/* On mingw, the flavor of printf depends on whether the extensions module
* is in use; the check for <stdio.h> determines the witness macro. */
#ifndef _GL_ATTRIBUTE_SPEC_PRINTF
diff --git a/gnulib/import/extra/update-copyright b/gnulib/import/extra/update-copyright
index 4f79b56..d9b7f68 100755
--- a/gnulib/import/extra/update-copyright
+++ b/gnulib/import/extra/update-copyright
@@ -133,11 +133,11 @@
# are valid code in both sh and perl. When executed by sh, they re-execute
# the script through the perl program found in $PATH. The '-x' option
# is essential as well; without it, perl would re-execute the script
-# through /bin/sh. When executed by perl, the next two lines are a no-op.
+# through /bin/sh. When executed by perl, the next two lines are a no-op.
eval 'exec perl -wSx -0777 -pi "$0" "$@"'
if 0;
-my $VERSION = '2018-03-07.03:47'; # UTC
+my $VERSION = '2020-04-04.15:07'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
diff --git a/gnulib/import/fchdir.c b/gnulib/import/fchdir.c
index c27914b..1fa9a7e 100644
--- a/gnulib/import/fchdir.c
+++ b/gnulib/import/fchdir.c
@@ -29,7 +29,7 @@
#include <sys/stat.h>
#include "assure.h"
-#include "dosname.h"
+#include "filename.h"
#include "filenamecat.h"
#ifndef REPLACE_OPEN_DIRECTORY
@@ -84,7 +84,8 @@ ensure_dirs_slot (size_t fd)
return true;
}
-/* Return an absolute name of DIR in malloc'd storage. */
+/* Return an absolute name of DIR in malloc'd storage.
+ Upon failure, return NULL with errno set. */
static char *
get_name (char const *dir)
{
@@ -125,8 +126,8 @@ _gl_unregister_fd (int fd)
/* Mark FD as visiting FILENAME. FD must be non-negative, and refer
to an open file descriptor. If REPLACE_OPEN_DIRECTORY is non-zero,
this should only be called if FD is visiting a directory. Close FD
- and return -1 if there is insufficient memory to track the
- directory name; otherwise return FD. */
+ and return -1 with errno set if there is insufficient memory to track
+ the directory name; otherwise return FD. */
int
_gl_register_fd (int fd, const char *filename)
{
diff --git a/gnulib/import/fcntl.in.h b/gnulib/import/fcntl.in.h
index b2e1e51..0a21c95 100644
--- a/gnulib/import/fcntl.in.h
+++ b/gnulib/import/fcntl.in.h
@@ -116,9 +116,15 @@ _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
# endif
_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, ...));
+# if !GNULIB_defined_fcntl
+# define GNULIB_defined_fcntl 1
+# endif
# endif
_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
# endif
diff --git a/gnulib/import/filename.h b/gnulib/import/filename.h
index d4c7020..4598fb1 100644
--- a/gnulib/import/filename.h
+++ b/gnulib/import/filename.h
@@ -14,38 +14,94 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+/* From Paul Eggert and Jim Meyering. */
+
#ifndef _FILENAME_H
#define _FILENAME_H
+#include <string.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-/* Pathname support.
- ISSLASH(C) tests whether C is a directory separator character.
- IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
- it may be concatenated to a directory pathname.
- IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
+/* Filename support.
+ ISSLASH(C) tests whether C is a directory separator
+ character.
+ HAS_DEVICE(Filename) tests whether Filename contains a device
+ specification.
+ FILE_SYSTEM_PREFIX_LEN(Filename) length of the device specification
+ at the beginning of Filename,
+ index of the part consisting of
+ alternating components and slashes.
+ FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+ 1 when a non-empty device specification
+ can be followed by an empty or relative
+ part,
+ 0 when a non-empty device specification
+ must be followed by a slash,
+ 0 when device specification don't exist.
+ IS_ABSOLUTE_FILE_NAME(Filename)
+ tests whether Filename is independent of
+ any notion of "current directory".
+ IS_RELATIVE_FILE_NAME(Filename)
+ tests whether Filename may be concatenated
+ to a directory filename.
+ Note: On native Windows, OS/2, DOS, "c:" is neither an absolute nor a
+ relative file name!
+ IS_FILE_NAME_WITH_DIR(Filename) tests whether Filename contains a device
+ or directory specification.
*/
-#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
+#if defined _WIN32 || defined __CYGWIN__ \
+ || defined __EMX__ || defined __MSDOS__ || defined __DJGPP__
/* Native Windows, Cygwin, OS/2, DOS */
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-# define HAS_DEVICE(P) \
- ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
- && (P)[1] == ':')
-# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
-# define IS_PATH_WITH_DIR(P) \
- (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
-# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
+ /* Internal macro: Tests whether a character is a drive letter. */
+# define _IS_DRIVE_LETTER(C) \
+ (((C) >= 'A' && (C) <= 'Z') || ((C) >= 'a' && (C) <= 'z'))
+ /* Help the compiler optimizing it. This assumes ASCII. */
+# undef _IS_DRIVE_LETTER
+# define _IS_DRIVE_LETTER(C) \
+ (((unsigned int) (C) | ('a' - 'A')) - 'a' <= 'z' - 'a')
+# define HAS_DEVICE(Filename) \
+ (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':')
+# define FILE_SYSTEM_PREFIX_LEN(Filename) (HAS_DEVICE (Filename) ? 2 : 0)
+# ifdef __CYGWIN__
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
+# else
+ /* On native Windows, OS/2, DOS, the system has the notion of a
+ "current directory" on each drive. */
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
+# endif
+# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+# define IS_ABSOLUTE_FILE_NAME(Filename) \
+ ISSLASH ((Filename)[FILE_SYSTEM_PREFIX_LEN (Filename)])
+# else
+# define IS_ABSOLUTE_FILE_NAME(Filename) \
+ (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename))
+# endif
+# define IS_RELATIVE_FILE_NAME(Filename) \
+ (! (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename)))
+# define IS_FILE_NAME_WITH_DIR(Filename) \
+ (strchr ((Filename), '/') != NULL || strchr ((Filename), '\\') != NULL \
+ || HAS_DEVICE (Filename))
#else
/* Unix */
# define ISSLASH(C) ((C) == '/')
-# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
-# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
-# define FILE_SYSTEM_PREFIX_LEN(P) 0
+# define HAS_DEVICE(Filename) ((void) (Filename), 0)
+# define FILE_SYSTEM_PREFIX_LEN(Filename) ((void) (Filename), 0)
+# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
+# define IS_ABSOLUTE_FILE_NAME(Filename) ISSLASH ((Filename)[0])
+# define IS_RELATIVE_FILE_NAME(Filename) (! ISSLASH ((Filename)[0]))
+# define IS_FILE_NAME_WITH_DIR(Filename) (strchr ((Filename), '/') != NULL)
#endif
+/* Deprecated macros. For backward compatibility with old users of the
+ 'filename' module. */
+#define IS_ABSOLUTE_PATH IS_ABSOLUTE_FILE_NAME
+#define IS_PATH_WITH_DIR IS_FILE_NAME_WITH_DIR
+
#ifdef __cplusplus
}
diff --git a/gnulib/import/filenamecat-lgpl.c b/gnulib/import/filenamecat-lgpl.c
index 6f666f2..d97abfa 100644
--- a/gnulib/import/filenamecat-lgpl.c
+++ b/gnulib/import/filenamecat-lgpl.c
@@ -41,7 +41,7 @@
*BASE_IN_RESULT to point to the copy of BASE at the end of the
returned concatenation.
- Return NULL if malloc fails. */
+ If malloc fails, return NULL with errno set. */
char *
mfile_name_concat (char const *dir, char const *base, char **base_in_result)
@@ -68,20 +68,22 @@ mfile_name_concat (char const *dir, char const *base, char **base_in_result)
}
char *p_concat = malloc (dirlen + (sep != '\0') + baselen + 1);
- char *p;
-
if (p_concat == NULL)
return NULL;
- p = mempcpy (p_concat, dir, dirlen);
- *p = sep;
- p += sep != '\0';
+ {
+ char *p;
+
+ p = mempcpy (p_concat, dir, dirlen);
+ *p = sep;
+ p += sep != '\0';
- if (base_in_result)
- *base_in_result = p;
+ if (base_in_result)
+ *base_in_result = p;
- p = mempcpy (p, base, baselen);
- *p = '\0';
+ p = mempcpy (p, base, baselen);
+ *p = '\0';
+ }
return p_concat;
}
diff --git a/gnulib/import/fnmatch.c b/gnulib/import/fnmatch.c
index 0338bb3..3937ce3 100644
--- a/gnulib/import/fnmatch.c
+++ b/gnulib/import/fnmatch.c
@@ -1,20 +1,22 @@
-/* Copyright (C) 1991-1993, 1996-2007, 2009-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
- 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, 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 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,
+ 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 General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
-# include <config.h>
+# include <libc-config.h>
#endif
/* Enable GNU extensions in fnmatch.h. */
@@ -24,116 +26,87 @@
#include <fnmatch.h>
-#include <alloca.h>
#include <assert.h>
-#include <ctype.h>
#include <errno.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdlib.h>
+#include <ctype.h>
#include <string.h>
-
-#define WIDE_CHAR_SUPPORT \
- (HAVE_WCTYPE_H && HAVE_BTOWC && HAVE_ISWCTYPE \
- && HAVE_WMEMCHR && (HAVE_WMEMCPY || HAVE_WMEMPCPY))
-
-/* For platform which support the ISO C amendment 1 functionality we
- support user defined character classes. */
-#if defined _LIBC || WIDE_CHAR_SUPPORT
-# include <wctype.h>
-# include <wchar.h>
+#include <stdlib.h>
+#if defined _LIBC || HAVE_ALLOCA
+# include <alloca.h>
#endif
+#include <wchar.h>
+#include <wctype.h>
+#include <stddef.h>
+#include <stdbool.h>
/* We need some of the locale data (the collation sequence information)
but there is no interface to get this information in general. Therefore
we support a correct implementation only in glibc. */
#ifdef _LIBC
# include "../locale/localeinfo.h"
-# include "../locale/elem-hash.h"
# include "../locale/coll-lookup.h"
# include <shlib-compat.h>
# define CONCAT(a,b) __CONCAT(a,b)
+# define btowc __btowc
+# define iswctype __iswctype
# define mbsrtowcs __mbsrtowcs
+# define mempcpy __mempcpy
+# define strnlen __strnlen
+# define towlower __towlower
+# define wcscat __wcscat
+# define wcslen __wcslen
+# define wctype __wctype
+# define wmemchr __wmemchr
+# define wmempcpy __wmempcpy
# define fnmatch __fnmatch
extern int fnmatch (const char *pattern, const char *string, int flags);
#endif
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
-#include "flexmember.h"
-
-#ifndef FALLTHROUGH
+#ifdef _LIBC
# if __GNUC__ < 7
# define FALLTHROUGH ((void) 0)
# else
# define FALLTHROUGH __attribute__ ((__fallthrough__))
# endif
+#else
+# include "attribute.h"
#endif
+#include <intprops.h>
+#include <flexmember.h>
+
/* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */
#define NO_LEADING_PERIOD(flags) \
((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD))
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself, and have not detected a bug
- in the library. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand 'configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU
-
-
-# if ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK))
-# define isblank(c) ((c) == ' ' || (c) == '\t')
+#ifndef _LIBC
+# if HAVE_ALLOCA
+/* The OS usually guarantees only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ allocate anything larger than 4096 bytes. Also care for the possibility
+ of a few compiler-allocated temporary stack slots. */
+# define __libc_use_alloca(n) ((n) < 4032)
+# else
+/* Just use malloc. */
+# define __libc_use_alloca(n) false
+# undef alloca
+# define alloca(n) malloc (n)
# endif
+# define alloca_account(size, avar) ((avar) += (size), alloca (size))
+#endif
-# define STREQ(s1, s2) (strcmp (s1, s2) == 0)
-
-# if defined _LIBC || WIDE_CHAR_SUPPORT
-/* The GNU C library provides support for user-defined character classes
- and the functions from ISO C amendment 1. */
-# ifdef CHARCLASS_NAME_MAX
-# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
-# else
+/* Provide support for user-defined character classes, based on the functions
+ from ISO C 90 amendment 1. */
+#ifdef CHARCLASS_NAME_MAX
+# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
+#else
/* This shouldn't happen but some implementation might still have this
problem. Use a reasonable default value. */
-# define CHAR_CLASS_MAX_LENGTH 256
-# endif
-
-# ifdef _LIBC
-# define IS_CHAR_CLASS(string) __wctype (string)
-# else
-# define IS_CHAR_CLASS(string) wctype (string)
-# endif
-
-# ifdef _LIBC
-# define ISWCTYPE(WC, WT) __iswctype (WC, WT)
-# else
-# define ISWCTYPE(WC, WT) iswctype (WC, WT)
-# endif
-
-# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
-/* In this case we are implementing the multibyte character handling. */
-# define HANDLE_MULTIBYTE 1
-# endif
+# define CHAR_CLASS_MAX_LENGTH 256
+#endif
-# else
-# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, 'xdigit'. */
-
-# define IS_CHAR_CLASS(string) \
- (STREQ (string, "alpha") || STREQ (string, "upper") \
- || STREQ (string, "lower") || STREQ (string, "digit") \
- || STREQ (string, "alnum") || STREQ (string, "xdigit") \
- || STREQ (string, "space") || STREQ (string, "print") \
- || STREQ (string, "punct") || STREQ (string, "graph") \
- || STREQ (string, "cntrl") || STREQ (string, "blank"))
-# endif
+#define IS_CHAR_CLASS(string) wctype (string)
/* Avoid depending on library functions or files
whose names are inconsistent. */
@@ -141,68 +114,53 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
/* Global variable. */
static int posixly_correct;
-# ifndef internal_function
-/* Inside GNU libc we mark some function in a special way. In other
- environments simply ignore the marking. */
-# define internal_function
-# endif
-
/* Note that this evaluates C many times. */
-# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
-# define CHAR char
-# define UCHAR unsigned char
-# define INT int
-# define FCT internal_fnmatch
-# define EXT ext_match
-# define END end_pattern
-# define L_(CS) CS
-# ifdef _LIBC
-# define BTOWC(C) __btowc (C)
-# else
-# define BTOWC(C) btowc (C)
-# endif
-# define STRLEN(S) strlen (S)
-# define STRCAT(D, S) strcat (D, S)
-# ifdef _LIBC
-# define MEMPCPY(D, S, N) __mempcpy (D, S, N)
-# else
-# if HAVE_MEMPCPY
-# define MEMPCPY(D, S, N) mempcpy (D, S, N)
-# else
-# define MEMPCPY(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
-# endif
-# endif
-# define MEMCHR(S, C, N) memchr (S, C, N)
-# include "fnmatch_loop.c"
-
-
-# if HANDLE_MULTIBYTE
-# define FOLD(c) ((flags & FNM_CASEFOLD) ? towlower (c) : (c))
-# define CHAR wchar_t
-# define UCHAR wint_t
-# define INT wint_t
-# define FCT internal_fnwmatch
-# define EXT ext_wmatch
-# define END end_wpattern
-# define L_(CS) L##CS
-# define BTOWC(C) (C)
-# ifdef _LIBC
-# define STRLEN(S) __wcslen (S)
-# define STRCAT(D, S) __wcscat (D, S)
-# define MEMPCPY(D, S, N) __wmempcpy (D, S, N)
-# else
-# define STRLEN(S) wcslen (S)
-# define STRCAT(D, S) wcscat (D, S)
-# if HAVE_WMEMPCPY
-# define MEMPCPY(D, S, N) wmempcpy (D, S, N)
-# else
-# define MEMPCPY(D, S, N) (wmemcpy (D, S, N) + (N))
-# endif
-# endif
-# define MEMCHR(S, C, N) wmemchr (S, C, N)
-# define WIDE_CHAR_VERSION 1
-
-# undef IS_CHAR_CLASS
+#define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
+#define CHAR char
+#define UCHAR unsigned char
+#define INT int
+#define FCT internal_fnmatch
+#define EXT ext_match
+#define END end_pattern
+#define STRUCT fnmatch_struct
+#define L_(CS) CS
+#define BTOWC(C) btowc (C)
+#define STRLEN(S) strlen (S)
+#define STRCAT(D, S) strcat (D, S)
+#define MEMPCPY(D, S, N) mempcpy (D, S, N)
+#define MEMCHR(S, C, N) memchr (S, C, N)
+#define WIDE_CHAR_VERSION 0
+#ifdef _LIBC
+# include <locale/weight.h>
+# define FINDIDX findidx
+#endif
+#include "fnmatch_loop.c"
+
+
+#define FOLD(c) ((flags & FNM_CASEFOLD) ? towlower (c) : (c))
+#define CHAR wchar_t
+#define UCHAR wint_t
+#define INT wint_t
+#define FCT internal_fnwmatch
+#define EXT ext_wmatch
+#define END end_wpattern
+#define L_(CS) L##CS
+#define BTOWC(C) (C)
+#define STRLEN(S) wcslen (S)
+#define STRCAT(D, S) wcscat (D, S)
+#define MEMPCPY(D, S, N) wmempcpy (D, S, N)
+#define MEMCHR(S, C, N) wmemchr (S, C, N)
+#define WIDE_CHAR_VERSION 1
+#ifdef _LIBC
+/* Change the name the header defines so it doesn't conflict with
+ the <locale/weight.h> version included above. */
+# define findidx findidxwc
+# include <locale/weightwc.h>
+# undef findidx
+# define FINDIDX findidxwc
+#endif
+
+#undef IS_CHAR_CLASS
/* We have to convert the wide character string in a multibyte string. But
we know that the character class names consist of alphanumeric characters
from the portable character set, and since the wide character encoding
@@ -218,11 +176,11 @@ is_char_class (const wchar_t *wcs)
do
{
/* Test for a printable character from the portable character set. */
-# ifdef _LIBC
+#ifdef _LIBC
if (*wcs < 0x20 || *wcs > 0x7e
|| *wcs == 0x24 || *wcs == 0x40 || *wcs == 0x60)
return (wctype_t) 0;
-# else
+#else
switch (*wcs)
{
case L' ': case L'!': case L'"': case L'#': case L'%':
@@ -249,7 +207,7 @@ is_char_class (const wchar_t *wcs)
default:
return (wctype_t) 0;
}
-# endif
+#endif
/* Avoid overrunning the buffer. */
if (cp == s + CHAR_CLASS_MAX_LENGTH)
@@ -261,96 +219,137 @@ is_char_class (const wchar_t *wcs)
*cp = '\0';
-# ifdef _LIBC
- return __wctype (s);
-# else
return wctype (s);
-# endif
}
-# define IS_CHAR_CLASS(string) is_char_class (string)
+#define IS_CHAR_CLASS(string) is_char_class (string)
-# include "fnmatch_loop.c"
-# endif
+#include "fnmatch_loop.c"
int
fnmatch (const char *pattern, const char *string, int flags)
{
-# if HANDLE_MULTIBYTE
-# define ALLOCA_LIMIT 2000
- if (__builtin_expect (MB_CUR_MAX, 1) != 1)
+ if (__glibc_unlikely (MB_CUR_MAX != 1))
{
mbstate_t ps;
- size_t patsize;
- size_t strsize;
- size_t totsize;
+ size_t n;
+ const char *p;
+ wchar_t *wpattern_malloc = NULL;
wchar_t *wpattern;
+ wchar_t *wstring_malloc = NULL;
wchar_t *wstring;
- int res;
+ size_t alloca_used = 0;
- /* Calculate the size needed to convert the strings to
- wide characters. */
+ /* Convert the strings into wide characters. */
memset (&ps, '\0', sizeof (ps));
- patsize = mbsrtowcs (NULL, &pattern, 0, &ps) + 1;
- if (__builtin_expect (patsize != 0, 1))
+ p = pattern;
+ n = strnlen (pattern, 1024);
+ if (__glibc_likely (n < 1024))
+ {
+ wpattern = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
+ alloca_used);
+ n = mbsrtowcs (wpattern, &p, n + 1, &ps);
+ if (__glibc_unlikely (n == (size_t) -1))
+ /* Something wrong.
+ XXX Do we have to set 'errno' to something which mbsrtows hasn't
+ already done? */
+ return -1;
+ if (p)
+ {
+ memset (&ps, '\0', sizeof (ps));
+ goto prepare_wpattern;
+ }
+ }
+ else
{
+ prepare_wpattern:
+ n = mbsrtowcs (NULL, &pattern, 0, &ps);
+ if (__glibc_unlikely (n == (size_t) -1))
+ /* Something wrong.
+ XXX Do we have to set 'errno' to something which mbsrtows hasn't
+ already done? */
+ return -1;
+ if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t)))
+ {
+ __set_errno (ENOMEM);
+ return -2;
+ }
+ wpattern_malloc = wpattern
+ = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
assert (mbsinit (&ps));
- strsize = mbsrtowcs (NULL, &string, 0, &ps) + 1;
- if (__builtin_expect (strsize != 0, 1))
+ if (wpattern == NULL)
+ return -2;
+ (void) mbsrtowcs (wpattern, &pattern, n + 1, &ps);
+ }
+
+ assert (mbsinit (&ps));
+ n = strnlen (string, 1024);
+ p = string;
+ if (__glibc_likely (n < 1024))
+ {
+ wstring = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
+ alloca_used);
+ n = mbsrtowcs (wstring, &p, n + 1, &ps);
+ if (__glibc_unlikely (n == (size_t) -1))
+ {
+ /* Something wrong.
+ XXX Do we have to set 'errno' to something which
+ mbsrtows hasn't already done? */
+ free_return:
+ free (wpattern_malloc);
+ return -1;
+ }
+ if (p)
{
- assert (mbsinit (&ps));
- totsize = patsize + strsize;
- if (__builtin_expect (! (patsize <= totsize
- && totsize <= SIZE_MAX / sizeof (wchar_t)),
- 0))
- {
- errno = ENOMEM;
- return -1;
- }
-
- /* Allocate room for the wide characters. */
- if (__builtin_expect (totsize < ALLOCA_LIMIT, 1))
- wpattern = (wchar_t *) alloca (totsize * sizeof (wchar_t));
- else
- {
- wpattern = malloc (totsize * sizeof (wchar_t));
- if (__builtin_expect (! wpattern, 0))
- {
- errno = ENOMEM;
- return -1;
- }
- }
- wstring = wpattern + patsize;
-
- /* Convert the strings into wide characters. */
- mbsrtowcs (wpattern, &pattern, patsize, &ps);
- assert (mbsinit (&ps));
- mbsrtowcs (wstring, &string, strsize, &ps);
-
- res = internal_fnwmatch (wpattern, wstring, wstring + strsize - 1,
- flags & FNM_PERIOD, flags);
-
- if (__builtin_expect (! (totsize < ALLOCA_LIMIT), 0))
- free (wpattern);
- return res;
+ memset (&ps, '\0', sizeof (ps));
+ goto prepare_wstring;
}
}
- }
+ else
+ {
+ prepare_wstring:
+ n = mbsrtowcs (NULL, &string, 0, &ps);
+ if (__glibc_unlikely (n == (size_t) -1))
+ /* Something wrong.
+ XXX Do we have to set 'errno' to something which mbsrtows hasn't
+ already done? */
+ goto free_return;
+ if (__glibc_unlikely (n >= (size_t) -1 / sizeof (wchar_t)))
+ {
+ free (wpattern_malloc);
+ __set_errno (ENOMEM);
+ return -2;
+ }
+
+ wstring_malloc = wstring
+ = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
+ if (wstring == NULL)
+ {
+ free (wpattern_malloc);
+ return -2;
+ }
+ assert (mbsinit (&ps));
+ (void) mbsrtowcs (wstring, &string, n + 1, &ps);
+ }
+
+ int res = internal_fnwmatch (wpattern, wstring, wstring + n,
+ flags & FNM_PERIOD, flags, NULL,
+ alloca_used);
+
+ free (wstring_malloc);
+ free (wpattern_malloc);
-# endif /* HANDLE_MULTIBYTE */
+ return res;
+ }
return internal_fnmatch (pattern, string, string + strlen (string),
- flags & FNM_PERIOD, flags);
+ flags & FNM_PERIOD, flags, NULL, 0);
}
-# ifdef _LIBC
-# undef fnmatch
+#undef fnmatch
versioned_symbol (libc, __fnmatch, fnmatch, GLIBC_2_2_3);
-# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_3)
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_3)
strong_alias (__fnmatch, __fnmatch_old)
compat_symbol (libc, __fnmatch_old, fnmatch, GLIBC_2_0);
-# endif
+#endif
libc_hidden_ver (__fnmatch, fnmatch)
-# endif
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
diff --git a/gnulib/import/fnmatch_loop.c b/gnulib/import/fnmatch_loop.c
index 50064ab..ebd6af3 100644
--- a/gnulib/import/fnmatch_loop.c
+++ b/gnulib/import/fnmatch_loop.c
@@ -1,33 +1,47 @@
-/* Copyright (C) 1991-1993, 1996-2006, 2009-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- 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, 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 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,
+ 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 General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifdef _LIBC
+# include <stdint.h>
+#endif
+
+struct STRUCT
+{
+ const CHAR *pattern;
+ const CHAR *string;
+ bool no_leading_period;
+};
/* Match STRING against the file name pattern PATTERN, returning zero if
it matches, nonzero if not. */
+static int FCT (const CHAR *pattern, const CHAR *string,
+ const CHAR *string_end, bool no_leading_period, int flags,
+ struct STRUCT *ends, size_t alloca_used);
static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
- const CHAR *string_end, bool no_leading_period, int flags)
- internal_function;
-static const CHAR *END (const CHAR *patternp) internal_function;
+ const CHAR *string_end, bool no_leading_period, int flags,
+ size_t alloca_used);
+static const CHAR *END (const CHAR *patternp);
static int
-internal_function
FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
- bool no_leading_period, int flags)
+ bool no_leading_period, int flags, struct STRUCT *ends, size_t alloca_used)
{
- register const CHAR *p = pattern, *n = string;
- register UCHAR c;
+ const CHAR *p = pattern, *n = string;
+ UCHAR c;
#ifdef _LIBC
# if WIDE_CHAR_VERSION
const char *collseq = (const char *)
@@ -46,12 +60,10 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
switch (c)
{
case L_('?'):
- if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
+ if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(')
{
- int res;
-
- res = EXT (c, p, n, string_end, no_leading_period,
- flags);
+ int res = EXT (c, p, n, string_end, no_leading_period,
+ flags, alloca_used);
if (res != -1)
return res;
}
@@ -78,15 +90,20 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
break;
case L_('*'):
- if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
+ if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(')
{
- int res;
-
- res = EXT (c, p, n, string_end, no_leading_period,
- flags);
+ int res = EXT (c, p, n, string_end, no_leading_period,
+ flags, alloca_used);
if (res != -1)
return res;
}
+ else if (ends != NULL)
+ {
+ ends->pattern = p - 1;
+ ends->string = n;
+ ends->no_leading_period = no_leading_period;
+ return 0;
+ }
if (n != string_end && *n == L_('.') && no_leading_period)
return FNM_NOMATCH;
@@ -111,7 +128,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
/* There isn't another character; no match. */
return FNM_NOMATCH;
else if (*n == L_('/')
- && __builtin_expect (flags & FNM_FILE_NAME, 0))
+ && __glibc_unlikely (flags & FNM_FILE_NAME))
/* A slash does not match a wildcard under
FNM_FILE_NAME. */
return FNM_NOMATCH;
@@ -147,49 +164,61 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
else
{
const CHAR *endp;
+ struct STRUCT end;
+ end.pattern = NULL;
endp = MEMCHR (n, (flags & FNM_FILE_NAME) ? L_('/') : L_('\0'),
string_end - n);
if (endp == NULL)
endp = string_end;
if (c == L_('[')
- || (__builtin_expect (flags & FNM_EXTMATCH, 0) != 0
+ || (__glibc_unlikely (flags & FNM_EXTMATCH)
&& (c == L_('@') || c == L_('+') || c == L_('!'))
&& *p == L_('(')))
{
int flags2 = ((flags & FNM_FILE_NAME)
? flags : (flags & ~FNM_PERIOD));
- bool no_leading_period2 = no_leading_period;
- for (--p; n < endp; ++n, no_leading_period2 = false)
- if (FCT (p, n, string_end, no_leading_period2, flags2)
- == 0)
- return 0;
+ for (--p; n < endp; ++n, no_leading_period = false)
+ if (FCT (p, n, string_end, no_leading_period, flags2,
+ &end, alloca_used) == 0)
+ goto found;
}
else if (c == L_('/') && (flags & FNM_FILE_NAME))
{
while (n < string_end && *n != L_('/'))
++n;
if (n < string_end && *n == L_('/')
- && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags)
- == 0))
+ && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags,
+ NULL, alloca_used) == 0))
return 0;
}
else
{
int flags2 = ((flags & FNM_FILE_NAME)
? flags : (flags & ~FNM_PERIOD));
- int no_leading_period2 = no_leading_period;
if (c == L_('\\') && !(flags & FNM_NOESCAPE))
c = *p;
c = FOLD (c);
- for (--p; n < endp; ++n, no_leading_period2 = false)
+ for (--p; n < endp; ++n, no_leading_period = false)
if (FOLD ((UCHAR) *n) == c
- && (FCT (p, n, string_end, no_leading_period2, flags2)
- == 0))
- return 0;
+ && (FCT (p, n, string_end, no_leading_period, flags2,
+ &end, alloca_used) == 0))
+ {
+ found:
+ if (end.pattern == NULL)
+ return 0;
+ break;
+ }
+ if (end.pattern != NULL)
+ {
+ p = end.pattern;
+ n = end.string;
+ no_leading_period = end.no_leading_period;
+ continue;
+ }
}
}
@@ -201,7 +230,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
/* Nonzero if the sense of the character class is inverted. */
const CHAR *p_init = p;
const CHAR *n_init = n;
- register bool not;
+ bool not;
CHAR cold;
UCHAR fn;
@@ -227,8 +256,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
c = *p++;
for (;;)
{
- bool is_range = false;
-
if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
{
if (*p == L_('\0'))
@@ -243,9 +270,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
/* Leave room for the null. */
CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
size_t c1 = 0;
-#if defined _LIBC || WIDE_CHAR_SUPPORT
wctype_t wt;
-#endif
const CHAR *startp = p;
for (;;)
@@ -273,35 +298,19 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
}
str[c1] = L_('\0');
-#if defined _LIBC || WIDE_CHAR_SUPPORT
wt = IS_CHAR_CLASS (str);
if (wt == 0)
/* Invalid character class name. */
return FNM_NOMATCH;
-# if defined _LIBC && ! WIDE_CHAR_VERSION
+#if defined _LIBC && ! WIDE_CHAR_VERSION
/* The following code is glibc specific but does
there a good job in speeding up the code since
we can avoid the btowc() call. */
if (_ISCTYPE ((UCHAR) *n, wt))
goto matched;
-# else
- if (ISWCTYPE (BTOWC ((UCHAR) *n), wt))
- goto matched;
-# endif
#else
- if ((STREQ (str, L_("alnum")) && isalnum ((UCHAR) *n))
- || (STREQ (str, L_("alpha")) && isalpha ((UCHAR) *n))
- || (STREQ (str, L_("blank")) && isblank ((UCHAR) *n))
- || (STREQ (str, L_("cntrl")) && iscntrl ((UCHAR) *n))
- || (STREQ (str, L_("digit")) && isdigit ((UCHAR) *n))
- || (STREQ (str, L_("graph")) && isgraph ((UCHAR) *n))
- || (STREQ (str, L_("lower")) && islower ((UCHAR) *n))
- || (STREQ (str, L_("print")) && isprint ((UCHAR) *n))
- || (STREQ (str, L_("punct")) && ispunct ((UCHAR) *n))
- || (STREQ (str, L_("space")) && isspace ((UCHAR) *n))
- || (STREQ (str, L_("upper")) && isupper ((UCHAR) *n))
- || (STREQ (str, L_("xdigit")) && isxdigit ((UCHAR) *n)))
+ if (iswctype (BTOWC ((UCHAR) *n), wt))
goto matched;
#endif
c = *p++;
@@ -309,7 +318,12 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
#ifdef _LIBC
else if (c == L_('[') && *p == L_('='))
{
- UCHAR str[1];
+ /* It's important that STR be a scalar variable rather
+ than a one-element array, because GCC (at least 4.9.2
+ -O2 on x86-64) can be confused by the array and
+ diagnose a "used initialized" in a dead branch in the
+ findidx function. */
+ UCHAR str;
uint32_t nrules =
_NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
const CHAR *startp = p;
@@ -321,7 +335,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
c = L_('[');
goto normal_bracket;
}
- str[0] = c;
+ str = c;
c = *++p;
if (c != L_('=') || p[1] != L_(']'))
@@ -334,7 +348,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
if (nrules == 0)
{
- if ((UCHAR) *n == str[0])
+ if ((UCHAR) *n == str)
goto matched;
}
else
@@ -342,28 +356,21 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
const int32_t *table;
# if WIDE_CHAR_VERSION
const int32_t *weights;
- const int32_t *extra;
+ const wint_t *extra;
# else
const unsigned char *weights;
const unsigned char *extra;
# endif
const int32_t *indirect;
int32_t idx;
- const UCHAR *cp = (const UCHAR *) str;
-
- /* This #include defines a local function! */
-# if WIDE_CHAR_VERSION
-# include <locale/weightwc.h>
-# else
-# include <locale/weight.h>
-# endif
+ const UCHAR *cp = (const UCHAR *) &str;
# if WIDE_CHAR_VERSION
table = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
weights = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
- extra = (const int32_t *)
+ extra = (const wint_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
indirect = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
@@ -378,7 +385,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
# endif
- idx = findidx (&cp);
+ idx = FINDIDX (table, indirect, extra, &cp, 1);
if (idx != 0)
{
/* We found a table entry. Now see whether the
@@ -388,7 +395,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
int32_t idx2;
const UCHAR *np = (const UCHAR *) n;
- idx2 = findidx (&np);
+ idx2 = FINDIDX (table, indirect, extra,
+ &np, string_end - n);
if (idx2 != 0
&& (idx >> 24) == (idx2 >> 24)
&& len == weights[idx2 & 0xffffff])
@@ -422,6 +430,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
}
else
{
+ bool is_range = false;
+
#ifdef _LIBC
bool is_seqval = false;
@@ -468,25 +478,11 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
{
int32_t table_size;
const int32_t *symb_table;
-# ifdef WIDE_CHAR_VERSION
- char str[c1];
- size_t strcnt;
-# else
-# define str (startp + 1)
-# endif
const unsigned char *extra;
int32_t idx;
int32_t elem;
- int32_t second;
- int32_t hash;
-
-# ifdef WIDE_CHAR_VERSION
- /* We have to convert the name to a single-byte
- string. This is possible since the names
- consist of ASCII characters and the internal
- representation is UCS4. */
- for (strcnt = 0; strcnt < c1; ++strcnt)
- str[strcnt] = startp[1 + strcnt];
+# if WIDE_CHAR_VERSION
+ CHAR *wextra;
# endif
table_size =
@@ -499,81 +495,65 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
_NL_CURRENT (LC_COLLATE,
_NL_COLLATE_SYMB_EXTRAMB);
- /* Locate the character in the hashing table. */
- hash = elem_hash (str, c1);
-
- idx = 0;
- elem = hash % table_size;
- if (symb_table[2 * elem] != 0)
- {
- second = hash % (table_size - 2) + 1;
-
- do
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- && (c1
- == extra[symb_table[2 * elem + 1]])
- && memcmp (str,
- &extra[symb_table[2 * elem
- + 1]
- + 1], c1) == 0)
- {
- /* Yep, this is the entry. */
- idx = symb_table[2 * elem + 1];
- idx += 1 + extra[idx];
- break;
- }
-
- /* Next entry. */
- elem += second;
- }
- while (symb_table[2 * elem] != 0);
- }
+ for (elem = 0; elem < table_size; elem++)
+ if (symb_table[2 * elem] != 0)
+ {
+ idx = symb_table[2 * elem + 1];
+ /* Skip the name of collating element. */
+ idx += 1 + extra[idx];
+# if WIDE_CHAR_VERSION
+ /* Skip the byte sequence of the
+ collating element. */
+ idx += 1 + extra[idx];
+ /* Adjust for the alignment. */
+ idx = (idx + 3) & ~3;
+
+ wextra = (CHAR *) &extra[idx + 4];
+
+ if (/* Compare the length of the sequence. */
+ c1 == wextra[0]
+ /* Compare the wide char sequence. */
+ && (__wmemcmp (startp + 1, &wextra[1],
+ c1)
+ == 0))
+ /* Yep, this is the entry. */
+ break;
+# else
+ if (/* Compare the length of the sequence. */
+ c1 == extra[idx]
+ /* Compare the byte sequence. */
+ && memcmp (startp + 1,
+ &extra[idx + 1], c1) == 0)
+ /* Yep, this is the entry. */
+ break;
+# endif
+ }
- if (symb_table[2 * elem] != 0)
+ if (elem < table_size)
{
/* Compare the byte sequence but only if
this is not part of a range. */
-# ifdef WIDE_CHAR_VERSION
- int32_t *wextra;
+ if (! is_range
- idx += 1 + extra[idx];
- /* Adjust for the alignment. */
- idx = (idx + 3) & ~3;
-
- wextra = (int32_t *) &extra[idx + 4];
-# endif
-
- if (! is_range)
- {
-# ifdef WIDE_CHAR_VERSION
- for (c1 = 0;
- (int32_t) c1 < wextra[idx];
- ++c1)
- if (n[c1] != wextra[1 + c1])
- break;
-
- if ((int32_t) c1 == wextra[idx])
- goto matched;
+# if WIDE_CHAR_VERSION
+ && __wmemcmp (n, &wextra[1], c1) == 0
# else
- for (c1 = 0; c1 < extra[idx]; ++c1)
- if (n[c1] != extra[1 + c1])
- break;
-
- if (c1 == extra[idx])
- goto matched;
+ && memcmp (n, &extra[idx + 1], c1) == 0
# endif
+ )
+ {
+ n += c1 - 1;
+ goto matched;
}
/* Get the collation sequence value. */
is_seqval = true;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
cold = wextra[1 + wextra[idx]];
# else
- /* Adjust for the alignment. */
idx += 1 + extra[idx];
- idx = (idx + 3) & ~4;
+ /* Adjust for the alignment. */
+ idx = (idx + 3) & ~3;
cold = *((int32_t *) &extra[idx]);
# endif
@@ -583,10 +563,10 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
{
/* No valid character. Match it as a
single byte. */
- if (!is_range && *n == str[0])
+ if (!is_range && *n == startp[1])
goto matched;
- cold = str[0];
+ cold = startp[1];
c = *p++;
}
else
@@ -594,7 +574,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
}
}
else
-# undef str
#endif
{
c = FOLD (c);
@@ -614,7 +593,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
outside of is_seqval's scope. */
is_seqval = false;
#endif
-
cold = c;
c = *p++;
}
@@ -634,7 +612,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
uint32_t lcollseq;
UCHAR cend = *p++;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
/* Search in the 'names' array for the characters. */
fcollseq = __collseq_table_lookup (collseq, fn);
if (fcollseq == ~((uint32_t) 0))
@@ -689,25 +667,11 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
{
int32_t table_size;
const int32_t *symb_table;
-# ifdef WIDE_CHAR_VERSION
- char str[c1];
- size_t strcnt;
-# else
-# define str (startp + 1)
-# endif
const unsigned char *extra;
int32_t idx;
int32_t elem;
- int32_t second;
- int32_t hash;
-
-# ifdef WIDE_CHAR_VERSION
- /* We have to convert the name to a single-byte
- string. This is possible since the names
- consist of ASCII characters and the internal
- representation is UCS4. */
- for (strcnt = 0; strcnt < c1; ++strcnt)
- str[strcnt] = startp[1 + strcnt];
+# if WIDE_CHAR_VERSION
+ CHAR *wextra;
# endif
table_size =
@@ -720,71 +684,64 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
_NL_CURRENT (LC_COLLATE,
_NL_COLLATE_SYMB_EXTRAMB);
- /* Locate the character in the hashing
- table. */
- hash = elem_hash (str, c1);
-
- idx = 0;
- elem = hash % table_size;
- if (symb_table[2 * elem] != 0)
- {
- second = hash % (table_size - 2) + 1;
-
- do
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- && (c1
- == extra[symb_table[2 * elem + 1]])
- && memcmp (str,
- &extra[symb_table[2 * elem + 1]
- + 1], c1) == 0)
- {
- /* Yep, this is the entry. */
- idx = symb_table[2 * elem + 1];
- idx += 1 + extra[idx];
- break;
- }
-
- /* Next entry. */
- elem += second;
- }
- while (symb_table[2 * elem] != 0);
- }
+ for (elem = 0; elem < table_size; elem++)
+ if (symb_table[2 * elem] != 0)
+ {
+ idx = symb_table[2 * elem + 1];
+ /* Skip the name of collating
+ element. */
+ idx += 1 + extra[idx];
+# if WIDE_CHAR_VERSION
+ /* Skip the byte sequence of the
+ collating element. */
+ idx += 1 + extra[idx];
+ /* Adjust for the alignment. */
+ idx = (idx + 3) & ~3;
+
+ wextra = (CHAR *) &extra[idx + 4];
+
+ if (/* Compare the length of the
+ sequence. */
+ c1 == wextra[0]
+ /* Compare the wide char sequence. */
+ && (__wmemcmp (startp + 1,
+ &wextra[1], c1)
+ == 0))
+ /* Yep, this is the entry. */
+ break;
+# else
+ if (/* Compare the length of the
+ sequence. */
+ c1 == extra[idx]
+ /* Compare the byte sequence. */
+ && memcmp (startp + 1,
+ &extra[idx + 1], c1) == 0)
+ /* Yep, this is the entry. */
+ break;
+# endif
+ }
- if (symb_table[2 * elem] != 0)
+ if (elem < table_size)
{
- /* Compare the byte sequence but only if
- this is not part of a range. */
-# ifdef WIDE_CHAR_VERSION
- int32_t *wextra;
-
- idx += 1 + extra[idx];
- /* Adjust for the alignment. */
- idx = (idx + 3) & ~4;
-
- wextra = (int32_t *) &extra[idx + 4];
-# endif
/* Get the collation sequence value. */
is_seqval = true;
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
cend = wextra[1 + wextra[idx]];
# else
- /* Adjust for the alignment. */
idx += 1 + extra[idx];
- idx = (idx + 3) & ~4;
+ /* Adjust for the alignment. */
+ idx = (idx + 3) & ~3;
cend = *((int32_t *) &extra[idx]);
# endif
}
- else if (symb_table[2 * elem] != 0 && c1 == 1)
+ else if (c1 == 1)
{
- cend = str[0];
+ cend = startp[1];
c = *p++;
}
else
return FNM_NOMATCH;
}
-# undef str
}
else
{
@@ -799,7 +756,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
characters which are not mentioned in the
collation specification. */
if (
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
lcollseq == 0xffffffff ||
# endif
lcollseq <= fcollseq)
@@ -811,7 +768,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
hcollseq = cend;
else
{
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
hcollseq =
__collseq_table_lookup (collseq, cend);
if (hcollseq == ~((uint32_t) 0))
@@ -832,7 +789,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
if (lcollseq <= hcollseq && fcollseq <= hcollseq)
goto matched;
}
-# ifdef WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
range_not_matched:
# endif
#else
@@ -848,7 +805,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
return FNM_NOMATCH;
/* It is a range. */
- if (cold <= fn && fn <= cend)
+ if ((UCHAR) cold <= fn && fn <= cend)
goto matched;
#endif
@@ -866,11 +823,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
matched:
/* Skip the rest of the [...] that already matched. */
- do
+ while ((c = *p++) != L_(']'))
{
- ignore_next:
- c = *p++;
-
if (c == L_('\0'))
/* [... (unterminated) loses. */
return FNM_NOMATCH;
@@ -898,12 +852,11 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
if (c < L_('a') || c >= L_('z'))
{
- p = startp;
- goto ignore_next;
+ p = startp - 2;
+ break;
}
}
p += 2;
- c = *p++;
}
else if (c == L_('[') && *p == L_('='))
{
@@ -914,25 +867,21 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
if (c != L_('=') || p[1] != L_(']'))
return FNM_NOMATCH;
p += 2;
- c = *p++;
}
else if (c == L_('[') && *p == L_('.'))
{
- ++p;
while (1)
{
c = *++p;
- if (c == '\0')
+ if (c == L_('\0'))
return FNM_NOMATCH;
- if (*p == L_('.') && p[1] == L_(']'))
+ if (c == L_('.') && p[1] == L_(']'))
break;
}
p += 2;
- c = *p++;
}
}
- while (c != L_(']'));
if (not)
return FNM_NOMATCH;
}
@@ -941,11 +890,10 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
case L_('+'):
case L_('@'):
case L_('!'):
- if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
+ if (__glibc_unlikely (flags & FNM_EXTMATCH) && *p == '(')
{
- int res;
-
- res = EXT (c, p, n, string_end, no_leading_period, flags);
+ int res = EXT (c, p, n, string_end, no_leading_period, flags,
+ alloca_used);
if (res != -1)
return res;
}
@@ -983,7 +931,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
static const CHAR *
-internal_function
END (const CHAR *pattern)
{
const CHAR *p = pattern;
@@ -1013,7 +960,12 @@ END (const CHAR *pattern)
}
else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@')
|| *p == L_('!')) && p[1] == L_('('))
- p = END (p + 1);
+ {
+ p = END (p + 1);
+ if (*p == L_('\0'))
+ /* This is an invalid pattern. */
+ return pattern;
+ }
else if (*p == L_(')'))
break;
@@ -1022,29 +974,33 @@ END (const CHAR *pattern)
static int
-internal_function
EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
- bool no_leading_period, int flags)
+ bool no_leading_period, int flags, size_t alloca_used)
{
const CHAR *startp;
size_t level;
struct patternlist
{
struct patternlist *next;
+ CHAR malloced;
CHAR str[FLEXIBLE_ARRAY_MEMBER];
} *list = NULL;
struct patternlist **lastp = &list;
size_t pattern_len = STRLEN (pattern);
+ bool any_malloced = false;
const CHAR *p;
const CHAR *rs;
- enum { ALLOCA_LIMIT = 8000 };
+ int retval = 0;
/* Parse the pattern. Store the individual parts in the list. */
level = 0;
for (startp = p = pattern + 1; ; ++p)
if (*p == L_('\0'))
- /* This is an invalid pattern. */
- return -1;
+ {
+ /* This is an invalid pattern. */
+ retval = -1;
+ goto out;
+ }
else if (*p == L_('['))
{
/* Handle brackets special. */
@@ -1061,8 +1017,11 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
/* Skip over all characters of the list. */
while (*p != L_(']'))
if (*p++ == L_('\0'))
- /* This is no valid pattern. */
- return -1;
+ {
+ /* This is no valid pattern. */
+ retval = -1;
+ goto out;
+ }
}
else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@')
|| *p == L_('!')) && p[1] == L_('('))
@@ -1075,22 +1034,34 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
/* This means we found the end of the pattern. */
#define NEW_PATTERN \
struct patternlist *newp; \
- size_t plen; \
- size_t plensize; \
- size_t newpsize; \
- \
- plen = (opt == L_('?') || opt == L_('@') \
- ? pattern_len \
- : p - startp + 1UL); \
- plensize = plen * sizeof (CHAR); \
- newpsize = FLEXSIZEOF (struct patternlist, str, plensize); \
- if ((size_t) -1 / sizeof (CHAR) < plen \
- || newpsize < offsetof (struct patternlist, str) \
- || ALLOCA_LIMIT <= newpsize) \
- return -1; \
- newp = (struct patternlist *) alloca (newpsize); \
- *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L_('\0'); \
+ size_t plen = (opt == L_('?') || opt == L_('@') \
+ ? pattern_len : (p - startp + 1UL)); \
+ ptrdiff_t slen = FLEXSIZEOF (struct patternlist, str, 0); \
+ ptrdiff_t new_used = alloca_used + slen; \
+ ptrdiff_t plensize; \
+ if (INT_MULTIPLY_WRAPV (plen, sizeof (CHAR), &plensize) \
+ || INT_ADD_WRAPV (new_used, plensize, &new_used)) \
+ { \
+ retval = -2; \
+ goto out; \
+ } \
+ slen += plensize; \
+ bool malloced = ! __libc_use_alloca (new_used); \
+ if (__glibc_unlikely (malloced)) \
+ { \
+ newp = malloc (slen); \
+ if (newp == NULL) \
+ { \
+ retval = -2; \
+ goto out; \
+ } \
+ any_malloced = true; \
+ } \
+ else \
+ newp = alloca_account (slen, alloca_used); \
newp->next = NULL; \
+ newp->malloced = malloced; \
+ *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L_('\0'); \
*lastp = newp; \
lastp = &newp->next
NEW_PATTERN;
@@ -1112,8 +1083,9 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
switch (opt)
{
case L_('*'):
- if (FCT (p, string, string_end, no_leading_period, flags) == 0)
- return 0;
+ if (FCT (p, string, string_end, no_leading_period, flags, NULL,
+ alloca_used) == 0)
+ goto success;
FALLTHROUGH;
case L_('+'):
do
@@ -1122,7 +1094,8 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
/* First match the prefix with the current pattern with the
current pattern. */
if (FCT (list->str, string, rs, no_leading_period,
- flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0
+ flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
+ NULL, alloca_used) == 0
/* This was successful. Now match the rest with the rest
of the pattern. */
&& (FCT (p, rs, string_end,
@@ -1130,7 +1103,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
? no_leading_period
: rs[-1] == '/' && NO_LEADING_PERIOD (flags),
flags & FNM_FILE_NAME
- ? flags : flags & ~FNM_PERIOD) == 0
+ ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0
/* This didn't work. Try the whole pattern. */
|| (rs != string
&& FCT (pattern - 1, rs, string_end,
@@ -1138,18 +1111,21 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
? no_leading_period
: rs[-1] == '/' && NO_LEADING_PERIOD (flags),
flags & FNM_FILE_NAME
- ? flags : flags & ~FNM_PERIOD) == 0)))
+ ? flags : flags & ~FNM_PERIOD, NULL,
+ alloca_used) == 0)))
/* It worked. Signal success. */
- return 0;
+ goto success;
}
while ((list = list->next) != NULL);
/* None of the patterns lead to a match. */
- return FNM_NOMATCH;
+ retval = FNM_NOMATCH;
+ break;
case L_('?'):
- if (FCT (p, string, string_end, no_leading_period, flags) == 0)
- return 0;
+ if (FCT (p, string, string_end, no_leading_period, flags, NULL,
+ alloca_used) == 0)
+ goto success;
FALLTHROUGH;
case L_('@'):
do
@@ -1159,13 +1135,15 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
pattern list. */
if (FCT (STRCAT (list->str, p), string, string_end,
no_leading_period,
- flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0)
+ flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
+ NULL, alloca_used) == 0)
/* It worked. Signal success. */
- return 0;
+ goto success;
while ((list = list->next) != NULL);
/* None of the patterns lead to a match. */
- return FNM_NOMATCH;
+ retval = FNM_NOMATCH;
+ break;
case L_('!'):
for (rs = string; rs <= string_end; ++rs)
@@ -1174,7 +1152,8 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
for (runp = list; runp != NULL; runp = runp->next)
if (FCT (runp->str, string, rs, no_leading_period,
- flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0)
+ flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
+ NULL, alloca_used) == 0)
break;
/* If none of the patterns matched see whether the rest does. */
@@ -1183,22 +1162,35 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
rs == string
? no_leading_period
: rs[-1] == '/' && NO_LEADING_PERIOD (flags),
- flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD)
- == 0))
+ flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
+ NULL, alloca_used) == 0))
/* This is successful. */
- return 0;
+ goto success;
}
/* None of the patterns together with the rest of the pattern
lead to a match. */
- return FNM_NOMATCH;
+ retval = FNM_NOMATCH;
+ break;
default:
assert (! "Invalid extended matching operator");
+ retval = -1;
break;
}
- return -1;
+ success:
+ out:
+ if (any_malloced)
+ while (list != NULL)
+ {
+ struct patternlist *old = list;
+ list = list->next;
+ if (old->malloced)
+ free (old);
+ }
+
+ return retval;
}
@@ -1209,9 +1201,12 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
#undef FCT
#undef EXT
#undef END
+#undef STRUCT
#undef MEMPCPY
#undef MEMCHR
#undef STRLEN
#undef STRCAT
#undef L_
#undef BTOWC
+#undef WIDE_CHAR_VERSION
+#undef FINDIDX
diff --git a/gnulib/import/getcwd.c b/gnulib/import/getcwd.c
index 45470fc..1a42ef1 100644
--- a/gnulib/import/getcwd.c
+++ b/gnulib/import/getcwd.c
@@ -133,10 +133,10 @@ getcwd_nothrow (char *buf, size_t size)
#endif
/* Get the name of the current working directory, and put it in SIZE
- bytes of BUF. Returns NULL if the directory couldn't be determined or
- SIZE was too small. If successful, returns BUF. In GNU, if BUF is
- NULL, an array is allocated with 'malloc'; the array is SIZE bytes long,
- unless SIZE == 0, in which case it is as big as necessary. */
+ bytes of BUF. Returns NULL with errno set if the directory couldn't be
+ determined or SIZE was too small. If successful, returns BUF. In GNU,
+ if BUF is NULL, an array is allocated with 'malloc'; the array is SIZE
+ bytes long, unless SIZE == 0, in which case it is as big as necessary. */
char *
__getcwd (char *buf, size_t size)
diff --git a/gnulib/import/getlogin_r.c b/gnulib/import/getlogin_r.c
index 799ffa4..a461112 100644
--- a/gnulib/import/getlogin_r.c
+++ b/gnulib/import/getlogin_r.c
@@ -30,6 +30,9 @@
#if defined _WIN32 && ! defined __CYGWIN__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
+/* Don't assume that UNICODE is not defined. */
+# undef GetUserName
+# define GetUserName GetUserNameA
#else
# if !HAVE_DECL_GETLOGIN
extern char *getlogin (void);
diff --git a/gnulib/import/getprogname.c b/gnulib/import/getprogname.c
index 9f69f5a..b9667ff 100644
--- a/gnulib/import/getprogname.c
+++ b/gnulib/import/getprogname.c
@@ -223,7 +223,7 @@ getprogname (void)
int fd;
sprintf (filename, "/proc/pinfo/%d", (int) getpid ());
- fd = open (filename, O_RDONLY);
+ fd = open (filename, O_RDONLY | O_CLOEXEC);
if (0 <= fd)
{
prpsinfo_t buf;
diff --git a/gnulib/import/getrandom.c b/gnulib/import/getrandom.c
new file mode 100644
index 0000000..030a78b
--- /dev/null
+++ b/gnulib/import/getrandom.c
@@ -0,0 +1,187 @@
+/* Obtain a series of random bytes.
+
+ Copyright 2020 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
+ (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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#include <config.h>
+
+#include <sys/random.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#if defined _WIN32 && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# if HAVE_BCRYPT_H
+# include <bcrypt.h>
+# else
+# include <ntdef.h> /* NTSTATUS */
+typedef void * BCRYPT_ALG_HANDLE;
+# define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002
+# if HAVE_LIB_BCRYPT
+extern NTSTATUS WINAPI BCryptGenRandom (BCRYPT_ALG_HANDLE, UCHAR *, ULONG, ULONG);
+# endif
+# endif
+# if !HAVE_LIB_BCRYPT
+# include <wincrypt.h>
+# ifndef CRYPT_VERIFY_CONTEXT
+# define CRYPT_VERIFY_CONTEXT 0xF0000000
+# endif
+# endif
+#endif
+
+#include "minmax.h"
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+/* Don't assume that UNICODE is not defined. */
+# undef LoadLibrary
+# define LoadLibrary LoadLibraryA
+# undef CryptAcquireContext
+# define CryptAcquireContext CryptAcquireContextA
+
+# if !HAVE_LIB_BCRYPT
+
+/* Avoid warnings from gcc -Wcast-function-type. */
+# define GetProcAddress \
+ (void *) GetProcAddress
+
+/* BCryptGenRandom with the BCRYPT_USE_SYSTEM_PREFERRED_RNG flag works only
+ starting with Windows 7. */
+typedef NTSTATUS (WINAPI * BCryptGenRandomFuncType) (BCRYPT_ALG_HANDLE, UCHAR *, ULONG, ULONG);
+static BCryptGenRandomFuncType BCryptGenRandomFunc = NULL;
+static BOOL initialized = FALSE;
+
+static void
+initialize (void)
+{
+ HMODULE bcrypt = LoadLibrary ("bcrypt.dll");
+ if (bcrypt != NULL)
+ {
+ BCryptGenRandomFunc =
+ (BCryptGenRandomFuncType) GetProcAddress (bcrypt, "BCryptGenRandom");
+ }
+ initialized = TRUE;
+}
+
+# else
+
+# define BCryptGenRandomFunc BCryptGenRandom
+
+# endif
+
+#else
+/* These devices exist on all platforms except native Windows. */
+
+/* Name of a device through which the kernel returns high quality random
+ numbers, from an entropy pool. When the pool is empty, the call blocks
+ until entropy sources have added enough bits of entropy. */
+# ifndef NAME_OF_RANDOM_DEVICE
+# define NAME_OF_RANDOM_DEVICE "/dev/random"
+# endif
+
+/* Name of a device through which the kernel returns random or pseudo-random
+ numbers. It uses an entropy pool, but, in order to avoid blocking, adds
+ bits generated by a pseudo-random number generator, as needed. */
+# ifndef NAME_OF_NONCE_DEVICE
+# define NAME_OF_NONCE_DEVICE "/dev/urandom"
+# endif
+
+#endif
+
+/* Set BUFFER (of size LENGTH) to random bytes under the control of FLAGS.
+ Return the number of bytes written (> 0).
+ Upon error, return -1 and set errno. */
+ssize_t
+getrandom (void *buffer, size_t length, unsigned int flags)
+#undef getrandom
+{
+#if defined _WIN32 && ! defined __CYGWIN__
+ /* BCryptGenRandom, defined in <bcrypt.h>
+ <https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom>
+ with the BCRYPT_USE_SYSTEM_PREFERRED_RNG flag
+ works in Windows 7 and newer. */
+ static int bcrypt_not_working /* = 0 */;
+ if (!bcrypt_not_working)
+ {
+# if !HAVE_LIB_BCRYPT
+ if (!initialized)
+ initialize ();
+# endif
+ if (BCryptGenRandomFunc != NULL
+ && BCryptGenRandomFunc (NULL, buffer, length,
+ BCRYPT_USE_SYSTEM_PREFERRED_RNG)
+ == 0 /*STATUS_SUCCESS*/)
+ return length;
+ bcrypt_not_working = 1;
+ }
+# if !HAVE_LIB_BCRYPT
+ /* CryptGenRandom, defined in <wincrypt.h>
+ <https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom>
+ works in older releases as well, but is now deprecated.
+ CryptAcquireContext, defined in <wincrypt.h>
+ <https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptacquirecontexta> */
+ {
+ static int crypt_initialized /* = 0 */;
+ static HCRYPTPROV provider;
+ if (!crypt_initialized)
+ {
+ if (CryptAcquireContext (&provider, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFY_CONTEXT))
+ crypt_initialized = 1;
+ else
+ crypt_initialized = -1;
+ }
+ if (crypt_initialized >= 0)
+ {
+ if (!CryptGenRandom (provider, length, buffer))
+ {
+ errno = EIO;
+ return -1;
+ }
+ return length;
+ }
+ }
+# endif
+ errno = ENOSYS;
+ return -1;
+#elif HAVE_GETRANDOM
+ return getrandom (buffer, length, flags);
+#else
+ static int randfd[2] = { -1, -1 };
+ bool devrandom = (flags & GRND_RANDOM) != 0;
+ int fd = randfd[devrandom];
+
+ if (fd < 0)
+ {
+ static char const randdevice[][MAX (sizeof NAME_OF_NONCE_DEVICE,
+ sizeof NAME_OF_RANDOM_DEVICE)]
+ = { NAME_OF_NONCE_DEVICE, NAME_OF_RANDOM_DEVICE };
+ int oflags = (O_RDONLY + O_CLOEXEC
+ + (flags & GRND_NONBLOCK ? O_NONBLOCK : 0));
+ fd = open (randdevice[devrandom], oflags);
+ if (fd < 0)
+ return fd;
+ randfd[devrandom] = fd;
+ }
+
+ return read (fd, buffer, length);
+#endif
+}
diff --git a/gnulib/import/gettimeofday.c b/gnulib/import/gettimeofday.c
index b63f8f2..057cebd 100644
--- a/gnulib/import/gettimeofday.c
+++ b/gnulib/import/gettimeofday.c
@@ -33,9 +33,15 @@
#ifdef WINDOWS_NATIVE
+/* Don't assume that UNICODE is not defined. */
+# undef LoadLibrary
+# define LoadLibrary LoadLibraryA
+
+# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
+
/* Avoid warnings from gcc -Wcast-function-type. */
-# define GetProcAddress \
- (void *) GetProcAddress
+# define GetProcAddress \
+ (void *) GetProcAddress
/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */
typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime);
@@ -54,6 +60,12 @@ initialize (void)
initialized = TRUE;
}
+# else
+
+# define GetSystemTimePreciseAsFileTimeFunc GetSystemTimePreciseAsFileTime
+
+# endif
+
#endif
/* This is a wrapper for gettimeofday. It is used only on systems
@@ -84,8 +96,10 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz)
<http://www.windowstimestamp.com/description>. */
FILETIME current_time;
+# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
if (!initialized)
initialize ();
+# endif
if (GetSystemTimePreciseAsFileTimeFunc != NULL)
GetSystemTimePreciseAsFileTimeFunc (&current_time);
else
diff --git a/gnulib/import/glob.in.h b/gnulib/import/glob.in.h
index e0ea7b5..c80abfb 100644
--- a/gnulib/import/glob.in.h
+++ b/gnulib/import/glob.in.h
@@ -38,16 +38,17 @@
/* The definition of _GL_WARN_ON_USE is copied here. */
-/* GCC 2.95 and later have "__restrict"; C99 compilers have
+/* For plain 'restrict', use glibc's __restrict if defined.
+ Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have
"restrict", and "configure" may have defined "restrict".
Other compilers use __restrict, __restrict__, and _Restrict, and
'configure' might #define 'restrict' to those words, so pick a
different name. */
#ifndef _Restrict_
-# if 199901L <= __STDC_VERSION__
-# define _Restrict_ restrict
-# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
+# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__)
# define _Restrict_ __restrict
+# elif 199901L <= __STDC_VERSION__ || defined restrict
+# define _Restrict_ restrict
# else
# define _Restrict_
# endif
diff --git a/gnulib/import/inttypes.in.h b/gnulib/import/inttypes.in.h
index d6efc7e..9f04a6c 100644
--- a/gnulib/import/inttypes.in.h
+++ b/gnulib/import/inttypes.in.h
@@ -1093,15 +1093,19 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
# define strtoimax rpl_strtoimax
# endif
_GL_FUNCDECL_RPL (strtoimax, intmax_t,
- (const char *, char **, int) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strtoimax, intmax_t, (const char *, char **, int));
+ (const char *restrict, char **restrict, int)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoimax, intmax_t,
+ (const char *restrict, char **restrict, int));
# else
# if !@HAVE_DECL_STRTOIMAX@
# undef strtoimax
_GL_FUNCDECL_SYS (strtoimax, intmax_t,
- (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+ (const char *restrict, char **restrict, int)
+ _GL_ARG_NONNULL ((1)));
# endif
-_GL_CXXALIAS_SYS (strtoimax, intmax_t, (const char *, char **, int));
+_GL_CXXALIAS_SYS (strtoimax, intmax_t,
+ (const char *restrict, char **restrict, int));
# endif
_GL_CXXALIASWARN (strtoimax);
#elif defined GNULIB_POSIXCHECK
@@ -1119,15 +1123,19 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
# define strtoumax rpl_strtoumax
# endif
_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
- (const char *, char **, int) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strtoumax, uintmax_t, (const char *, char **, int));
+ (const char *restrict, char **restrict, int)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoumax, uintmax_t,
+ (const char *restrict, char **restrict, int));
# else
# if !@HAVE_DECL_STRTOUMAX@
# undef strtoumax
_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
- (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+ (const char *restrict, char **restrict, int)
+ _GL_ARG_NONNULL ((1)));
# endif
-_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int));
+_GL_CXXALIAS_SYS (strtoumax, uintmax_t,
+ (const char *restrict, char **restrict, int));
# endif
_GL_CXXALIASWARN (strtoumax);
#elif defined GNULIB_POSIXCHECK
diff --git a/gnulib/import/isblank.c b/gnulib/import/isblank.c
new file mode 100644
index 0000000..4899404
--- /dev/null
+++ b/gnulib/import/isblank.c
@@ -0,0 +1,33 @@
+/* Test whether a character is a blank.
+
+ Copyright (C) 2009-2020 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
+ (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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <ctype.h>
+
+int
+isblank (int c)
+{
+ /* On all known platforms, in all predefined locales, isblank(c) is likely
+ equivalent with (c == ' ' || c == '\t'). Look at the glibc definition
+ (in glibc/localedata/locales/i18n): The "blank" characters are '\t', ' ',
+ U+1680, U+180E, U+2000..U+2006, U+2008..U+200A, U+205F, U+3000, and none
+ except the first two is present in a common 8-bit encoding. Therefore
+ the substitute for other platforms is not more complicated than this. */
+ return (c == ' ' || c == '\t');
+}
diff --git a/gnulib/import/isnanl-nolibm.h b/gnulib/import/isnanl-nolibm.h
index c45e3ab..103d31a 100644
--- a/gnulib/import/isnanl-nolibm.h
+++ b/gnulib/import/isnanl-nolibm.h
@@ -17,7 +17,10 @@
#if HAVE_ISNANL_IN_LIBC
/* Get declaration of isnan macro or (older) isnanl function. */
# include <math.h>
-# if __GNUC__ >= 4
+# ifndef __has_builtin
+# define __has_builtin(name) 0
+# endif
+# if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
/* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
diff --git a/gnulib/import/libc-config.h b/gnulib/import/libc-config.h
index 124f1d7..1300c3a 100644
--- a/gnulib/import/libc-config.h
+++ b/gnulib/import/libc-config.h
@@ -180,4 +180,5 @@
/* A substitute for glibc <shlib-compat.h>, good enough for Gnulib. */
#define SHLIB_COMPAT(lib, introduced, obsoleted) 0
-#define versioned_symbol(lib, local, symbol, version)
+#define compat_symbol(lib, local, symbol, version) extern int dummy
+#define versioned_symbol(lib, local, symbol, version) extern int dummy
diff --git a/gnulib/import/limits.in.h b/gnulib/import/limits.in.h
index 90c273f..d25c523 100644
--- a/gnulib/import/limits.in.h
+++ b/gnulib/import/limits.in.h
@@ -15,16 +15,32 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */
-#ifndef _@GUARD_PREFIX@_LIMITS_H
-
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
-/* The include_next requires a split double-inclusion guard. */
+#if defined _GL_ALREADY_INCLUDING_LIMITS_H
+/* Special invocation convention:
+ On Haiku/x86_64, we have a sequence of nested includes
+ <limits.h> -> <syslimits.h> -> <limits.h>.
+ In this situation, LONG_MAX and INT_MAX are not yet defined,
+ therefore we should not attempt to define LONG_BIT. */
+
#@INCLUDE_NEXT@ @NEXT_LIMITS_H@
+#else
+/* Normal invocation convention. */
+
+#ifndef _@GUARD_PREFIX@_LIMITS_H
+
+# define _GL_ALREADY_INCLUDING_LIMITS_H
+
+/* The include_next requires a split double-inclusion guard. */
+# @INCLUDE_NEXT@ @NEXT_LIMITS_H@
+
+# undef _GL_ALREADY_INCLUDING_LIMITS_H
+
#ifndef _@GUARD_PREFIX@_LIMITS_H
#define _@GUARD_PREFIX@_LIMITS_H
@@ -102,3 +118,4 @@
#endif /* _@GUARD_PREFIX@_LIMITS_H */
#endif /* _@GUARD_PREFIX@_LIMITS_H */
+#endif
diff --git a/gnulib/import/m4/btowc.m4 b/gnulib/import/m4/btowc.m4
new file mode 100644
index 0000000..c28ccb2
--- /dev/null
+++ b/gnulib/import/m4/btowc.m4
@@ -0,0 +1,120 @@
+# btowc.m4 serial 11
+dnl Copyright (C) 2008-2020 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_FUNC_BTOWC],
+[
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+ dnl Check whether <wchar.h> is usable at all, first. Otherwise the test
+ dnl program below may lead to an endless loop. See
+ dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>.
+ AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
+
+ AC_CHECK_FUNCS_ONCE([btowc])
+ if test $ac_cv_func_btowc = no; then
+ HAVE_BTOWC=0
+ else
+
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([gt_LOCALE_FR])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ dnl Cygwin 1.7.2 btowc('\0') is WEOF, not 0.
+ AC_CACHE_CHECK([whether btowc(0) is correct],
+ [gl_cv_func_btowc_nul],
+ [
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <string.h>
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+ included before <wchar.h>. */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+int main ()
+{
+ if (btowc ('\0') != 0)
+ return 1;
+ return 0;
+}]])],
+ [gl_cv_func_btowc_nul=yes],
+ [gl_cv_func_btowc_nul=no],
+ [
+changequote(,)dnl
+ case "$host_os" in
+ # Guess no on Cygwin.
+ cygwin*) gl_cv_func_btowc_nul="guessing no" ;;
+ # Guess yes on native Windows.
+ mingw*) gl_cv_func_btowc_nul="guessing yes" ;;
+ # Guess yes otherwise.
+ *) gl_cv_func_btowc_nul="guessing yes" ;;
+ esac
+changequote([,])dnl
+ ])
+ ])
+
+ dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
+ AC_CACHE_CHECK([whether btowc(EOF) is correct],
+ [gl_cv_func_btowc_eof],
+ [
+ dnl Initial guess, used when cross-compiling or when no suitable locale
+ dnl is present.
+changequote(,)dnl
+ case "$host_os" in
+ # Guess no on IRIX.
+ irix*) gl_cv_func_btowc_eof="guessing no" ;;
+ # Guess yes on native Windows.
+ mingw*) gl_cv_func_btowc_eof="guessing yes" ;;
+ # Guess yes otherwise.
+ *) gl_cv_func_btowc_eof="guessing yes" ;;
+ esac
+changequote([,])dnl
+ if test $LOCALE_FR != none; then
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <string.h>
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+ included before <wchar.h>. */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+int main ()
+{
+ if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
+ {
+ if (btowc (EOF) != WEOF)
+ return 1;
+ }
+ return 0;
+}]])],
+ [gl_cv_func_btowc_eof=yes],
+ [gl_cv_func_btowc_eof=no],
+ [:])
+ fi
+ ])
+
+ case "$gl_cv_func_btowc_nul" in
+ *yes) ;;
+ *) REPLACE_BTOWC=1 ;;
+ esac
+ case "$gl_cv_func_btowc_eof" in
+ *yes) ;;
+ *) REPLACE_BTOWC=1 ;;
+ esac
+ fi
+])
+
+# Prerequisites of lib/btowc.c.
+AC_DEFUN([gl_PREREQ_BTOWC], [
+ :
+])
diff --git a/gnulib/import/m4/ctype.m4 b/gnulib/import/m4/ctype.m4
new file mode 100644
index 0000000..0b123d5
--- /dev/null
+++ b/gnulib/import/m4/ctype.m4
@@ -0,0 +1,32 @@
+# ctype_h.m4 serial 6
+dnl Copyright (C) 2009-2020 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_CTYPE_H],
+[
+ AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+
+ dnl <ctype.h> is always overridden, because of GNULIB_POSIXCHECK.
+ gl_NEXT_HEADERS([ctype.h])
+
+ dnl Check for declarations of anything we want to poison if the
+ dnl corresponding gnulib module is not in use.
+ gl_WARN_ON_USE_PREPARE([[#include <ctype.h>
+ ]], [isblank])
+])
+
+AC_DEFUN([gl_CTYPE_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+ gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+])
+
+AC_DEFUN([gl_CTYPE_H_DEFAULTS],
+[
+ GNULIB_ISBLANK=0; AC_SUBST([GNULIB_ISBLANK])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_ISBLANK=1; AC_SUBST([HAVE_ISBLANK])
+])
diff --git a/gnulib/import/m4/exponentl.m4 b/gnulib/import/m4/exponentl.m4
index b33b3bf..0a35c11 100644
--- a/gnulib/import/m4/exponentl.m4
+++ b/gnulib/import/m4/exponentl.m4
@@ -1,4 +1,4 @@
-# exponentl.m4 serial 4
+# exponentl.m4 serial 5
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -22,14 +22,14 @@ typedef union { long double value; unsigned int word[NWORDS]; }
memory_long_double;
static unsigned int ored_words[NWORDS];
static unsigned int anded_words[NWORDS];
-static void add_to_ored_words (long double x)
+static void add_to_ored_words (long double *x)
{
memory_long_double m;
size_t i;
/* Clear it first, in case
sizeof (long double) < sizeof (memory_long_double). */
memset (&m, 0, sizeof (memory_long_double));
- m.value = x;
+ m.value = *x;
for (i = 0; i < NWORDS; i++)
{
ored_words[i] |= m.word[i];
@@ -38,17 +38,15 @@ static void add_to_ored_words (long double x)
}
int main ()
{
+ static long double samples[5] = { 0.25L, 0.5L, 1.0L, 2.0L, 4.0L };
size_t j;
FILE *fp = fopen ("conftest.out", "w");
if (fp == NULL)
return 1;
for (j = 0; j < NWORDS; j++)
anded_words[j] = ~ (unsigned int) 0;
- add_to_ored_words (0.25L);
- add_to_ored_words (0.5L);
- add_to_ored_words (1.0L);
- add_to_ored_words (2.0L);
- add_to_ored_words (4.0L);
+ for (j = 0; j < 5; j++)
+ add_to_ored_words (&samples[j]);
/* Remove bits that are common (e.g. if representation of the first mantissa
bit is explicit). */
for (j = 0; j < NWORDS; j++)
diff --git a/gnulib/import/m4/fnmatch.m4 b/gnulib/import/m4/fnmatch.m4
index 0f41f8c..2f8e4a8 100644
--- a/gnulib/import/m4/fnmatch.m4
+++ b/gnulib/import/m4/fnmatch.m4
@@ -1,4 +1,4 @@
-# Check for fnmatch - serial 14. -*- coding: utf-8 -*-
+# Check for fnmatch - serial 15. -*- coding: utf-8 -*-
# Copyright (C) 2000-2007, 2009-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -149,7 +149,5 @@ AC_DEFUN([gl_PREREQ_FNMATCH],
[
dnl Prerequisites of lib/fnmatch.c.
AC_REQUIRE([AC_TYPE_MBSTATE_T])
- AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]])
- AC_CHECK_FUNCS_ONCE([btowc isblank iswctype mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy])
- AC_CHECK_HEADERS_ONCE([wctype.h])
+ AC_CHECK_FUNCS_ONCE([mbsrtowcs])
])
diff --git a/gnulib/import/m4/getrandom.m4 b/gnulib/import/m4/getrandom.m4
new file mode 100644
index 0000000..2a0034b
--- /dev/null
+++ b/gnulib/import/m4/getrandom.m4
@@ -0,0 +1,65 @@
+# getrandom.m4 serial 6
+dnl Copyright 2020 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 Written by Paul Eggert.
+
+AC_DEFUN([gl_FUNC_GETRANDOM],
+[
+ AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
+ AC_CHECK_FUNCS_ONCE([getrandom])
+ if test "$ac_cv_func_getrandom" != yes; then
+ HAVE_GETRANDOM=0
+ else
+ dnl On Solaris 11.4 the return type is 'int', not 'ssize_t'.
+ AC_CACHE_CHECK([whether getrandom is compatible with its GNU+BSD signature],
+ [gl_cv_func_getrandom_ok],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[/* Additional includes are needed before <sys/random.h> on Mac OS X. */
+ #include <sys/types.h>
+ #include <stdlib.h>
+ #include <sys/random.h>
+ ssize_t getrandom (void *, size_t, unsigned int);
+ ]],
+ [[]])
+ ],
+ [gl_cv_func_getrandom_ok=yes],
+ [gl_cv_func_getrandom_ok=no])
+ ])
+ if test $gl_cv_func_getrandom_ok = no; then
+ REPLACE_GETRANDOM=1
+ fi
+ fi
+
+ case "$host_os" in
+ mingw*)
+ AC_CHECK_HEADERS([bcrypt.h])
+ AC_CACHE_CHECK([whether the bcrypt library is guaranteed to be present],
+ [gl_cv_lib_assume_bcrypt],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <windows.h>]],
+ [[#if !(_WIN32_WINNT >= _WIN32_WINNT_WIN7)
+ cannot assume it
+ #endif
+ ]])
+ ],
+ [gl_cv_lib_assume_bcrypt=yes],
+ [gl_cv_lib_assume_bcrypt=no])
+ ])
+ if test $gl_cv_lib_assume_bcrypt = yes; then
+ AC_DEFINE([HAVE_LIB_BCRYPT], [1],
+ [Define to 1 if the bcrypt library is guaranteed to be present.])
+ LIB_GETRANDOM='-lbcrypt'
+ else
+ LIB_GETRANDOM='-ladvapi32'
+ fi
+ ;;
+ *)
+ LIB_GETRANDOM= ;;
+ esac
+ AC_SUBST([LIB_GETRANDOM])
+])
diff --git a/gnulib/import/m4/glob.m4 b/gnulib/import/m4/glob.m4
index dbd09e8..d4cd03f 100644
--- a/gnulib/import/m4/glob.m4
+++ b/gnulib/import/m4/glob.m4
@@ -1,4 +1,4 @@
-# glob.m4 serial 23
+# glob.m4 serial 24
dnl Copyright (C) 2005-2007, 2009-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -47,6 +47,7 @@ char a[_GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 ? 1
[[glob_t found;
if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH)
return 1;
+ globfree (&found);
]])],
[gl_cv_glob_lists_symlinks=yes],
[gl_cv_glob_lists_symlinks=no],
diff --git a/gnulib/import/m4/gnulib-cache.m4 b/gnulib/import/m4/gnulib-cache.m4
index ce00c9e..db95504 100644
--- a/gnulib/import/m4/gnulib-cache.m4
+++ b/gnulib/import/m4/gnulib-cache.m4
@@ -47,6 +47,7 @@
# fnmatch-gnu \
# frexpl \
# getcwd \
+# gettimeofday \
# glob \
# inet_ntop \
# inttypes \
@@ -87,6 +88,7 @@ gl_MODULES([
fnmatch-gnu
frexpl
getcwd
+ gettimeofday
glob
inet_ntop
inttypes
diff --git a/gnulib/import/m4/gnulib-common.m4 b/gnulib/import/m4/gnulib-common.m4
index b4795c1..f4ba5e3 100644
--- a/gnulib/import/m4/gnulib-common.m4
+++ b/gnulib/import/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 48
+# gnulib-common.m4 serial 50
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -15,6 +15,15 @@ AC_DEFUN([gl_COMMON], [
AC_REQUIRE([gl_ZZGNULIB])
])
AC_DEFUN([gl_COMMON_BODY], [
+ AH_VERBATIM([_GL_GNUC_PREREQ],
+[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */
+#if defined __GNUC__ && defined __GNUC_MINOR__
+# define _GL_GNUC_PREREQ(major, minor) \
+ ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__))
+#else
+# define _GL_GNUC_PREREQ(major, minor) 0
+#endif
+])
AH_VERBATIM([_Noreturn],
[/* The _Noreturn keyword of C11. */
#ifndef _Noreturn
@@ -31,12 +40,12 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _Noreturn [[noreturn]]
# elif ((!defined __cplusplus || defined __clang__) \
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
- || 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
+ || _GL_GNUC_PREREQ (4, 7) \
|| (defined __apple_build_version__ \
? 6000000 <= __apple_build_version__ \
: 3 < __clang_major__ + (5 <= __clang_minor__))))
/* _Noreturn works as-is. */
-# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
+# elif _GL_GNUC_PREREQ (2, 8) || 0x5110 <= __SUNPRO_C
# define _Noreturn __attribute__ ((__noreturn__))
# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
# define _Noreturn __declspec (noreturn)
@@ -55,48 +64,206 @@ AC_DEFUN([gl_COMMON_BODY], [
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
# define __GNUC_STDC_INLINE__ 1
#endif])
- AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to declarations that might not
- be used. This helps to reduce warnings, such as from
- GCC -Wunused-parameter. */
-#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_UNUSED __attribute__ ((__unused__))
+ AH_VERBATIM([attribute],
+[/* Attributes. */
+#ifdef __has_attribute
+# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
#else
-# define _GL_UNUSED
+# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
+# 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)
+# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3)
+# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95)
+# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1)
+# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3)
+# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1)
+# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0)
+# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7)
+# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6)
+# ifdef _ICC
+# define _GL_ATTR_may_alias 0
+# else
+# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3)
+# endif
+# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0)
+# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1)
+# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3)
+# 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_returns_nonnull _GL_GNUC_PREREQ (4, 9)
+# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
+# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
+# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
#endif
-/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
- is a misnomer outside of parameter lists. */
-#define _UNUSED_PARAMETER_ _GL_UNUSED
-
-/* gcc supports the "unused" attribute on possibly unused labels, and
- g++ has since version 4.5. Note to support C++ as well as C,
- _GL_UNUSED_LABEL should be used with a trailing ; */
-#if !defined __cplusplus || __GNUC__ > 4 \
- || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
-# define _GL_UNUSED_LABEL _GL_UNUSED
+
+]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead.
+[
+#if _GL_HAS_ATTRIBUTE (alloc_size)
+# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
#else
-# define _GL_UNUSED_LABEL
+# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
#endif
-/* The __pure__ attribute was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#if _GL_HAS_ATTRIBUTE (always_inline)
+# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
#else
-# define _GL_ATTRIBUTE_PURE /* empty */
+# define _GL_ATTRIBUTE_ALWAYS_INLINE
#endif
-/* The __const__ attribute was added in gcc 2.95. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#if _GL_HAS_ATTRIBUTE (artificial)
+# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
+#else
+# define _GL_ATTRIBUTE_ARTIFICIAL
+#endif
+
+/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at
+ <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. */
+#if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__
+# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__))
+#else
+# define _GL_ATTRIBUTE_COLD
+#endif
+
+#if _GL_HAS_ATTRIBUTE (const)
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
#else
-# define _GL_ATTRIBUTE_CONST /* empty */
+# define _GL_ATTRIBUTE_CONST
#endif
-/* The __malloc__ attribute was added in gcc 3. */
-#if 3 <= __GNUC__
+#if 201710L < __STDC_VERSION__
+# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
+#elif _GL_HAS_ATTRIBUTE (deprecated)
+# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
+#else
+# define _GL_ATTRIBUTE_DEPRECATED
+#endif
+
+#if _GL_HAS_ATTRIBUTE (error)
+# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
+# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
+#else
+# define _GL_ATTRIBUTE_ERROR(msg)
+# define _GL_ATTRIBUTE_WARNING(msg)
+#endif
+
+#if _GL_HAS_ATTRIBUTE (externally_visible)
+# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible))
+#else
+# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
+#endif
+
+/* FALLTHROUGH is special, because it always expands to something. */
+#if 201710L < __STDC_VERSION__
+# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
+#elif _GL_HAS_ATTRIBUTE (fallthrough)
+# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
+#else
+# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
+#endif
+
+#if _GL_HAS_ATTRIBUTE (format)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec)
+#endif
+
+#if _GL_HAS_ATTRIBUTE (leaf)
+# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__))
+#else
+# define _GL_ATTRIBUTE_LEAF
+#endif
+
+#if _GL_HAS_ATTRIBUTE (may_alias)
+# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
+#else
+# define _GL_ATTRIBUTE_MAY_ALIAS
+#endif
+
+#if 201710L < __STDC_VERSION__
+# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+#elif _GL_HAS_ATTRIBUTE (unused)
+# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
+#else
+# define _GL_ATTRIBUTE_MAYBE_UNUSED
+#endif
+/* Earlier spellings of this macro. */
+#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
+#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
+
+#if _GL_HAS_ATTRIBUTE (malloc)
# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
#else
-# define _GL_ATTRIBUTE_MALLOC /* empty */
+# define _GL_ATTRIBUTE_MALLOC
+#endif
+
+#if 201710L < __STDC_VERSION__
+# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
+#elif _GL_HAS_ATTRIBUTE (warn_unused_result)
+# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
+#else
+# define _GL_ATTRIBUTE_NODISCARD
+#endif
+
+#if _GL_HAS_ATTRIBUTE (noinline)
+# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__))
+#else
+# define _GL_ATTRIBUTE_NOINLINE
+#endif
+
+#if _GL_HAS_ATTRIBUTE (nonnull)
+# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
+#else
+# define _GL_ATTRIBUTE_NONNULL(args)
+#endif
+
+#if _GL_HAS_ATTRIBUTE (nonstring)
+# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
+#else
+# define _GL_ATTRIBUTE_NONSTRING
+#endif
+
+/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */
+
+#if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus
+# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+#else
+# define _GL_ATTRIBUTE_NOTHROW
+#endif
+
+#if _GL_HAS_ATTRIBUTE (packed)
+# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
+#else
+# define _GL_ATTRIBUTE_PACKED
+#endif
+
+#if _GL_HAS_ATTRIBUTE (pure)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE
+#endif
+
+#if _GL_HAS_ATTRIBUTE (returns_nonnull)
+# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
+#else
+# define _GL_ATTRIBUTE_RETURNS_NONNULL
+#endif
+
+#if _GL_HAS_ATTRIBUTE (sentinel)
+# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos))
+#else
+# define _GL_ATTRIBUTE_SENTINEL(pos)
+#endif
+
+]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead.
+[
+/* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */
+#if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5)
+# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_MAYBE_UNUSED
+#else
+# define _GL_UNUSED_LABEL
#endif
])
AH_VERBATIM([async_safe],
diff --git a/gnulib/import/m4/gnulib-comp.m4 b/gnulib/import/m4/gnulib-comp.m4
index 0c67b32..8c2c28e 100644
--- a/gnulib/import/m4/gnulib-comp.m4
+++ b/gnulib/import/m4/gnulib-comp.m4
@@ -49,6 +49,8 @@ AC_DEFUN([gl_EARLY],
# Code from module arpa_inet:
# Code from module assure:
# Code from module at-internal:
+ # Code from module attribute:
+ # Code from module btowc:
# Code from module builtin-expect:
# Code from module c99:
# Code from module canonicalize-lgpl:
@@ -58,12 +60,12 @@ AC_DEFUN([gl_EARLY],
# Code from module close:
# Code from module closedir:
# Code from module count-one-bits:
+ # Code from module ctype:
# Code from module d-ino:
# Code from module d-type:
# Code from module dirent:
# Code from module dirfd:
# Code from module dirname-lgpl:
- # Code from module dosname:
# Code from module double-slash-root:
# Code from module dup:
# Code from module dup2:
@@ -98,6 +100,7 @@ AC_DEFUN([gl_EARLY],
# Code from module getdtablesize:
# Code from module getlogin_r:
# Code from module getprogname:
+ # Code from module getrandom:
# Code from module gettext-h:
# Code from module gettimeofday:
# Code from module glob:
@@ -108,6 +111,7 @@ AC_DEFUN([gl_EARLY],
# Code from module intprops:
# Code from module inttypes:
# Code from module inttypes-incomplete:
+ # Code from module isblank:
# Code from module isnand-nolibm:
# Code from module isnanl-nolibm:
# Code from module largefile:
@@ -125,11 +129,13 @@ AC_DEFUN([gl_EARLY],
# Code from module mbrtowc:
# Code from module mbsinit:
# Code from module mbsrtowcs:
+ # Code from module mbtowc:
# Code from module memchr:
# Code from module memmem:
# Code from module memmem-simple:
# Code from module mempcpy:
# Code from module memrchr:
+ # Code from module minmax:
# Code from module mkdir:
# Code from module mkdtemp:
# Code from module mkostemp:
@@ -179,10 +185,12 @@ AC_DEFUN([gl_EARLY],
# Code from module strerror-override:
# Code from module strerror_r-posix:
# Code from module string:
+ # Code from module strnlen:
# Code from module strnlen1:
# Code from module strstr:
# Code from module strstr-simple:
# Code from module strtok_r:
+ # Code from module sys_random:
# Code from module sys_socket:
# Code from module sys_stat:
# Code from module sys_time:
@@ -204,6 +212,8 @@ AC_DEFUN([gl_EARLY],
# Code from module windows-once:
# Code from module windows-recmutex:
# Code from module windows-rwlock:
+ # Code from module wmemchr:
+ # Code from module wmempcpy:
# Code from module xalloc-oversized:
])
@@ -226,6 +236,13 @@ AC_DEFUN([gl_INIT],
gl_FUNC_ALLOCA
gl_HEADER_ARPA_INET
AC_PROG_MKDIR_P
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ gl_FUNC_BTOWC
+ if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then
+ AC_LIBOBJ([btowc])
+ gl_PREREQ_BTOWC
+ fi
+ gl_WCHAR_MODULE_INDICATOR([btowc])
gl___BUILTIN_EXPECT
gl_CANONICALIZE_LGPL
if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
@@ -251,6 +268,7 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([closedir])
fi
gl_DIRENT_MODULE_INDICATOR([closedir])
+ gl_CTYPE_H
gl_CHECK_TYPE_STRUCT_DIRENT_D_INO
gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
gl_DIRENT_H
@@ -376,6 +394,12 @@ AC_DEFUN([gl_INIT],
gl_UNISTD_MODULE_INDICATOR([getlogin_r])
AC_REQUIRE([gl_LIB_GETLOGIN])
gl_FUNC_GETPROGNAME
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ gl_FUNC_GETRANDOM
+ if test $HAVE_GETRANDOM = 0 || test $REPLACE_GETRANDOM = 1; then
+ AC_LIBOBJ([getrandom])
+ fi
+ gl_SYS_RANDOM_MODULE_INDICATOR([getrandom])
AC_SUBST([LIBINTL])
AC_SUBST([LTLIBINTL])
gl_FUNC_GETTIMEOFDAY
@@ -406,6 +430,12 @@ AC_DEFUN([gl_INIT],
gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
gl_INTTYPES_H
gl_INTTYPES_INCOMPLETE
+ gl_FUNC_ISBLANK
+ if test $HAVE_ISBLANK = 0; then
+ AC_LIBOBJ([isblank])
+ fi
+ gl_MODULE_INDICATOR([isblank])
+ gl_CTYPE_MODULE_INDICATOR([isblank])
gl_FUNC_ISNAND_NO_LIBM
if test $gl_func_isnand_no_libm != yes; then
AC_LIBOBJ([isnand])
@@ -465,6 +495,12 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_MBSRTOWCS
fi
gl_WCHAR_MODULE_INDICATOR([mbsrtowcs])
+ gl_FUNC_MBTOWC
+ if test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1; then
+ AC_LIBOBJ([mbtowc])
+ gl_PREREQ_MBTOWC
+ fi
+ gl_STDLIB_MODULE_INDICATOR([mbtowc])
gl_FUNC_MEMCHR
if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
AC_LIBOBJ([memchr])
@@ -492,6 +528,7 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_MEMRCHR
fi
gl_STRING_MODULE_INDICATOR([memrchr])
+ gl_MINMAX
gl_FUNC_MKDIR
if test $REPLACE_MKDIR = 1; then
AC_LIBOBJ([mkdir])
@@ -644,6 +681,12 @@ AC_DEFUN([gl_INIT],
dnl For the modules argp, error.
gl_MODULE_INDICATOR([strerror_r-posix])
gl_HEADER_STRING_H
+ gl_FUNC_STRNLEN
+ if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then
+ AC_LIBOBJ([strnlen])
+ gl_PREREQ_STRNLEN
+ fi
+ gl_STRING_MODULE_INDICATOR([strnlen])
gl_FUNC_STRSTR
if test $REPLACE_STRSTR = 1; then
AC_LIBOBJ([strstr])
@@ -659,6 +702,8 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_STRTOK_R
fi
gl_STRING_MODULE_INDICATOR([strtok_r])
+ gl_HEADER_SYS_RANDOM
+ AC_PROG_MKDIR_P
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
AC_PROG_MKDIR_P
gl_HEADER_SYS_STAT_H
@@ -712,6 +757,16 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([windows-rwlock])
;;
esac
+ gl_FUNC_WMEMCHR
+ if test $HAVE_WMEMCHR = 0; then
+ AC_LIBOBJ([wmemchr])
+ fi
+ gl_WCHAR_MODULE_INDICATOR([wmemchr])
+ gl_FUNC_WMEMPCPY
+ if test $HAVE_WMEMPCPY = 0; then
+ AC_LIBOBJ([wmempcpy])
+ fi
+ gl_WCHAR_MODULE_INDICATOR([wmempcpy])
# End of code from modules
m4_ifval(gl_LIBSOURCES_LIST, [
m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
@@ -860,7 +915,9 @@ AC_DEFUN([gl_FILE_LIST], [
lib/arpa_inet.in.h
lib/assure.h
lib/at-func.c
+ lib/attribute.h
lib/basename-lgpl.c
+ lib/btowc.c
lib/c++defs.h
lib/canonicalize-lgpl.c
lib/cdefs.h
@@ -872,12 +929,12 @@ AC_DEFUN([gl_FILE_LIST], [
lib/closedir.c
lib/count-one-bits.c
lib/count-one-bits.h
+ lib/ctype.in.h
lib/dirent-private.h
lib/dirent.in.h
lib/dirfd.c
lib/dirname-lgpl.c
lib/dirname.h
- lib/dosname.h
lib/dup-safer-flag.c
lib/dup-safer.c
lib/dup.c
@@ -916,6 +973,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/getlogin_r.c
lib/getprogname.c
lib/getprogname.h
+ lib/getrandom.c
lib/gettext.h
lib/gettimeofday.c
lib/glob-libc.h
@@ -932,6 +990,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/inet_ntop.c
lib/intprops.h
lib/inttypes.in.h
+ lib/isblank.c
lib/isnan.c
lib/isnand-nolibm.h
lib/isnand.c
@@ -964,13 +1023,16 @@ AC_DEFUN([gl_FILE_LIST], [
lib/mbsrtowcs-impl.h
lib/mbsrtowcs-state.c
lib/mbsrtowcs.c
+ lib/mbtowc-impl.h
lib/mbtowc-lock.c
lib/mbtowc-lock.h
+ lib/mbtowc.c
lib/memchr.c
lib/memchr.valgrind
lib/memmem.c
lib/mempcpy.c
lib/memrchr.c
+ lib/minmax.h
lib/mkdir.c
lib/mkdtemp.c
lib/mkostemp.c
@@ -1027,10 +1089,12 @@ AC_DEFUN([gl_FILE_LIST], [
lib/strerror_r.c
lib/string.in.h
lib/stripslash.c
+ lib/strnlen.c
lib/strnlen1.c
lib/strnlen1.h
lib/strstr.c
lib/strtok_r.c
+ lib/sys_random.in.h
lib/sys_socket.c
lib/sys_socket.in.h
lib/sys_stat.in.h
@@ -1060,18 +1124,23 @@ AC_DEFUN([gl_FILE_LIST], [
lib/windows-recmutex.h
lib/windows-rwlock.c
lib/windows-rwlock.h
+ lib/wmemchr-impl.h
+ lib/wmemchr.c
+ lib/wmempcpy.c
lib/xalloc-oversized.h
m4/00gnulib.m4
m4/__inline.m4
m4/absolute-header.m4
m4/alloca.m4
m4/arpa_inet_h.m4
+ m4/btowc.m4
m4/builtin-expect.m4
m4/canonicalize.m4
m4/chdir-long.m4
m4/close.m4
m4/closedir.m4
m4/codeset.m4
+ m4/ctype.m4
m4/d-ino.m4
m4/d-type.m4
m4/dirent_h.m4
@@ -1111,6 +1180,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/getlogin_r.m4
m4/getpagesize.m4
m4/getprogname.m4
+ m4/getrandom.m4
m4/gettimeofday.m4
m4/glob.m4
m4/glob_h.m4
@@ -1119,6 +1189,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/inet_ntop.m4
m4/inttypes-pri.m4
m4/inttypes.m4
+ m4/isblank.m4
m4/isnand.m4
m4/isnanl.m4
m4/largefile.m4
@@ -1138,10 +1209,12 @@ AC_DEFUN([gl_FILE_LIST], [
m4/mbsinit.m4
m4/mbsrtowcs.m4
m4/mbstate_t.m4
+ m4/mbtowc.m4
m4/memchr.m4
m4/memmem.m4
m4/mempcpy.m4
m4/memrchr.m4
+ m4/minmax.m4
m4/mkdir.m4
m4/mkdtemp.m4
m4/mkostemp.m4
@@ -1188,8 +1261,10 @@ AC_DEFUN([gl_FILE_LIST], [
m4/strerror.m4
m4/strerror_r.m4
m4/string_h.m4
+ m4/strnlen.m4
m4/strstr.m4
m4/strtok_r.m4
+ m4/sys_random_h.m4
m4/sys_socket_h.m4
m4/sys_stat_h.m4
m4/sys_time_h.m4
@@ -1207,5 +1282,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/wchar_t.m4
m4/wctype_h.m4
m4/wint_t.m4
+ m4/wmemchr.m4
+ m4/wmempcpy.m4
m4/zzgnulib.m4
])
diff --git a/gnulib/import/m4/inttypes.m4 b/gnulib/import/m4/inttypes.m4
index d0487d6..224d0cd 100644
--- a/gnulib/import/m4/inttypes.m4
+++ b/gnulib/import/m4/inttypes.m4
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 28
+# inttypes.m4 serial 29
dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -28,6 +28,8 @@ AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE],
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
]], [imaxabs imaxdiv strtoimax strtoumax])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
# Ensure that the PRI* and SCN* macros are defined appropriately.
diff --git a/gnulib/import/m4/isblank.m4 b/gnulib/import/m4/isblank.m4
new file mode 100644
index 0000000..5e1b783
--- /dev/null
+++ b/gnulib/import/m4/isblank.m4
@@ -0,0 +1,17 @@
+# isblank.m4 serial 3
+dnl Copyright (C) 2009-2020 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_FUNC_ISBLANK],
+[
+ dnl Persuade glibc <ctype.h> to declare isblank().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+ AC_CHECK_FUNCS_ONCE([isblank])
+ if test $ac_cv_func_isblank = no; then
+ HAVE_ISBLANK=0
+ fi
+])
diff --git a/gnulib/import/m4/isnanl.m4 b/gnulib/import/m4/isnanl.m4
index 9874418..75d5462 100644
--- a/gnulib/import/m4/isnanl.m4
+++ b/gnulib/import/m4/isnanl.m4
@@ -1,4 +1,4 @@
-# isnanl.m4 serial 20
+# isnanl.m4 serial 21
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -68,7 +68,10 @@ AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
- #if __GNUC__ >= 4
+ #ifndef __has_builtin
+ # define __has_builtin(name) 0
+ #endif
+ #if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan
@@ -93,7 +96,10 @@ AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
- #if __GNUC__ >= 4
+ #ifndef __has_builtin
+ # define __has_builtin(name) 0
+ #endif
+ #if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan
@@ -123,7 +129,10 @@ AC_DEFUN([gl_FUNC_ISNANL_WORKS],
#include <float.h>
#include <limits.h>
#include <math.h>
-#if __GNUC__ >= 4
+#ifndef __has_builtin
+# define __has_builtin(name) 0
+#endif
+#if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan
diff --git a/gnulib/import/m4/largefile.m4 b/gnulib/import/m4/largefile.m4
index e381339..8017ca7 100644
--- a/gnulib/import/m4/largefile.m4
+++ b/gnulib/import/m4/largefile.m4
@@ -113,9 +113,6 @@ if test "$enable_largefile" != no; then
[Define for large files, on AIX-style hosts.],
[_AC_SYS_LARGEFILE_TEST_INCLUDES])
fi
-
- AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1],
- [Enable large inode numbers on Mac OS X 10.5.])
fi
])# AC_SYS_LARGEFILE
])# m4_version_prereq 2.70
diff --git a/gnulib/import/m4/mbtowc.m4 b/gnulib/import/m4/mbtowc.m4
new file mode 100644
index 0000000..befcffa
--- /dev/null
+++ b/gnulib/import/m4/mbtowc.m4
@@ -0,0 +1,24 @@
+# mbtowc.m4 serial 3
+dnl Copyright (C) 2011-2020 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_FUNC_MBTOWC],
+[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+
+ AC_CHECK_FUNCS([mbtowc])
+ if test $ac_cv_func_mbtowc = no; then
+ HAVE_MBTOWC=0
+ else
+ if false; then
+ REPLACE_MBTOWC=1
+ fi
+ fi
+])
+
+# Prerequisites of lib/mbtowc.c.
+AC_DEFUN([gl_PREREQ_MBTOWC], [
+ :
+])
diff --git a/gnulib/import/m4/memmem.m4 b/gnulib/import/m4/memmem.m4
index e034d7b..35a5bb1 100644
--- a/gnulib/import/m4/memmem.m4
+++ b/gnulib/import/m4/memmem.m4
@@ -1,4 +1,4 @@
-# memmem.m4 serial 26
+# memmem.m4 serial 27
dnl Copyright (C) 2002-2004, 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -37,7 +37,7 @@ AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE],
/* Check for empty needle behavior. */
{
const char *haystack = "AAA";
- if (memmem (haystack, 3, NULL, 0) != haystack)
+ if (memmem (haystack, 3, (const char *) 1, 0) != haystack)
result |= 2;
}
return result;
diff --git a/gnulib/import/m4/minmax.m4 b/gnulib/import/m4/minmax.m4
new file mode 100644
index 0000000..e5b28b0
--- /dev/null
+++ b/gnulib/import/m4/minmax.m4
@@ -0,0 +1,44 @@
+# minmax.m4 serial 4
+dnl Copyright (C) 2005, 2009-2020 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_PREREQ([2.53])
+
+AC_DEFUN([gl_MINMAX],
+[
+ AC_REQUIRE([gl_PREREQ_MINMAX])
+])
+
+# Prerequisites of lib/minmax.h.
+AC_DEFUN([gl_PREREQ_MINMAX],
+[
+ gl_MINMAX_IN_HEADER([limits.h])
+ gl_MINMAX_IN_HEADER([sys/param.h])
+])
+
+dnl gl_MINMAX_IN_HEADER(HEADER)
+dnl The parameter has to be a literal header name; it cannot be macro,
+dnl nor a shell variable. (Because autoheader collects only AC_DEFINE
+dnl invocations with a literal macro name.)
+AC_DEFUN([gl_MINMAX_IN_HEADER],
+[
+ m4_pushdef([header], AS_TR_SH([$1]))
+ m4_pushdef([HEADER], AS_TR_CPP([$1]))
+ AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
+ [gl_cv_minmax_in_]header,
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <$1>
+ int x = MIN (42, 17);]],
+ [[]])],
+ [gl_cv_minmax_in_]header[=yes],
+ [gl_cv_minmax_in_]header[=no])])
+ if test $gl_cv_minmax_in_[]header = yes; then
+ AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
+ [Define to 1 if <$1> defines the MIN and MAX macros.])
+ fi
+ m4_popdef([HEADER])
+ m4_popdef([header])
+])
diff --git a/gnulib/import/m4/signal_h.m4 b/gnulib/import/m4/signal_h.m4
index 0868438..b262980 100644
--- a/gnulib/import/m4/signal_h.m4
+++ b/gnulib/import/m4/signal_h.m4
@@ -1,4 +1,4 @@
-# signal_h.m4 serial 18
+# signal_h.m4 serial 19
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -34,6 +34,8 @@ AC_DEFUN([gl_SIGNAL_H],
]], [pthread_sigmask sigaction
sigaddset sigdelset sigemptyset sigfillset sigismember
sigpending sigprocmask])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
diff --git a/gnulib/import/m4/stdio_h.m4 b/gnulib/import/m4/stdio_h.m4
index c603b51..5f968bc 100644
--- a/gnulib/import/m4/stdio_h.m4
+++ b/gnulib/import/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 49
+# stdio_h.m4 serial 50
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -107,6 +107,8 @@ AC_DEFUN([gl_STDIO_H],
gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen
renameat snprintf tmpfile vdprintf vsnprintf])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
diff --git a/gnulib/import/m4/stdlib_h.m4 b/gnulib/import/m4/stdlib_h.m4
index 61a3e31..743066a 100644
--- a/gnulib/import/m4/stdlib_h.m4
+++ b/gnulib/import/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 48
+# stdlib_h.m4 serial 49
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -27,6 +27,8 @@ AC_DEFUN([gl_STDLIB_H],
posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray
realpath rpmatch secure_getenv setenv setstate setstate_r srandom
srandom_r strtod strtold strtoll strtoull unlockpt unsetenv])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
diff --git a/gnulib/import/m4/string_h.m4 b/gnulib/import/m4/string_h.m4
index 4c1f685..cc51337 100644
--- a/gnulib/import/m4/string_h.m4
+++ b/gnulib/import/m4/string_h.m4
@@ -5,7 +5,7 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 22
+# serial 23
# Written by Paul Eggert.
@@ -18,7 +18,6 @@ AC_DEFUN([gl_HEADER_STRING_H],
AC_DEFUN([gl_HEADER_STRING_H_BODY],
[
- AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
gl_NEXT_HEADERS([string.h])
@@ -30,6 +29,8 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
[ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul
strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
strerror_r strsignal strverscmp])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
AC_DEFUN([gl_STRING_MODULE_INDICATOR],
diff --git a/gnulib/import/m4/strnlen.m4 b/gnulib/import/m4/strnlen.m4
new file mode 100644
index 0000000..71b8e1b
--- /dev/null
+++ b/gnulib/import/m4/strnlen.m4
@@ -0,0 +1,30 @@
+# strnlen.m4 serial 13
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2020 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.
+
+AC_DEFUN([gl_FUNC_STRNLEN],
+[
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+
+ dnl Persuade glibc <string.h> to declare strnlen().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_CHECK_DECLS_ONCE([strnlen])
+ if test $ac_cv_have_decl_strnlen = no; then
+ HAVE_DECL_STRNLEN=0
+ else
+ m4_pushdef([AC_LIBOBJ], [:])
+ dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]).
+ AC_FUNC_STRNLEN
+ m4_popdef([AC_LIBOBJ])
+ if test $ac_cv_func_strnlen_working = no; then
+ REPLACE_STRNLEN=1
+ fi
+ fi
+])
+
+# Prerequisites of lib/strnlen.c.
+AC_DEFUN([gl_PREREQ_STRNLEN], [:])
diff --git a/gnulib/import/m4/sys_random_h.m4 b/gnulib/import/m4/sys_random_h.m4
new file mode 100644
index 0000000..a964b15
--- /dev/null
+++ b/gnulib/import/m4/sys_random_h.m4
@@ -0,0 +1,52 @@
+# sys_random_h.m4 serial 4
+dnl Copyright (C) 2020 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_HEADER_SYS_RANDOM],
+[
+ AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
+ dnl <sys/random.h> is always overridden, because of GNULIB_POSIXCHECK.
+ gl_CHECK_NEXT_HEADERS([sys/random.h])
+ if test $ac_cv_header_sys_random_h = yes; then
+ HAVE_SYS_RANDOM_H=1
+ else
+ HAVE_SYS_RANDOM_H=0
+ fi
+ AC_SUBST([HAVE_SYS_RANDOM_H])
+
+ m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
+ if test $ac_cv_header_sys_random_h = yes; then
+ UNISTD_H_HAVE_SYS_RANDOM_H=1
+ fi
+
+ dnl Check for declarations of anything we want to poison if the
+ dnl corresponding gnulib module is not in use.
+ gl_WARN_ON_USE_PREPARE([[
+#if HAVE_SYS_RANDOM_H
+/* Additional includes are needed before <sys/random.h> on Mac OS X. */
+# include <sys/types.h>
+# include <stdlib.h>
+# include <sys/random.h>
+#endif
+ ]],
+ [getrandom])
+])
+
+AC_DEFUN([gl_SYS_RANDOM_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_SYS_RANDOM_H_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])
+])
+
+AC_DEFUN([gl_SYS_RANDOM_H_DEFAULTS],
+[
+ GNULIB_GETRANDOM=0; AC_SUBST([GNULIB_GETRANDOM])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_GETRANDOM=1; AC_SUBST([HAVE_GETRANDOM])
+ REPLACE_GETRANDOM=0; AC_SUBST([REPLACE_GETRANDOM])
+])
diff --git a/gnulib/import/m4/sys_socket_h.m4 b/gnulib/import/m4/sys_socket_h.m4
index 1471aea..bf902f0 100644
--- a/gnulib/import/m4/sys_socket_h.m4
+++ b/gnulib/import/m4/sys_socket_h.m4
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 24
+# sys_socket_h.m4 serial 25
dnl Copyright (C) 2005-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -95,6 +95,8 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
#include <sys/socket.h>
]], [socket connect accept bind getpeername getsockname getsockopt
listen recv send recvfrom sendto setsockopt shutdown accept4])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
diff --git a/gnulib/import/m4/sys_stat_h.m4 b/gnulib/import/m4/sys_stat_h.m4
index a5f35d4..3efba5a 100644
--- a/gnulib/import/m4/sys_stat_h.m4
+++ b/gnulib/import/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 32 -*- Autoconf -*-
+# sys_stat_h.m4 serial 33 -*- Autoconf -*-
dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -48,7 +48,9 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
mknod mknodat stat utimensat])
-]) # gl_HEADER_SYS_STAT_H
+
+ AC_REQUIRE([AC_C_RESTRICT])
+])
AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
[
@@ -92,7 +94,6 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
- REPLACE_LCHMOD=0; AC_SUBST([REPLACE_LCHMOD])
REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
diff --git a/gnulib/import/m4/time_h.m4 b/gnulib/import/m4/time_h.m4
index aae0ae2..d0f8932 100644
--- a/gnulib/import/m4/time_h.m4
+++ b/gnulib/import/m4/time_h.m4
@@ -2,7 +2,7 @@
# Copyright (C) 2000-2001, 2003-2007, 2009-2020 Free Software Foundation, Inc.
-# serial 11
+# serial 12
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,12 @@ AC_DEFUN([gl_HEADER_TIME_H],
AC_DEFUN([gl_HEADER_TIME_H_BODY],
[
- AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+
gl_NEXT_HEADERS([time.h])
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
dnl Check whether 'struct timespec' is declared
diff --git a/gnulib/import/m4/unistd_h.m4 b/gnulib/import/m4/unistd_h.m4
index ea2bb01..dfa38f8 100644
--- a/gnulib/import/m4/unistd_h.m4
+++ b/gnulib/import/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 77
+# unistd_h.m4 serial 80
dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -43,11 +43,13 @@ AC_DEFUN([gl_UNISTD_H],
#endif
]], [access chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir
fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize
- getgroups gethostname getlogin getlogin_r getpagesize getpass
+ getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass
getusershell setusershell endusershell
group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite
readlink readlinkat rmdir sethostname sleep symlink symlinkat
truncate ttyname_r unlink unlinkat usleep])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -80,6 +82,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
+ GNULIB_GETENTROPY=0; AC_SUBST([GNULIB_GETENTROPY])
GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS])
GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN])
@@ -127,6 +130,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC])
HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
+ HAVE_GETENTROPY=1; AC_SUBST([HAVE_GETENTROPY])
HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS])
HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN])
@@ -196,6 +200,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT])
REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP])
REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
+ UNISTD_H_HAVE_SYS_RANDOM_H=0; AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H])
UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
diff --git a/gnulib/import/m4/wchar_h.m4 b/gnulib/import/m4/wchar_h.m4
index d1b7228..6c4e8a6 100644
--- a/gnulib/import/m4/wchar_h.m4
+++ b/gnulib/import/m4/wchar_h.m4
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake.
-# wchar_h.m4 serial 44
+# wchar_h.m4 serial 46
AC_DEFUN([gl_WCHAR_H],
[
@@ -52,11 +52,14 @@ AC_DEFUN([gl_WCHAR_H],
#include <wchar.h>
]],
[btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
- wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset
+ wcsrtombs wcsnrtombs wcwidth
+ wmemchr wmemcmp wmemcpy wmemmove wmempcpy wmemset
wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp
wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr
wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth wcsftime
])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
dnl Check whether <wchar.h> is usable at all.
@@ -157,6 +160,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP])
GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY])
GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE])
+ GNULIB_WMEMPCPY=0; AC_SUBST([GNULIB_WMEMPCPY])
GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET])
GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN])
GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN])
@@ -196,6 +200,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP])
HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY])
HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE])
+ HAVE_WMEMPCPY=1; AC_SUBST([HAVE_WMEMPCPY])
HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET])
HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN])
HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN])
diff --git a/gnulib/import/m4/wint_t.m4 b/gnulib/import/m4/wint_t.m4
index 877fd86..5e6c178 100644
--- a/gnulib/import/m4/wint_t.m4
+++ b/gnulib/import/m4/wint_t.m4
@@ -1,4 +1,4 @@
-# wint_t.m4 serial 7
+# wint_t.m4 serial 8
dnl Copyright (C) 2003, 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -35,7 +35,7 @@ AC_DEFUN([gt_TYPE_WINT_T],
AC_CACHE_CHECK([whether wint_t is too small],
[gl_cv_type_wint_t_too_small],
[AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[
+ [AC_LANG_PROGRAM([[
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
@@ -46,10 +46,10 @@ AC_DEFUN([gt_TYPE_WINT_T],
# include <time.h>
#endif
#include <wchar.h>
- int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
- ]])],
- [gl_cv_type_wint_t_too_small=no],
- [gl_cv_type_wint_t_too_small=yes])])
+ int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
+ ]])],
+ [gl_cv_type_wint_t_too_small=no],
+ [gl_cv_type_wint_t_too_small=yes])])
if test $gl_cv_type_wint_t_too_small = yes; then
GNULIB_OVERRIDES_WINT_T=1
else
diff --git a/gnulib/import/m4/wmemchr.m4 b/gnulib/import/m4/wmemchr.m4
new file mode 100644
index 0000000..62bd89c
--- /dev/null
+++ b/gnulib/import/m4/wmemchr.m4
@@ -0,0 +1,32 @@
+# wmemchr.m4 serial 4
+dnl Copyright (C) 2011-2020 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_FUNC_WMEMCHR],
+[
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+ dnl We cannot use AC_CHECK_FUNCS here, because the MSVC 9 header files
+ dnl provide this function as an inline function definition.
+ AC_CACHE_CHECK([for wmemchr], [gl_cv_func_wmemchr],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
+ before <wchar.h>. */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+]],
+ [[return ! wmemchr ((const wchar_t *) 0, (wchar_t) ' ', 0);]])
+ ],
+ [gl_cv_func_wmemchr=yes],
+ [gl_cv_func_wmemchr=no])
+ ])
+ if test $gl_cv_func_wmemchr = no; then
+ HAVE_WMEMCHR=0
+ fi
+])
diff --git a/gnulib/import/m4/wmempcpy.m4 b/gnulib/import/m4/wmempcpy.m4
new file mode 100644
index 0000000..1795fc8
--- /dev/null
+++ b/gnulib/import/m4/wmempcpy.m4
@@ -0,0 +1,21 @@
+# wmempcpy.m4 serial 1
+dnl Copyright (C) 2020 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_FUNC_WMEMPCPY],
+[
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
+ dnl Persuade glibc <wchar.h> to declare wmempcpy().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ dnl The wmempcpy() declaration in lib/wchar.in.h uses 'restrict'.
+ AC_REQUIRE([AC_C_RESTRICT])
+
+ AC_CHECK_FUNCS_ONCE([wmempcpy])
+ if test $ac_cv_func_wmempcpy = no; then
+ HAVE_WMEMPCPY=0
+ fi
+])
diff --git a/gnulib/import/math.in.h b/gnulib/import/math.in.h
index e5e37d6..30465f8 100644
--- a/gnulib/import/math.in.h
+++ b/gnulib/import/math.in.h
@@ -127,6 +127,12 @@ static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq;
#endif
+/* For clang: Use __has_builtin to determine whether a builtin is available. */
+#ifndef __has_builtin
+# define __has_builtin(name) 0
+#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
@@ -2318,7 +2324,7 @@ _GL_WARN_REAL_FLOATING_DECL (isinf);
# if @HAVE_ISNANF@
/* The original <math.h> included above provides a declaration of isnan macro
or (older) isnanf function. */
-# if __GNUC__ >= 4
+# if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanf))
/* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnanf
# define isnanf(x) __builtin_isnanf ((float)(x))
@@ -2362,7 +2368,7 @@ _GL_EXTERN_C int isnand (double x);
# if @HAVE_ISNANL@
/* The original <math.h> included above provides a declaration of isnan
macro or (older) isnanl function. */
-# if __GNUC__ >= 4
+# if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
/* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
@@ -2385,7 +2391,7 @@ _GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
isnanf.h (e.g.) here, because those may end up being macros
that recursively expand back to isnan. So use the gnulib
replacements for them directly. */
-# if @HAVE_ISNANF@ && __GNUC__ >= 4
+# if @HAVE_ISNANF@ && __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanf))
# define gl_isnan_f(x) __builtin_isnanf ((float)(x))
# else
_GL_EXTERN_C int rpl_isnanf (float x);
@@ -2397,7 +2403,7 @@ _GL_EXTERN_C int rpl_isnanf (float x);
_GL_EXTERN_C int rpl_isnand (double x);
# define gl_isnan_d(x) rpl_isnand (x)
# endif
-# if @HAVE_ISNANL@ && __GNUC__ >= 4
+# if @HAVE_ISNANL@ && __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
# define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
# else
_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
@@ -2408,7 +2414,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
(sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
gl_isnan_f (x))
-# elif __GNUC__ >= 4
+# elif __GNUC__ >= 4 && (!defined __clang__ || (__has_builtin (__builtin_isnanf) && __has_builtin (__builtin_isnanl)))
# undef isnan
# define isnan(x) \
(sizeof (x) == sizeof (long double) ? __builtin_isnanl ((long double)(x)) : \
diff --git a/gnulib/import/mbrtowc.c b/gnulib/import/mbrtowc.c
index 6cb5267..a71d394 100644
--- a/gnulib/import/mbrtowc.c
+++ b/gnulib/import/mbrtowc.c
@@ -50,18 +50,11 @@
# endif
+# include "attribute.h"
# include "verify.h"
# include "lc-charset-dispatch.h"
# include "mbtowc-lock.h"
-# ifndef FALLTHROUGH
-# if __GNUC__ < 7
-# define FALLTHROUGH ((void) 0)
-# else
-# define FALLTHROUGH __attribute__ ((__fallthrough__))
-# endif
-# endif
-
verify (sizeof (mbstate_t) >= 4);
static char internal_state[4];
diff --git a/gnulib/import/mbtowc-impl.h b/gnulib/import/mbtowc-impl.h
new file mode 100644
index 0000000..22e414a
--- /dev/null
+++ b/gnulib/import/mbtowc-impl.h
@@ -0,0 +1,44 @@
+/* Convert multibyte character to wide character.
+ Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+ 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,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* We don't need a static internal state, because the encoding is not state
+ dependent, and when mbrtowc returns (size_t)(-2). we throw the result
+ away. */
+
+int
+mbtowc (wchar_t *pwc, const char *s, size_t n)
+{
+ if (s == NULL)
+ return 0;
+ else
+ {
+ mbstate_t state;
+ wchar_t wc;
+ size_t result;
+
+ memset (&state, 0, sizeof (mbstate_t));
+ result = mbrtowc (&wc, s, n, &state);
+ if (result == (size_t)-1 || result == (size_t)-2)
+ {
+ errno = EILSEQ;
+ return -1;
+ }
+ if (pwc != NULL)
+ *pwc = wc;
+ return (wc == 0 ? 0 : result);
+ }
+}
diff --git a/gnulib/import/mbtowc.c b/gnulib/import/mbtowc.c
new file mode 100644
index 0000000..5fc2d28
--- /dev/null
+++ b/gnulib/import/mbtowc.c
@@ -0,0 +1,26 @@
+/* Convert multibyte character to wide character.
+ Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+ 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,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include <errno.h>
+#include <string.h>
+#include <wchar.h>
+
+#include "mbtowc-impl.h"
diff --git a/gnulib/import/minmax.h b/gnulib/import/minmax.h
new file mode 100644
index 0000000..b947776
--- /dev/null
+++ b/gnulib/import/minmax.h
@@ -0,0 +1,60 @@
+/* MIN, MAX macros.
+ Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2020 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, 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
+
+#ifndef _MINMAX_H
+#define _MINMAX_H
+
+/* Note: MIN, MAX are also defined in <sys/param.h> on some systems
+ (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about
+ MIN, MAX macro redefinitions on some systems; the workaround is to
+ #include this file as the last one among the #include list. */
+
+/* Before we define the following symbols we get the <limits.h> file
+ since otherwise we get redefinitions on some systems if <limits.h> is
+ included after this file. Likewise for <sys/param.h>.
+ If more than one of these system headers define MIN and MAX, pick just
+ one of the headers (because the definitions most likely are the same). */
+#if HAVE_MINMAX_IN_LIMITS_H
+# include <limits.h>
+#elif HAVE_MINMAX_IN_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+/* Note: MIN and MAX should be used with two arguments of the
+ same type. They might not return the minimum and maximum of their two
+ arguments, if the arguments have different types or have unusual
+ floating-point values. For example, on a typical host with 32-bit 'int',
+ 64-bit 'long long', and 64-bit IEEE 754 'double' types:
+
+ MAX (-1, 2147483648) returns 4294967295.
+ MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0.
+ MAX (NaN, 0.0) returns 0.0.
+ MAX (+0.0, -0.0) returns -0.0.
+
+ and in each case the answer is in some sense bogus. */
+
+/* MAX(a,b) returns the maximum of A and B. */
+#ifndef MAX
+# define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+/* MIN(a,b) returns the minimum of A and B. */
+#ifndef MIN
+# define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#endif /* _MINMAX_H */
diff --git a/gnulib/import/open.c b/gnulib/import/open.c
index 487194f..751b42d 100644
--- a/gnulib/import/open.c
+++ b/gnulib/import/open.c
@@ -110,7 +110,9 @@ 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 | O_WRONLY | O_RDWR))
+ if ((flags & O_CREAT)
+ || (flags & O_ACCMODE) == O_RDWR
+ || (flags & O_ACCMODE) == O_WRONLY)
{
size_t len = strlen (filename);
if (len > 0 && filename[len - 1] == '/')
@@ -122,7 +124,7 @@ open (const char *filename, int flags, ...)
#endif
fd = orig_open (filename,
- flags & ~(have_cloexec <= 0 ? O_CLOEXEC : 0), mode);
+ flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode);
if (flags & O_CLOEXEC)
{
diff --git a/gnulib/import/openat-proc.c b/gnulib/import/openat-proc.c
index 9111cd3..b5aaee8 100644
--- a/gnulib/import/openat-proc.c
+++ b/gnulib/import/openat-proc.c
@@ -73,8 +73,9 @@ openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file)
problem is exhibited on code that built on Solaris 8 and
running on Solaris 10. */
- int proc_self_fd = open ("/proc/self/fd",
- O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
+ int proc_self_fd =
+ open ("/proc/self/fd",
+ O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK | O_CLOEXEC);
if (proc_self_fd < 0)
proc_status = -1;
else
diff --git a/gnulib/import/openat.c b/gnulib/import/openat.c
index d2c84e8..baf6566 100644
--- a/gnulib/import/openat.c
+++ b/gnulib/import/openat.c
@@ -100,7 +100,9 @@ rpl_openat (int dfd, char const *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 | O_WRONLY | O_RDWR))
+ if ((flags & O_CREAT)
+ || (flags & O_ACCMODE) == O_RDWR
+ || (flags & O_ACCMODE) == O_WRONLY)
{
size_t len = strlen (filename);
if (len > 0 && filename[len - 1] == '/')
@@ -112,7 +114,7 @@ rpl_openat (int dfd, char const *filename, int flags, ...)
# endif
fd = orig_openat (dfd, filename,
- flags & ~(have_cloexec <= 0 ? O_CLOEXEC : 0), mode);
+ flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode);
if (flags & O_CLOEXEC)
{
@@ -165,7 +167,7 @@ rpl_openat (int dfd, char const *filename, int flags, ...)
#else /* !HAVE_OPENAT */
-# include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+# include "filename.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
# include "openat-priv.h"
# include "save-cwd.h"
@@ -289,7 +291,7 @@ bool
openat_needs_fchdir (void)
{
bool needs_fchdir = true;
- int fd = open ("/", O_SEARCH);
+ int fd = open ("/", O_SEARCH | O_CLOEXEC);
if (0 <= fd)
{
diff --git a/gnulib/import/openat.h b/gnulib/import/openat.h
index 7589150..824ce56 100644
--- a/gnulib/import/openat.h
+++ b/gnulib/import/openat.h
@@ -52,19 +52,19 @@ _Noreturn void openat_save_fail (int);
slightly more readable than it would be with
fchownat (..., 0) or fchownat (..., AT_SYMLINK_NOFOLLOW). */
-#if GNULIB_FCHOWNAT
+#if GNULIB_CHOWNAT
-# ifndef FCHOWNAT_INLINE
-# define FCHOWNAT_INLINE _GL_INLINE
+# ifndef CHOWNAT_INLINE
+# define CHOWNAT_INLINE _GL_INLINE
# endif
-FCHOWNAT_INLINE int
+CHOWNAT_INLINE int
chownat (int fd, char const *file, uid_t owner, gid_t group)
{
return fchownat (fd, file, owner, group, 0);
}
-FCHOWNAT_INLINE int
+CHOWNAT_INLINE int
lchownat (int fd, char const *file, uid_t owner, gid_t group)
{
return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW);
@@ -72,19 +72,19 @@ lchownat (int fd, char const *file, uid_t owner, gid_t group)
#endif
-#if GNULIB_FCHMODAT
+#if GNULIB_CHMODAT
-# ifndef FCHMODAT_INLINE
-# define FCHMODAT_INLINE _GL_INLINE
+# ifndef CHMODAT_INLINE
+# define CHMODAT_INLINE _GL_INLINE
# endif
-FCHMODAT_INLINE int
+CHMODAT_INLINE int
chmodat (int fd, char const *file, mode_t mode)
{
return fchmodat (fd, file, mode, 0);
}
-FCHMODAT_INLINE int
+CHMODAT_INLINE int
lchmodat (int fd, char const *file, mode_t mode)
{
return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
diff --git a/gnulib/import/opendir.c b/gnulib/import/opendir.c
index 162ae4a..500fa44 100644
--- a/gnulib/import/opendir.c
+++ b/gnulib/import/opendir.c
@@ -45,6 +45,16 @@
# include <fcntl.h>
#endif
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined. */
+# undef WIN32_FIND_DATA
+# define WIN32_FIND_DATA WIN32_FIND_DATAA
+# undef GetFullPathName
+# define GetFullPathName GetFullPathNameA
+# undef FindFirstFile
+# define FindFirstFile FindFirstFileA
+#endif
+
DIR *
opendir (const char *dir_name)
{
diff --git a/gnulib/import/readdir.c b/gnulib/import/readdir.c
index 1a02ce4..91a3516 100644
--- a/gnulib/import/readdir.c
+++ b/gnulib/import/readdir.c
@@ -24,6 +24,10 @@
#include "dirent-private.h"
+/* Don't assume that UNICODE is not defined. */
+#undef FindNextFile
+#define FindNextFile FindNextFileA
+
struct dirent *
readdir (DIR *dirp)
{
diff --git a/gnulib/import/rename.c b/gnulib/import/rename.c
index 09881e8..108dc40 100644
--- a/gnulib/import/rename.c
+++ b/gnulib/import/rename.c
@@ -39,6 +39,10 @@
# include "dirname.h"
+/* Don't assume that UNICODE is not defined. */
+# undef MoveFileEx
+# define MoveFileEx MoveFileExA
+
/* Rename the file SRC to DST. This replacement is necessary on
Windows, on which the system rename function will not replace
an existing DST. */
diff --git a/gnulib/import/rewinddir.c b/gnulib/import/rewinddir.c
index d8ae714..a18943d 100644
--- a/gnulib/import/rewinddir.c
+++ b/gnulib/import/rewinddir.c
@@ -23,6 +23,10 @@
#include "dirent-private.h"
+/* Don't assume that UNICODE is not defined. */
+#undef FindFirstFile
+#define FindFirstFile FindFirstFileA
+
void
rewinddir (DIR *dirp)
{
diff --git a/gnulib/import/rmdir.c b/gnulib/import/rmdir.c
index 2f517cc..2155224 100644
--- a/gnulib/import/rmdir.c
+++ b/gnulib/import/rmdir.c
@@ -23,7 +23,7 @@
#include <errno.h>
#include <string.h>
-#include "dosname.h"
+#include "filename.h"
#undef rmdir
diff --git a/gnulib/import/signal.in.h b/gnulib/import/signal.in.h
index 9fe9f60..c94b053 100644
--- a/gnulib/import/signal.in.h
+++ b/gnulib/import/signal.in.h
@@ -133,16 +133,24 @@ typedef void (*sighandler_t) (int);
# define pthread_sigmask rpl_pthread_sigmask
# endif
_GL_FUNCDECL_RPL (pthread_sigmask, int,
- (int how, const sigset_t *new_mask, sigset_t *old_mask));
+ (int how,
+ const sigset_t *restrict new_mask,
+ sigset_t *restrict old_mask));
_GL_CXXALIAS_RPL (pthread_sigmask, int,
- (int how, const sigset_t *new_mask, sigset_t *old_mask));
+ (int how,
+ const sigset_t *restrict new_mask,
+ sigset_t *restrict old_mask));
# else
# if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask)
_GL_FUNCDECL_SYS (pthread_sigmask, int,
- (int how, const sigset_t *new_mask, sigset_t *old_mask));
+ (int how,
+ const sigset_t *restrict new_mask,
+ sigset_t *restrict old_mask));
# endif
_GL_CXXALIAS_SYS (pthread_sigmask, int,
- (int how, const sigset_t *new_mask, sigset_t *old_mask));
+ (int how,
+ const sigset_t *restrict new_mask,
+ sigset_t *restrict old_mask));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (pthread_sigmask);
@@ -295,10 +303,14 @@ _GL_CXXALIASWARN (sigpending);
# define SIG_SETMASK 1 /* blocked_set = *set; */
# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */
_GL_FUNCDECL_SYS (sigprocmask, int,
- (int operation, const sigset_t *set, sigset_t *old_set));
+ (int operation,
+ const sigset_t *restrict set,
+ sigset_t *restrict old_set));
# endif
_GL_CXXALIAS_SYS (sigprocmask, int,
- (int operation, const sigset_t *set, sigset_t *old_set));
+ (int operation,
+ const sigset_t *restrict set,
+ sigset_t *restrict old_set));
_GL_CXXALIASWARN (sigprocmask);
/* Install the handler FUNC for signal SIG, and return the previous
diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c
index 296ccf1..19bdfaa 100644
--- a/gnulib/import/stat-w32.c
+++ b/gnulib/import/stat-w32.c
@@ -21,8 +21,10 @@
#if defined _WIN32 && ! defined __CYGWIN__
/* Ensure that <windows.h> defines FILE_ID_INFO. */
-#undef _WIN32_WINNT
-#define _WIN32_WINNT _WIN32_WINNT_WIN8
+#if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN8
+#endif
#include <sys/types.h>
#include <sys/stat.h>
@@ -38,21 +40,29 @@
#include "pathmax.h"
#include "verify.h"
+/* Don't assume that UNICODE is not defined. */
+#undef LoadLibrary
+#define LoadLibrary LoadLibraryA
+#undef GetFinalPathNameByHandle
+#define GetFinalPathNameByHandle GetFinalPathNameByHandleA
+
+#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+
/* Avoid warnings from gcc -Wcast-function-type. */
-#define GetProcAddress \
- (void *) GetProcAddress
+# define GetProcAddress \
+ (void *) GetProcAddress
-#if _GL_WINDOWS_STAT_INODES == 2
+# if _GL_WINDOWS_STAT_INODES == 2
/* GetFileInformationByHandleEx was introduced only in Windows Vista. */
typedef DWORD (WINAPI * GetFileInformationByHandleExFuncType) (HANDLE hFile,
FILE_INFO_BY_HANDLE_CLASS fiClass,
LPVOID lpBuffer,
DWORD dwBufferSize);
static GetFileInformationByHandleExFuncType GetFileInformationByHandleExFunc = NULL;
-#endif
+# endif
/* GetFinalPathNameByHandle was introduced only in Windows Vista. */
typedef DWORD (WINAPI * GetFinalPathNameByHandleFuncType) (HANDLE hFile,
- LPTSTR lpFilePath,
+ LPSTR lpFilePath,
DWORD lenFilePath,
DWORD dwFlags);
static GetFinalPathNameByHandleFuncType GetFinalPathNameByHandleFunc = NULL;
@@ -64,16 +74,23 @@ initialize (void)
HMODULE kernel32 = LoadLibrary ("kernel32.dll");
if (kernel32 != NULL)
{
-#if _GL_WINDOWS_STAT_INODES == 2
+# if _GL_WINDOWS_STAT_INODES == 2
GetFileInformationByHandleExFunc =
(GetFileInformationByHandleExFuncType) GetProcAddress (kernel32, "GetFileInformationByHandleEx");
-#endif
+# endif
GetFinalPathNameByHandleFunc =
(GetFinalPathNameByHandleFuncType) GetProcAddress (kernel32, "GetFinalPathNameByHandleA");
}
initialized = TRUE;
}
+#else
+
+# define GetFileInformationByHandleExFunc GetFileInformationByHandleEx
+# define GetFinalPathNameByHandleFunc GetFinalPathNameByHandle
+
+#endif
+
/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */
#if _GL_WINDOWS_STAT_TIMESPEC
struct timespec
@@ -132,8 +149,10 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
DWORD type = GetFileType (h);
if (type == FILE_TYPE_DISK)
{
+#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
if (!initialized)
initialize ();
+#endif
/* st_mode can be determined through
GetFileAttributesEx
diff --git a/gnulib/import/stat.c b/gnulib/import/stat.c
index e074e6a..9d3965d 100644
--- a/gnulib/import/stat.c
+++ b/gnulib/import/stat.c
@@ -65,6 +65,13 @@ orig_stat (const char *filename, struct stat *buf)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include "stat-w32.h"
+/* Don't assume that UNICODE is not defined. */
+# undef WIN32_FIND_DATA
+# define WIN32_FIND_DATA WIN32_FIND_DATAA
+# undef CreateFile
+# define CreateFile CreateFileA
+# undef FindFirstFile
+# define FindFirstFile FindFirstFileA
#endif
#ifdef WINDOWS_NATIVE
diff --git a/gnulib/import/stdio.in.h b/gnulib/import/stdio.in.h
index ebcbfaf..6c338dd 100644
--- a/gnulib/import/stdio.in.h
+++ b/gnulib/import/stdio.in.h
@@ -62,10 +62,12 @@
We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
gnulib and libintl do '#define printf __printf__' when they override
the 'printf' function. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
+#ifndef _GL_ATTRIBUTE_FORMAT
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+# else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
+# endif
#endif
/* _GL_ATTRIBUTE_FORMAT_PRINTF
@@ -171,17 +173,17 @@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define dprintf rpl_dprintf
# endif
-_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
+_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...)
_GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
+_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
# else
# if !@HAVE_DPRINTF@
-_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
+_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...)
_GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
_GL_ARG_NONNULL ((2)));
# endif
-_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
+_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...));
# endif
_GL_CXXALIASWARN (dprintf);
#elif defined GNULIB_POSIXCHECK
@@ -281,11 +283,14 @@ _GL_CXXALIASWARN (fgetc);
# undef fgets
# define fgets rpl_fgets
# endif
-_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
- _GL_ARG_NONNULL ((1, 3)));
-_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
+_GL_FUNCDECL_RPL (fgets, char *,
+ (char *restrict s, int n, FILE *restrict stream)
+ _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (fgets, char *,
+ (char *restrict s, int n, FILE *restrict stream));
# else
-_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
+_GL_CXXALIAS_SYS (fgets, char *,
+ (char *restrict s, int n, FILE *restrict stream));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fgets);
@@ -298,11 +303,14 @@ _GL_CXXALIASWARN (fgets);
# undef fopen
# define fopen rpl_fopen
# endif
-_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
+_GL_FUNCDECL_RPL (fopen, FILE *,
+ (const char *restrict filename, const char *restrict mode)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fopen, FILE *,
+ (const char *restrict filename, const char *restrict mode));
# else
-_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
+_GL_CXXALIAS_SYS (fopen, FILE *,
+ (const char *restrict filename, const char *restrict mode));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fopen);
@@ -322,17 +330,21 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian
# endif
# define GNULIB_overrides_fprintf 1
# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
+_GL_FUNCDECL_RPL (fprintf, int,
+ (FILE *restrict fp, const char *restrict format, ...)
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
# else
-_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
+_GL_FUNCDECL_RPL (fprintf, int,
+ (FILE *restrict fp, const char *restrict format, ...)
+ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
# endif
-_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
+_GL_CXXALIAS_RPL (fprintf, int,
+ (FILE *restrict fp, const char *restrict format, ...));
# else
-_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
+_GL_CXXALIAS_SYS (fprintf, int,
+ (FILE *restrict fp, const char *restrict format, ...));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fprintf);
@@ -398,11 +410,14 @@ _GL_CXXALIASWARN (fputc);
# undef fputs
# define fputs rpl_fputs
# endif
-_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
+_GL_FUNCDECL_RPL (fputs, int,
+ (const char *restrict string, FILE *restrict stream)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fputs, int,
+ (const char *restrict string, FILE *restrict stream));
# else
-_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
+_GL_CXXALIAS_SYS (fputs, int,
+ (const char *restrict string, FILE *restrict stream));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fputs);
@@ -415,11 +430,17 @@ _GL_CXXALIASWARN (fputs);
# undef fread
# define fread rpl_fread
# endif
-_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
- _GL_ARG_NONNULL ((4)));
-_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
+_GL_FUNCDECL_RPL (fread, size_t,
+ (void *restrict ptr, size_t s, size_t n,
+ FILE *restrict stream)
+ _GL_ARG_NONNULL ((4)));
+_GL_CXXALIAS_RPL (fread, size_t,
+ (void *restrict ptr, size_t s, size_t n,
+ FILE *restrict stream));
# else
-_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
+_GL_CXXALIAS_SYS (fread, size_t,
+ (void *restrict ptr, size_t s, size_t n,
+ FILE *restrict stream));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fread);
@@ -433,13 +454,16 @@ _GL_CXXALIASWARN (fread);
# define freopen rpl_freopen
# endif
_GL_FUNCDECL_RPL (freopen, FILE *,
- (const char *filename, const char *mode, FILE *stream)
+ (const char *restrict filename, const char *restrict mode,
+ FILE *restrict stream)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (freopen, FILE *,
- (const char *filename, const char *mode, FILE *stream));
+ (const char *restrict filename, const char *restrict mode,
+ FILE *restrict stream));
# else
_GL_CXXALIAS_SYS (freopen, FILE *,
- (const char *filename, const char *mode, FILE *stream));
+ (const char *restrict filename, const char *restrict mode,
+ FILE *restrict stream));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (freopen);
@@ -458,12 +482,15 @@ _GL_WARN_ON_USE (freopen,
# undef fscanf
# define fscanf rpl_fscanf
# endif
-_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
+_GL_FUNCDECL_RPL (fscanf, int,
+ (FILE *restrict stream, const char *restrict format, ...)
+ _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fscanf, int,
+ (FILE *restrict stream, const char *restrict format, ...));
# else
-_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
+_GL_CXXALIAS_SYS (fscanf, int,
+ (FILE *restrict stream, const char *restrict format, ...));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fscanf);
@@ -634,13 +661,16 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
# define fwrite rpl_fwrite
# endif
_GL_FUNCDECL_RPL (fwrite, size_t,
- (const void *ptr, size_t s, size_t n, FILE *stream)
+ (const void *restrict ptr, size_t s, size_t n,
+ FILE *restrict stream)
_GL_ARG_NONNULL ((1, 4)));
_GL_CXXALIAS_RPL (fwrite, size_t,
- (const void *ptr, size_t s, size_t n, FILE *stream));
+ (const void *restrict ptr, size_t s, size_t n,
+ FILE *restrict stream));
# else
_GL_CXXALIAS_SYS (fwrite, size_t,
- (const void *ptr, size_t s, size_t n, FILE *stream));
+ (const void *restrict ptr, size_t s, size_t n,
+ FILE *restrict stream));
/* Work around bug 11959 when fortifying glibc 2.4 through 2.15
<https://sourceware.org/bugzilla/show_bug.cgi?id=11959>,
@@ -715,22 +745,26 @@ _GL_CXXALIASWARN (getchar);
# define getdelim rpl_getdelim
# endif
_GL_FUNCDECL_RPL (getdelim, ssize_t,
- (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream)
+ (char **restrict lineptr, size_t *restrict linesize,
+ int delimiter,
+ FILE *restrict stream)
_GL_ARG_NONNULL ((1, 2, 4)));
_GL_CXXALIAS_RPL (getdelim, ssize_t,
- (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream));
+ (char **restrict lineptr, size_t *restrict linesize,
+ int delimiter,
+ FILE *restrict stream));
# else
# if !@HAVE_DECL_GETDELIM@
_GL_FUNCDECL_SYS (getdelim, ssize_t,
- (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream)
+ (char **restrict lineptr, size_t *restrict linesize,
+ int delimiter,
+ FILE *restrict stream)
_GL_ARG_NONNULL ((1, 2, 4)));
# endif
_GL_CXXALIAS_SYS (getdelim, ssize_t,
- (char **lineptr, size_t *linesize, int delimiter,
- FILE *stream));
+ (char **restrict lineptr, size_t *restrict linesize,
+ int delimiter,
+ FILE *restrict stream));
# endif
_GL_CXXALIASWARN (getdelim);
#elif defined GNULIB_POSIXCHECK
@@ -754,18 +788,22 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
# define getline rpl_getline
# endif
_GL_FUNCDECL_RPL (getline, ssize_t,
- (char **lineptr, size_t *linesize, FILE *stream)
+ (char **restrict lineptr, size_t *restrict linesize,
+ FILE *restrict stream)
_GL_ARG_NONNULL ((1, 2, 3)));
_GL_CXXALIAS_RPL (getline, ssize_t,
- (char **lineptr, size_t *linesize, FILE *stream));
+ (char **restrict lineptr, size_t *restrict linesize,
+ FILE *restrict stream));
# else
# if !@HAVE_DECL_GETLINE@
_GL_FUNCDECL_SYS (getline, ssize_t,
- (char **lineptr, size_t *linesize, FILE *stream)
+ (char **restrict lineptr, size_t *restrict linesize,
+ FILE *restrict stream)
_GL_ARG_NONNULL ((1, 2, 3)));
# endif
_GL_CXXALIAS_SYS (getline, ssize_t,
- (char **lineptr, size_t *linesize, FILE *stream));
+ (char **restrict lineptr, size_t *restrict linesize,
+ FILE *restrict stream));
# endif
# if @HAVE_DECL_GETLINE@
_GL_CXXALIASWARN (getline);
@@ -909,14 +947,14 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
# endif
# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
_GL_FUNCDECL_RPL_1 (__printf__, int,
- (const char *format, ...)
+ (const char *restrict format, ...)
__asm__ (@ASM_SYMBOL_PREFIX@
_GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
_GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
_GL_ARG_NONNULL ((1)));
# else
_GL_FUNCDECL_RPL_1 (__printf__, int,
- (const char *format, ...)
+ (const char *restrict format, ...)
__asm__ (@ASM_SYMBOL_PREFIX@
_GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
_GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
@@ -928,14 +966,14 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
# define printf rpl_printf
# endif
_GL_FUNCDECL_RPL (printf, int,
- (const char *format, ...)
+ (const char *restrict format, ...)
_GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
_GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
+_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
# endif
# define GNULIB_overrides_printf 1
# else
-_GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
+_GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (printf);
@@ -1083,24 +1121,24 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
# define scanf __scanf__
# endif
_GL_FUNCDECL_RPL_1 (__scanf__, int,
- (const char *format, ...)
+ (const char *restrict format, ...)
__asm__ (@ASM_SYMBOL_PREFIX@
_GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
_GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
+_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 *format, ...)
+_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...)
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
_GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
+_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
# endif
# else
-_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
+_GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (scanf);
@@ -1113,20 +1151,24 @@ _GL_CXXALIASWARN (scanf);
# define snprintf rpl_snprintf
# endif
_GL_FUNCDECL_RPL (snprintf, int,
- (char *str, size_t size, const char *format, ...)
+ (char *restrict str, size_t size,
+ const char *restrict format, ...)
_GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
_GL_ARG_NONNULL ((3)));
_GL_CXXALIAS_RPL (snprintf, int,
- (char *str, size_t size, const char *format, ...));
+ (char *restrict str, size_t size,
+ const char *restrict format, ...));
# else
# if !@HAVE_DECL_SNPRINTF@
_GL_FUNCDECL_SYS (snprintf, int,
- (char *str, size_t size, const char *format, ...)
+ (char *restrict str, size_t size,
+ const char *restrict format, ...)
_GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
_GL_ARG_NONNULL ((3)));
# endif
_GL_CXXALIAS_SYS (snprintf, int,
- (char *str, size_t size, const char *format, ...));
+ (char *restrict str, size_t size,
+ const char *restrict format, ...));
# endif
_GL_CXXALIASWARN (snprintf);
#elif defined GNULIB_POSIXCHECK
@@ -1151,12 +1193,15 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define sprintf rpl_sprintf
# endif
-_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
+_GL_FUNCDECL_RPL (sprintf, int,
+ (char *restrict str, const char *restrict format, ...)
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (sprintf, int,
+ (char *restrict str, const char *restrict format, ...));
# else
-_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
+_GL_CXXALIAS_SYS (sprintf, int,
+ (char *restrict str, const char *restrict format, ...));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (sprintf);
@@ -1244,20 +1289,23 @@ _GL_CXXALIASWARN (vasprintf);
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define vdprintf rpl_vdprintf
# endif
-_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
+_GL_FUNCDECL_RPL (vdprintf, int,
+ (int fd, const char *restrict format, va_list args)
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (vdprintf, int,
+ (int fd, const char *restrict format, va_list args));
# else
# if !@HAVE_VDPRINTF@
-_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((2)));
+_GL_FUNCDECL_SYS (vdprintf, int,
+ (int fd, const char *restrict format, va_list args)
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+ _GL_ARG_NONNULL ((2)));
# endif
/* Need to cast, because on Solaris, the third parameter will likely be
__va_list args. */
_GL_CXXALIAS_SYS_CAST (vdprintf, int,
- (int fd, const char *format, va_list args));
+ (int fd, const char *restrict format, va_list args));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vdprintf);
@@ -1278,21 +1326,28 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
# endif
# define GNULIB_overrides_vfprintf 1
# if @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
+_GL_FUNCDECL_RPL (vfprintf, int,
+ (FILE *restrict fp,
+ const char *restrict format, va_list args)
+ _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
+ _GL_ARG_NONNULL ((1, 2)));
# else
-_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
- _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
+_GL_FUNCDECL_RPL (vfprintf, int,
+ (FILE *restrict fp,
+ const char *restrict format, va_list args)
+ _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
+ _GL_ARG_NONNULL ((1, 2)));
# endif
-_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
+_GL_CXXALIAS_RPL (vfprintf, int,
+ (FILE *restrict fp,
+ const char *restrict format, va_list args));
# else
/* Need to cast, because on Solaris, the third parameter is
__va_list args
and GCC's fixincludes did not change this to __gnuc_va_list. */
_GL_CXXALIAS_SYS_CAST (vfprintf, int,
- (FILE *fp, const char *format, va_list args));
+ (FILE *restrict fp,
+ const char *restrict format, va_list args));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vfprintf);
@@ -1315,14 +1370,17 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
# define vfscanf rpl_vfscanf
# endif
_GL_FUNCDECL_RPL (vfscanf, int,
- (FILE *stream, const char *format, va_list args)
+ (FILE *restrict stream,
+ const char *restrict format, va_list args)
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (vfscanf, int,
- (FILE *stream, const char *format, va_list args));
+ (FILE *restrict stream,
+ const char *restrict format, va_list args));
# else
_GL_CXXALIAS_SYS (vfscanf, int,
- (FILE *stream, const char *format, va_list args));
+ (FILE *restrict stream,
+ const char *restrict format, va_list args));
# endif
_GL_CXXALIASWARN (vfscanf);
#endif
@@ -1335,20 +1393,21 @@ _GL_CXXALIASWARN (vfscanf);
# endif
# define GNULIB_overrides_vprintf 1
# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
+_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
_GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
_GL_ARG_NONNULL ((1)));
# else
-_GL_FUNCDECL_RPL (vprintf, int, (const char *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
-_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
+_GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args));
# else
/* Need to cast, because on Solaris, the second parameter is
__va_list args
and GCC's fixincludes did not change this to __gnuc_va_list. */
-_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
+_GL_CXXALIAS_SYS_CAST (vprintf, int,
+ (const char *restrict format, va_list args));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vprintf);
@@ -1370,12 +1429,12 @@ _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 *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_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
+_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
# else
-_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
+_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
# endif
_GL_CXXALIASWARN (vscanf);
#endif
@@ -1386,20 +1445,24 @@ _GL_CXXALIASWARN (vscanf);
# define vsnprintf rpl_vsnprintf
# endif
_GL_FUNCDECL_RPL (vsnprintf, int,
- (char *str, size_t size, const char *format, va_list args)
+ (char *restrict str, size_t size,
+ const char *restrict format, va_list args)
_GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
_GL_ARG_NONNULL ((3)));
_GL_CXXALIAS_RPL (vsnprintf, int,
- (char *str, size_t size, const char *format, va_list args));
+ (char *restrict str, size_t size,
+ const char *restrict format, va_list args));
# else
# if !@HAVE_DECL_VSNPRINTF@
_GL_FUNCDECL_SYS (vsnprintf, int,
- (char *str, size_t size, const char *format, va_list args)
+ (char *restrict str, size_t size,
+ const char *restrict format, va_list args)
_GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
_GL_ARG_NONNULL ((3)));
# endif
_GL_CXXALIAS_SYS (vsnprintf, int,
- (char *str, size_t size, const char *format, va_list args));
+ (char *restrict str, size_t size,
+ const char *restrict format, va_list args));
# endif
_GL_CXXALIASWARN (vsnprintf);
#elif defined GNULIB_POSIXCHECK
@@ -1416,17 +1479,20 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
# define vsprintf rpl_vsprintf
# endif
_GL_FUNCDECL_RPL (vsprintf, int,
- (char *str, const char *format, va_list args)
+ (char *restrict str,
+ const char *restrict format, va_list args)
_GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (vsprintf, int,
- (char *str, const char *format, va_list args));
+ (char *restrict str,
+ const char *restrict format, va_list args));
# else
/* Need to cast, because on Solaris, the third parameter is
__va_list args
and GCC's fixincludes did not change this to __gnuc_va_list. */
_GL_CXXALIAS_SYS_CAST (vsprintf, int,
- (char *str, const char *format, va_list args));
+ (char *restrict str,
+ const char *restrict format, va_list args));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (vsprintf);
diff --git a/gnulib/import/stdlib.in.h b/gnulib/import/stdlib.in.h
index 49bbf6f..59f9e6c 100644
--- a/gnulib/import/stdlib.in.h
+++ b/gnulib/import/stdlib.in.h
@@ -101,10 +101,12 @@ struct random_data
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE /* empty */
+# endif
#endif
/* The definition of _Noreturn is copied here. */
@@ -311,13 +313,17 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
# undef mbtowc
# define mbtowc rpl_mbtowc
# endif
-_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
-_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+_GL_FUNCDECL_RPL (mbtowc, int,
+ (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 *pwc, const char *s, size_t n));
+_GL_FUNCDECL_SYS (mbtowc, int,
+ (wchar_t *restrict pwc, const char *restrict s, size_t n));
# endif
-_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+_GL_CXXALIAS_SYS (mbtowc, int,
+ (wchar_t *restrict pwc, const char *restrict s, size_t n));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (mbtowc);
@@ -866,15 +872,19 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define realpath rpl_realpath
# endif
-_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
+_GL_FUNCDECL_RPL (realpath, char *,
+ (const char *restrict name, char *restrict resolved)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (realpath, char *,
+ (const char *restrict name, char *restrict resolved));
# else
# if !@HAVE_REALPATH@
-_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (realpath, char *,
+ (const char *restrict name, char *restrict resolved)
+ _GL_ARG_NONNULL ((1)));
# endif
-_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
+_GL_CXXALIAS_SYS (realpath, char *,
+ (const char *restrict name, char *restrict resolved));
# endif
_GL_CXXALIASWARN (realpath);
#elif defined GNULIB_POSIXCHECK
@@ -957,15 +967,19 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
# define strtod rpl_strtod
# endif
# define GNULIB_defined_strtod_function 1
-_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
+_GL_FUNCDECL_RPL (strtod, double,
+ (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 *str, char **endp)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (strtod, double,
+ (const char *restrict str, char **restrict endp)
+ _GL_ARG_NONNULL ((1)));
# endif
-_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
+_GL_CXXALIAS_SYS (strtod, double,
+ (const char *restrict str, char **restrict endp));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strtod);
@@ -985,15 +999,19 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
# define strtold rpl_strtold
# endif
# define GNULIB_defined_strtold_function 1
-_GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp));
+_GL_FUNCDECL_RPL (strtold, long double,
+ (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 *str, char **endp)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (strtold, long double,
+ (const char *restrict str, char **restrict endp)
+ _GL_ARG_NONNULL ((1)));
# endif
-_GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp));
+_GL_CXXALIAS_SYS (strtold, long double,
+ (const char *restrict str, char **restrict endp));
# endif
_GL_CXXALIASWARN (strtold);
#elif defined GNULIB_POSIXCHECK
@@ -1015,11 +1033,13 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - "
to ERANGE. */
# if !@HAVE_STRTOLL@
_GL_FUNCDECL_SYS (strtoll, long long,
- (const char *string, char **endptr, int base)
+ (const char *restrict string, char **restrict endptr,
+ int base)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtoll, long long,
- (const char *string, char **endptr, int base));
+ (const char *restrict string, char **restrict endptr,
+ int base));
_GL_CXXALIASWARN (strtoll);
#elif defined GNULIB_POSIXCHECK
# undef strtoll
@@ -1040,11 +1060,13 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
ERANGE. */
# if !@HAVE_STRTOULL@
_GL_FUNCDECL_SYS (strtoull, unsigned long long,
- (const char *string, char **endptr, int base)
+ (const char *restrict string, char **restrict endptr,
+ int base)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtoull, unsigned long long,
- (const char *string, char **endptr, int base));
+ (const char *restrict string, char **restrict endptr,
+ int base));
_GL_CXXALIASWARN (strtoull);
#elif defined GNULIB_POSIXCHECK
# undef strtoull
diff --git a/gnulib/import/string.in.h b/gnulib/import/string.in.h
index 2c04e5f..a08e705 100644
--- a/gnulib/import/string.in.h
+++ b/gnulib/import/string.in.h
@@ -54,10 +54,12 @@
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE /* empty */
+# endif
#endif
/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
@@ -332,9 +334,10 @@ _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
GB18030 and the character to be searched is a digit. */
# undef strchr
/* Assume strchr is always declared. */
-_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
- "in some multibyte locales - "
- "use mbschr if you care about internationalization");
+_GL_WARN_ON_USE_CXX (strchr, const char *, (const char *, int),
+ "strchr cannot work correctly on character strings "
+ "in some multibyte locales - "
+ "use mbschr if you care about internationalization");
#endif
/* Find the first occurrence of C in S or the final NUL byte. */
@@ -411,11 +414,14 @@ _GL_WARN_ON_USE (strdup, "strdup is unportable - "
# undef strncat
# define strncat rpl_strncat
# endif
-_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
+_GL_FUNCDECL_RPL (strncat, char *,
+ (char *restrict dest, const char *restrict src, size_t n)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strncat, char *,
+ (char *restrict dest, const char *restrict src, size_t n));
# else
-_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
+_GL_CXXALIAS_SYS (strncat, char *,
+ (char *restrict dest, const char *restrict src, size_t n));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strncat);
@@ -523,15 +529,17 @@ _GL_CXXALIASWARN (strpbrk);
locale encoding is GB18030 and one of the characters to be searched is a
digit. */
# undef strpbrk
-_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
- "in multibyte locales - "
- "use mbspbrk if you care about internationalization");
+_GL_WARN_ON_USE_CXX (strpbrk, const char *, (const char *, const char *),
+ "strpbrk cannot work correctly on character strings "
+ "in multibyte locales - "
+ "use mbspbrk if you care about internationalization");
# endif
#elif defined GNULIB_POSIXCHECK
# undef strpbrk
# if HAVE_RAW_DECL_STRPBRK
-_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
- "use gnulib module strpbrk for portability");
+_GL_WARN_ON_USE_CXX (strpbrk, const char *, (const char *, const char *),
+ "strpbrk is unportable - "
+ "use gnulib module strpbrk for portability");
# endif
#endif
@@ -550,9 +558,10 @@ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
GB18030 and the character to be searched is a digit. */
# undef strrchr
/* Assume strrchr is always declared. */
-_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
- "in some multibyte locales - "
- "use mbsrchr if you care about internationalization");
+_GL_WARN_ON_USE_CXX (strrchr, const char *, (const char *, int),
+ "strrchr cannot work correctly on character strings "
+ "in some multibyte locales - "
+ "use mbsrchr if you care about internationalization");
#endif
/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -966,7 +975,8 @@ _GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
Caveat: The identity of the delimiting character is lost.
See also mbssep(). */
-_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr)
+_GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
+ char **save_ptr)
_GL_ARG_NONNULL ((2, 3));
#endif
diff --git a/gnulib/import/strnlen.c b/gnulib/import/strnlen.c
new file mode 100644
index 0000000..dcecf08
--- /dev/null
+++ b/gnulib/import/strnlen.c
@@ -0,0 +1,30 @@
+/* Find the length of STRING, but scan at most MAXLEN characters.
+ Copyright (C) 2005-2007, 2009-2020 Free Software Foundation, Inc.
+ Written by Simon Josefsson.
+
+ 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, 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <string.h>
+
+/* Find the length of STRING, but scan at most MAXLEN characters.
+ If no '\0' terminator is found in that many characters, return MAXLEN. */
+
+size_t
+strnlen (const char *string, size_t maxlen)
+{
+ const char *end = memchr (string, '\0', maxlen);
+ return end ? (size_t) (end - string) : maxlen;
+}
diff --git a/gnulib/import/sys_random.in.h b/gnulib/import/sys_random.in.h
new file mode 100644
index 0000000..f14ac1f
--- /dev/null
+++ b/gnulib/import/sys_random.in.h
@@ -0,0 +1,92 @@
+/* Substitute for <sys/random.h>.
+ Copyright (C) 2020 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, 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
+
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+@PRAGMA_COLUMNS@
+
+#ifndef _@GUARD_PREFIX@_SYS_RANDOM_H
+
+#if @HAVE_SYS_RANDOM_H@
+
+/* On Mac OS X 10.5, <sys/random.h> assumes prior inclusion of <sys/types.h>.
+ On Max OS X 10.13, <sys/random.h> assumes prior inclusion of a file that
+ includes <Availability.h>, such as <stdlib.h> or <unistd.h>. */
+# if defined __APPLE__ && defined __MACH__ /* Mac OS X */
+# include <sys/types.h>
+# include <stdlib.h>
+# endif
+
+/* The include_next requires a split double-inclusion guard. */
+# @INCLUDE_NEXT@ @NEXT_SYS_RANDOM_H@
+
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_RANDOM_H
+#define _@GUARD_PREFIX@_SYS_RANDOM_H
+
+#include <sys/types.h>
+
+/* Define the GRND_* constants. */
+#ifndef GRND_NONBLOCK
+# define GRND_NONBLOCK 1
+# define GRND_RANDOM 2
+#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. */
+
+
+/* Declare overridden functions. */
+
+
+#if @GNULIB_GETRANDOM@
+/* Fill a buffer with random bytes. */
+# if @REPLACE_GETRANDOM@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getrandom
+# define getrandom rpl_getrandom
+# endif
+_GL_FUNCDECL_RPL (getrandom, ssize_t,
+ (void *buffer, size_t length, unsigned int flags)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (getrandom, ssize_t,
+ (void *buffer, size_t length, unsigned int flags));
+# else
+# if !@HAVE_GETRANDOM@
+_GL_FUNCDECL_SYS (getrandom, ssize_t,
+ (void *buffer, size_t length, unsigned int flags)
+ _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (getrandom, ssize_t,
+ (void *buffer, size_t length, unsigned int flags));
+# endif
+_GL_CXXALIASWARN (getrandom);
+#elif defined GNULIB_POSIXCHECK
+# undef getrandom
+# if HAVE_RAW_DECL_GETRANDOM
+_GL_WARN_ON_USE (getrandom, "getrandom is unportable - "
+ "use gnulib module getrandom for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_RANDOM_H */
+#endif /* _@GUARD_PREFIX@_SYS_RANDOM_H */
diff --git a/gnulib/import/sys_socket.in.h b/gnulib/import/sys_socket.in.h
index 41f71f6..88ac5f0 100644
--- a/gnulib/import/sys_socket.in.h
+++ b/gnulib/import/sys_socket.in.h
@@ -195,12 +195,7 @@ struct sockaddr_storage
/* Include headers needed by the emulation code. */
# include <sys/types.h>
# include <io.h>
-
-# if !GNULIB_defined_socklen_t
-typedef int socklen_t;
-# define GNULIB_defined_socklen_t 1
-# endif
-
+/* If these headers don't define socklen_t, <config.h> does. */
# endif
/* Rudimentary 'struct msghdr'; this works as long as you don't try to
@@ -346,14 +341,20 @@ _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
# define accept rpl_accept
# endif
_GL_FUNCDECL_RPL (accept, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
+ (int fd,
+ struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen));
_GL_CXXALIAS_RPL (accept, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
+ (int fd,
+ struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen));
# else
/* Need to cast, because on Solaris 10 systems, the third parameter is
- void *addrlen. */
+ void *addrlen. */
_GL_CXXALIAS_SYS_CAST (accept, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
+ (int fd,
+ struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen));
# endif
_GL_CXXALIASWARN (accept);
#elif @HAVE_WINSOCK2_H@
@@ -404,15 +405,18 @@ _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
# define getpeername rpl_getpeername
# endif
_GL_FUNCDECL_RPL (getpeername, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen)
+ (int fd, struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (getpeername, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
+ (int fd, struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen));
# else
/* Need to cast, because on Solaris 10 systems, the third parameter is
- void *addrlen. */
+ void *addrlen. */
_GL_CXXALIAS_SYS_CAST (getpeername, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
+ (int fd, struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen));
# endif
_GL_CXXALIASWARN (getpeername);
#elif @HAVE_WINSOCK2_H@
@@ -433,15 +437,18 @@ _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
# define getsockname rpl_getsockname
# endif
_GL_FUNCDECL_RPL (getsockname, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen)
+ (int fd, struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (getsockname, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
+ (int fd, struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen));
# else
/* Need to cast, because on Solaris 10 systems, the third parameter is
- void *addrlen. */
+ void *addrlen. */
_GL_CXXALIAS_SYS_CAST (getsockname, int,
- (int fd, struct sockaddr *addr, socklen_t *addrlen));
+ (int fd, struct sockaddr *restrict addr,
+ socklen_t *restrict addrlen));
# endif
_GL_CXXALIASWARN (getsockname);
#elif @HAVE_WINSOCK2_H@
@@ -461,16 +468,19 @@ _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
# undef getsockopt
# define getsockopt rpl_getsockopt
# endif
-_GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname,
- void *optval, socklen_t *optlen)
- _GL_ARG_NONNULL ((4, 5)));
-_GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname,
- void *optval, socklen_t *optlen));
+_GL_FUNCDECL_RPL (getsockopt, int,
+ (int fd, int level, int optname,
+ void *restrict optval, socklen_t *restrict optlen)
+ _GL_ARG_NONNULL ((4, 5)));
+_GL_CXXALIAS_RPL (getsockopt, int,
+ (int fd, int level, int optname,
+ void *restrict optval, socklen_t *restrict optlen));
# else
/* Need to cast, because on Solaris 10 systems, the fifth parameter is
void *optlen. */
-_GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname,
- void *optval, socklen_t *optlen));
+_GL_CXXALIAS_SYS_CAST (getsockopt, int,
+ (int fd, int level, int optname,
+ void *restrict optval, socklen_t *restrict optlen));
# endif
_GL_CXXALIASWARN (getsockopt);
#elif @HAVE_WINSOCK2_H@
@@ -571,18 +581,21 @@ _GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
# define recvfrom rpl_recvfrom
# endif
_GL_FUNCDECL_RPL (recvfrom, ssize_t,
- (int fd, void *buf, size_t len, int flags,
- struct sockaddr *from, socklen_t *fromlen)
+ (int fd, void *restrict buf, size_t len, int flags,
+ struct sockaddr *restrict from,
+ socklen_t *restrict fromlen)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (recvfrom, ssize_t,
- (int fd, void *buf, size_t len, int flags,
- struct sockaddr *from, socklen_t *fromlen));
+ (int fd, void *restrict buf, size_t len, int flags,
+ struct sockaddr *restrict from,
+ socklen_t *restrict fromlen));
# else
/* Need to cast, because on Solaris 10 systems, the sixth parameter is
void *fromlen. */
_GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
- (int fd, void *buf, size_t len, int flags,
- struct sockaddr *from, socklen_t *fromlen));
+ (int fd, void *restrict buf, size_t len, int flags,
+ struct sockaddr *restrict from,
+ socklen_t *restrict fromlen));
# endif
_GL_CXXALIASWARN (recvfrom);
#elif @HAVE_WINSOCK2_H@
diff --git a/gnulib/import/sys_stat.in.h b/gnulib/import/sys_stat.in.h
index e3ab315..4494607 100644
--- a/gnulib/import/sys_stat.in.h
+++ b/gnulib/import/sys_stat.in.h
@@ -455,18 +455,22 @@ _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
# define fstatat rpl_fstatat
# endif
_GL_FUNCDECL_RPL (fstatat, int,
- (int fd, char const *name, struct stat *st, int flags)
+ (int fd, char const *restrict name, struct stat *restrict st,
+ int flags)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (fstatat, int,
- (int fd, char const *name, struct stat *st, int flags));
+ (int fd, char const *restrict name, struct stat *restrict st,
+ int flags));
# else
# if !@HAVE_FSTATAT@
_GL_FUNCDECL_SYS (fstatat, int,
- (int fd, char const *name, struct stat *st, int flags)
+ (int fd, char const *restrict name, struct stat *restrict st,
+ int flags)
_GL_ARG_NONNULL ((2, 3)));
# endif
_GL_CXXALIAS_SYS (fstatat, int,
- (int fd, char const *name, struct stat *st, int flags));
+ (int fd, char const *restrict name, struct stat *restrict st,
+ int flags));
# endif
_GL_CXXALIASWARN (fstatat);
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
@@ -514,23 +518,11 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
#if @GNULIB_LCHMOD@
/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
denotes a symbolic link. */
-# if @REPLACE_LCHMOD@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef lchmod
-# define lchmod rpl_lchmod
-# endif
-_GL_FUNCDECL_RPL (lchmod, int,
- (char const *filename, mode_t mode)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (lchmod, int,
- (char const *filename, mode_t mode));
-# else
-# if !@HAVE_LCHMOD@ || defined __hpux
+# if !@HAVE_LCHMOD@ || defined __hpux
_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));
# endif
+_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
_GL_CXXALIASWARN (lchmod);
#elif defined GNULIB_POSIXCHECK
# undef lchmod
@@ -548,17 +540,21 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define lstat stat
# endif
-_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
+_GL_CXXALIAS_RPL_1 (lstat, stat, int,
+ (const char *restrict name, struct stat *restrict buf));
# elif @REPLACE_LSTAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef lstat
# define lstat rpl_lstat
# endif
-_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
+_GL_FUNCDECL_RPL (lstat, int,
+ (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));
# else
-_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
+_GL_CXXALIAS_SYS (lstat, int,
+ (const char *restrict name, struct stat *restrict buf));
# endif
# if @HAVE_LSTAT@
_GL_CXXALIASWARN (lstat);
@@ -771,7 +767,7 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
# endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */
-_GL_EXTERN_C int stat (const char *name, struct stat *buf)
+_GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
_GL_ARG_NONNULL ((1, 2));
# endif
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
diff --git a/gnulib/import/tempname.c b/gnulib/import/tempname.c
index 0aad061..cfb0fc4 100644
--- a/gnulib/import/tempname.c
+++ b/gnulib/import/tempname.c
@@ -1,24 +1,22 @@
-/* tempname.c - generate the name of a temporary file.
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
- Copyright (C) 1991-2003, 2005-2007, 2009-2020 Free Software Foundation, Inc.
+ The GNU C Library 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 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,
+ 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
-/* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */
+ You should have received a copy of the GNU General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
#if !_LIBC
-# include <config.h>
+# include <libc-config.h>
# include "tempname.h"
#endif
@@ -26,9 +24,6 @@
#include <assert.h>
#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
#include <stdio.h>
#ifndef P_tmpdir
@@ -52,51 +47,39 @@
#include <string.h>
#include <fcntl.h>
-#include <sys/time.h>
#include <stdint.h>
-#include <unistd.h>
-
+#include <sys/random.h>
#include <sys/stat.h>
#if _LIBC
# define struct_stat64 struct stat64
+# define __secure_getenv __libc_secure_getenv
#else
# define struct_stat64 struct stat
-# define __try_tempname try_tempname
# define __gen_tempname gen_tempname
-# define __getpid getpid
-# define __gettimeofday gettimeofday
# define __mkdir mkdir
# define __open open
# define __lxstat64(version, file, buf) lstat (file, buf)
#endif
#ifdef _LIBC
-# include <hp-timing.h>
-# if HP_TIMING_AVAIL
-# define RANDOM_BITS(Var) \
- if (__builtin_expect (value == UINT64_C (0), 0)) \
- { \
- /* If this is the first time this function is used initialize \
- the variable we accumulate the value in to some somewhat \
- random value. If we'd not do this programs at startup time \
- might have a reduced set of possible names, at least on slow \
- machines. */ \
- struct timeval tv; \
- __gettimeofday (&tv, NULL); \
- value = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec; \
- } \
- HP_TIMING_NOW (Var)
-# endif
-#endif
-
-/* Use the widest available unsigned type if uint64_t is not
- available. The algorithm below extracts a number less than 62**6
- (approximately 2**35.725) from uint64_t, so ancient hosts where
- uintmax_t is only 32 bits lose about 3.725 bits of randomness,
- which is better than not having mkstemp at all. */
-#if !defined UINT64_MAX && !defined uint64_t
-# define uint64_t uintmax_t
+# include <random-bits.h>
+# define RANDOM_BITS(Var) ((Var) = random_bits ())
+typedef uint32_t random_value;
+# define RANDOM_VALUE_MAX UINT32_MAX
+# define BASE_62_DIGITS 5 /* 62**5 < UINT32_MAX */
+# define BASE_62_POWER (62 * 62 * 62 * 62 * 62) /* 2**BASE_62_DIGITS */
+#else
+/* Use getrandom if it works, falling back on a 64-bit linear
+ congruential generator that starts with whatever Var's value
+ happens to be. */
+# define RANDOM_BITS(Var) \
+ ((void) (getrandom (&(Var), sizeof (Var), 0) == sizeof (Var) \
+ || ((Var) = 2862933555777941757 * (Var) + 3037000493)))
+typedef uint_fast64_t random_value;
+# define RANDOM_VALUE_MAX UINT_FAST64_MAX
+# define BASE_62_DIGITS 10 /* 62**10 < UINT_FAST64_MAX */
+# define BASE_62_POWER (62LL * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62 * 62)
#endif
#if _LIBC
@@ -172,18 +155,80 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
}
#endif /* _LIBC */
+#if _LIBC
+static int try_tempname_len (char *, int, void *, int (*) (char *, void *),
+ size_t);
+#endif
+
+static int
+try_file (char *tmpl, void *flags)
+{
+ int *openflags = flags;
+ return __open (tmpl,
+ (*openflags & ~O_ACCMODE)
+ | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+}
+
+static int
+try_dir (char *tmpl, void *flags _GL_UNUSED)
+{
+ return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
+}
+
+static int
+try_nocreate (char *tmpl, void *flags _GL_UNUSED)
+{
+ struct_stat64 st;
+
+ if (__lxstat64 (_STAT_VER, tmpl, &st) == 0 || errno == EOVERFLOW)
+ __set_errno (EEXIST);
+ return errno == ENOENT ? 0 : -1;
+}
+
/* These are the characters used in temporary file names. */
static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+/* Generate a temporary file name based on TMPL. TMPL must match the
+ rules for mk[s]temp (i.e., end in at least X_SUFFIX_LEN "X"s,
+ possibly with a suffix).
+ The name constructed does not exist at the time of the call to
+ this function. TMPL is overwritten with the result.
+
+ KIND may be one of:
+ __GT_NOCREATE: simply verify that the name does not exist
+ at the time of the call.
+ __GT_FILE: create the file using open(O_CREAT|O_EXCL)
+ and return a read-write fd. The file is mode 0600.
+ __GT_DIR: create a directory, which will be mode 0700.
+
+ We use a clever algorithm to get hard-to-predict names. */
+#ifdef _LIBC
+static
+#endif
int
-__try_tempname (char *tmpl, int suffixlen, void *args,
- int (*tryfunc) (char *, void *))
+gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len)
{
- int len;
+ static int (*const tryfunc[]) (char *, void *) =
+ {
+ [__GT_FILE] = try_file,
+ [__GT_DIR] = try_dir,
+ [__GT_NOCREATE] = try_nocreate
+ };
+ return try_tempname_len (tmpl, suffixlen, &flags, tryfunc[kind],
+ x_suffix_len);
+}
+
+#ifdef _LIBC
+static
+#endif
+int
+try_tempname_len (char *tmpl, int suffixlen, void *args,
+ int (*tryfunc) (char *, void *), size_t x_suffix_len)
+{
+ size_t len;
char *XXXXXX;
- static uint64_t value;
- uint64_t random_time_bits;
unsigned int count;
int fd = -1;
int save_errno = errno;
@@ -193,7 +238,8 @@ __try_tempname (char *tmpl, int suffixlen, void *args,
can exist for a given template is 62**6. It should never be
necessary to try all of these combinations. Instead if a reasonable
number of names is tried (we define reasonable as 62**3) fail to
- give the system administrator the chance to remove the problems. */
+ give the system administrator the chance to remove the problems.
+ This value requires that X_SUFFIX_LEN be at least 3. */
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
@@ -204,44 +250,45 @@ __try_tempname (char *tmpl, int suffixlen, void *args,
unsigned int attempts = ATTEMPTS_MIN;
#endif
+ /* A random variable. */
+ random_value v;
+
+ /* How many random base-62 digits can currently be extracted from V. */
+ int vdigits = 0;
+
+ /* Least unfair value for V. If V is less than this, V can generate
+ BASE_62_DIGITS digits fairly. Otherwise it might be biased. */
+ random_value const unfair_min
+ = RANDOM_VALUE_MAX - RANDOM_VALUE_MAX % BASE_62_POWER;
+
len = strlen (tmpl);
- if (len < 6 + suffixlen || memcmp (&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
+ if (len < x_suffix_len + suffixlen
+ || strspn (&tmpl[len - x_suffix_len - suffixlen], "X") < x_suffix_len)
{
__set_errno (EINVAL);
return -1;
}
/* This is where the Xs start. */
- XXXXXX = &tmpl[len - 6 - suffixlen];
-
- /* Get some more or less random data. */
-#ifdef RANDOM_BITS
- RANDOM_BITS (random_time_bits);
-#else
- {
- struct timeval tv;
- __gettimeofday (&tv, NULL);
- random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
- }
-#endif
- value += random_time_bits ^ __getpid ();
+ XXXXXX = &tmpl[len - x_suffix_len - suffixlen];
- for (count = 0; count < attempts; value += 7777, ++count)
+ for (count = 0; count < attempts; ++count)
{
- uint64_t v = value;
-
- /* Fill in the random bits. */
- XXXXXX[0] = letters[v % 62];
- v /= 62;
- XXXXXX[1] = letters[v % 62];
- v /= 62;
- XXXXXX[2] = letters[v % 62];
- v /= 62;
- XXXXXX[3] = letters[v % 62];
- v /= 62;
- XXXXXX[4] = letters[v % 62];
- v /= 62;
- XXXXXX[5] = letters[v % 62];
+ for (size_t i = 0; i < x_suffix_len; i++)
+ {
+ if (vdigits == 0)
+ {
+ do
+ RANDOM_BITS (v);
+ while (unfair_min <= v);
+
+ vdigits = BASE_62_DIGITS;
+ }
+
+ XXXXXX[i] = letters[v % 62];
+ v /= 62;
+ vdigits--;
+ }
fd = tryfunc (tmpl, args);
if (fd >= 0)
@@ -258,66 +305,17 @@ __try_tempname (char *tmpl, int suffixlen, void *args,
return -1;
}
-static int
-try_file (char *tmpl, void *flags)
-{
- int *openflags = flags;
- return __open (tmpl,
- (*openflags & ~O_ACCMODE)
- | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
-}
-
-static int
-try_dir (char *tmpl, void *flags _GL_UNUSED)
-{
- return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
-}
-
-static int
-try_nocreate (char *tmpl, void *flags _GL_UNUSED)
+int
+__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
{
- struct_stat64 st;
-
- if (__lxstat64 (_STAT_VER, tmpl, &st) == 0 || errno == EOVERFLOW)
- __set_errno (EEXIST);
- return errno == ENOENT ? 0 : -1;
+ return gen_tempname_len (tmpl, suffixlen, flags, kind, 6);
}
-/* Generate a temporary file name based on TMPL. TMPL must match the
- rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
- The name constructed does not exist at the time of the call to
- __gen_tempname. TMPL is overwritten with the result.
-
- KIND may be one of:
- __GT_NOCREATE: simply verify that the name does not exist
- at the time of the call.
- __GT_FILE: create the file using open(O_CREAT|O_EXCL)
- and return a read-write fd. The file is mode 0600.
- __GT_DIR: create a directory, which will be mode 0700.
-
- We use a clever algorithm to get hard-to-predict names. */
+#if !_LIBC
int
-__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
+try_tempname (char *tmpl, int suffixlen, void *args,
+ int (*tryfunc) (char *, void *))
{
- int (*tryfunc) (char *, void *);
-
- switch (kind)
- {
- case __GT_FILE:
- tryfunc = try_file;
- break;
-
- case __GT_DIR:
- tryfunc = try_dir;
- break;
-
- case __GT_NOCREATE:
- tryfunc = try_nocreate;
- break;
-
- default:
- assert (! "invalid KIND in __gen_tempname");
- abort ();
- }
- return __try_tempname (tmpl, suffixlen, &flags, tryfunc);
+ return try_tempname_len (tmpl, suffixlen, args, tryfunc, 6);
}
+#endif
diff --git a/gnulib/import/tempname.h b/gnulib/import/tempname.h
index abb9265..00dcbe4 100644
--- a/gnulib/import/tempname.h
+++ b/gnulib/import/tempname.h
@@ -50,6 +50,9 @@ extern "C" {
We use a clever algorithm to get hard-to-predict names. */
extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
+/* Similar, except X_SUFFIX_LEN gives the number of Xs. */
+extern int gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len);
/* Similar to gen_tempname, but TRYFUNC is called for each temporary
name to try. If TRYFUNC returns a non-negative number, TRY_GEN_TEMPNAME
@@ -57,6 +60,10 @@ extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
name is tried, or else TRY_GEN_TEMPNAME returns -1. */
extern int try_tempname (char *tmpl, int suffixlen, void *args,
int (*tryfunc) (char *, void *));
+/* Similar, except X_SUFFIX_LEN gives the number of Xs. */
+extern int try_tempname_len (char *tmpl, int suffixlen, void *args,
+ int (*tryfunc) (char *, void *),
+ size_t x_suffix_len);
#ifdef __cplusplus
}
diff --git a/gnulib/import/time.in.h b/gnulib/import/time.in.h
index 3f942b7..1d11650 100644
--- a/gnulib/import/time.in.h
+++ b/gnulib/import/time.in.h
@@ -286,14 +286,17 @@ _GL_CXXALIASWARN (ctime);
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define strftime rpl_strftime
# endif
-_GL_FUNCDECL_RPL (strftime, size_t, (char *__buf, size_t __bufsize,
- const char *__fmt, const struct tm *__tp)
- _GL_ARG_NONNULL ((1, 3, 4)));
-_GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize,
- const char *__fmt, const struct tm *__tp));
+_GL_FUNCDECL_RPL (strftime, size_t,
+ (char *restrict __buf, size_t __bufsize,
+ 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,
+ const char *restrict __fmt, const struct tm *restrict __tp));
# else
-_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize,
- const char *__fmt, const struct tm *__tp));
+_GL_CXXALIAS_SYS (strftime, size_t,
+ (char *restrict __buf, size_t __bufsize,
+ const char *restrict __fmt, const struct tm *restrict __tp));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strftime);
diff --git a/gnulib/import/unistd.in.h b/gnulib/import/unistd.in.h
index d6176ad..b211e4d 100644
--- a/gnulib/import/unistd.in.h
+++ b/gnulib/import/unistd.in.h
@@ -118,6 +118,17 @@
# include <netdb.h>
#endif
+/* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in
+ <sys/random.h>, not in <unistd.h>. */
+/* But avoid namespace pollution on glibc systems. */
+#if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \
+ && ((defined __APPLE__ && defined __MACH__) || defined __sun \
+ || defined __ANDROID__) \
+ && @UNISTD_H_HAVE_SYS_RANDOM_H@ \
+ && !defined __GLIBC__
+# include <sys/random.h>
+#endif
+
/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
/* But avoid namespace pollution on glibc systems. */
#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
@@ -763,6 +774,22 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
#endif
+#if @GNULIB_GETENTROPY@
+/* Fill a buffer with random bytes. */
+# if !@HAVE_GETENTROPY@
+_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
+# endif
+_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
+_GL_CXXALIASWARN (getentropy);
+#elif defined GNULIB_POSIXCHECK
+# undef getentropy
+# if HAVE_RAW_DECL_GETENTROPY
+_GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
+ "use gnulib module getentropy for portability");
+# endif
+#endif
+
+
#if @GNULIB_GETGROUPS@
/* Return the supplemental groups that the current process belongs to.
It is unspecified whether the effective group id is in the list.
@@ -1370,18 +1397,22 @@ _GL_CXXALIASWARN (read);
# define readlink rpl_readlink
# endif
_GL_FUNCDECL_RPL (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize)
+ (const char *restrict file,
+ char *restrict buf, size_t bufsize)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize));
+ (const char *restrict file,
+ char *restrict buf, size_t bufsize));
# else
# if !@HAVE_READLINK@
_GL_FUNCDECL_SYS (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize)
+ (const char *restrict file,
+ char *restrict buf, size_t bufsize)
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (readlink, ssize_t,
- (const char *file, char *buf, size_t bufsize));
+ (const char *restrict file,
+ char *restrict buf, size_t bufsize));
# endif
_GL_CXXALIASWARN (readlink);
#elif defined GNULIB_POSIXCHECK
@@ -1399,18 +1430,22 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
# define readlinkat rpl_readlinkat
# endif
_GL_FUNCDECL_RPL (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len)
+ (int fd, char const *restrict file,
+ char *restrict buf, size_t len)
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len));
+ (int fd, char const *restrict file,
+ char *restrict buf, size_t len));
# else
# if !@HAVE_READLINKAT@
_GL_FUNCDECL_SYS (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len)
+ (int fd, char const *restrict file,
+ char *restrict buf, size_t len)
_GL_ARG_NONNULL ((2, 3)));
# endif
_GL_CXXALIAS_SYS (readlinkat, ssize_t,
- (int fd, char const *file, char *buf, size_t len));
+ (int fd, char const *restrict file,
+ char *restrict buf, size_t len));
# endif
_GL_CXXALIASWARN (readlinkat);
#elif defined GNULIB_POSIXCHECK
diff --git a/gnulib/import/verify.h b/gnulib/import/verify.h
index d9ab89a..f109761 100644
--- a/gnulib/import/verify.h
+++ b/gnulib/import/verify.h
@@ -277,10 +277,22 @@ template <int w>
#endif
/* Assume that R always holds. Behavior is undefined if R is false,
- fails to evaluate, or has side effects. Although assuming R can
- help a compiler generate better code or diagnostics, performance
- can suffer if R uses hard-to-optimize features such as function
- calls not inlined by the compiler. */
+ fails to evaluate, or has side effects.
+
+ 'assume (R)' is a directive from the programmer telling the
+ compiler that R is true so the compiler needn't generate code to
+ test R. This is why 'assume' is in verify.h: it's related to
+ static checking (in this case, static checking done by the
+ programmer), not dynamic checking.
+
+ 'assume (R)' can affect compilation of all the code, not just code
+ that happens to be executed after the assume (R) is "executed".
+ For example, if the code mistakenly does 'assert (R); assume (R);'
+ the compiler is entitled to optimize away the 'assert (R)'.
+
+ Although assuming R can help a compiler generate better code or
+ diagnostics, performance can suffer if R uses hard-to-optimize
+ features such as function calls not inlined by the compiler. */
#if _GL_HAS_BUILTIN_UNREACHABLE
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
diff --git a/gnulib/import/warn-on-use.h b/gnulib/import/warn-on-use.h
index 1be2cbb..23c10fd 100644
--- a/gnulib/import/warn-on-use.h
+++ b/gnulib/import/warn-on-use.h
@@ -100,23 +100,28 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use
#endif
/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
- is like _GL_WARN_ON_USE (function, "string"), except that the function is
- declared with the given prototype, consisting of return type, parameters,
- and attributes.
+ is like _GL_WARN_ON_USE (function, "string"), 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 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+# if !defined __cplusplus
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
+ _GL_WARN_ON_USE (function, msg)
+# else
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
extern rettype function parameters_and_attributes \
__attribute__ ((__warning__ (msg)))
-# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
/* Verify the existence of the function. */
-# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
extern rettype function parameters_and_attributes
-# else /* Unsupported. */
-# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
+# else /* Unsupported. */
+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
_GL_WARN_EXTERN_C int _gl_warn_on_use
+# endif
# endif
#endif
diff --git a/gnulib/import/wchar.in.h b/gnulib/import/wchar.in.h
index 63a02a4..7640a14 100644
--- a/gnulib/import/wchar.in.h
+++ b/gnulib/import/wchar.in.h
@@ -94,10 +94,12 @@
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE /* empty */
+# endif
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -244,16 +246,20 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
# define mbrtowc rpl_mbrtowc
# endif
_GL_FUNCDECL_RPL (mbrtowc, size_t,
- (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
+ (wchar_t *restrict pwc, const char *restrict s, size_t n,
+ mbstate_t *restrict ps));
_GL_CXXALIAS_RPL (mbrtowc, size_t,
- (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
+ (wchar_t *restrict pwc, const char *restrict s, size_t n,
+ mbstate_t *restrict ps));
# else
# if !@HAVE_MBRTOWC@
_GL_FUNCDECL_SYS (mbrtowc, size_t,
- (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
+ (wchar_t *restrict pwc, const char *restrict s, size_t n,
+ mbstate_t *restrict ps));
# endif
_GL_CXXALIAS_SYS (mbrtowc, size_t,
- (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
+ (wchar_t *restrict pwc, const char *restrict s, size_t n,
+ mbstate_t *restrict ps));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (mbrtowc);
@@ -274,13 +280,17 @@ _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
# undef mbrlen
# define mbrlen rpl_mbrlen
# endif
-_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
-_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
+_GL_FUNCDECL_RPL (mbrlen, size_t,
+ (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 *s, size_t n, mbstate_t *ps));
+_GL_FUNCDECL_SYS (mbrlen, size_t,
+ (const char *restrict s, size_t n, mbstate_t *restrict ps));
# endif
-_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
+_GL_CXXALIAS_SYS (mbrlen, size_t,
+ (const char *restrict s, size_t n, mbstate_t *restrict ps));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (mbrlen);
@@ -302,20 +312,26 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
# define mbsrtowcs rpl_mbsrtowcs
# endif
_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+ (wchar_t *restrict dest,
+ const char **restrict srcp, size_t len,
+ mbstate_t *restrict ps)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t len,
- mbstate_t *ps));
+ (wchar_t *restrict dest,
+ const char **restrict srcp, size_t len,
+ mbstate_t *restrict ps));
# else
# if !@HAVE_MBSRTOWCS@
_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+ (wchar_t *restrict dest,
+ const char **restrict srcp, size_t len,
+ mbstate_t *restrict ps)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t len,
- mbstate_t *ps));
+ (wchar_t *restrict dest,
+ const char **restrict srcp, size_t len,
+ mbstate_t *restrict ps));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (mbsrtowcs);
@@ -337,22 +353,26 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
# define mbsnrtowcs rpl_mbsnrtowcs
# endif
_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
- mbstate_t *ps)
+ (wchar_t *restrict dest,
+ const char **restrict srcp, size_t srclen, size_t len,
+ mbstate_t *restrict ps)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
- mbstate_t *ps));
+ (wchar_t *restrict dest,
+ const char **restrict srcp, size_t srclen, size_t len,
+ mbstate_t *restrict ps));
# else
# if !@HAVE_MBSNRTOWCS@
_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
- mbstate_t *ps)
+ (wchar_t *restrict dest,
+ const char **restrict srcp, size_t srclen, size_t len,
+ mbstate_t *restrict ps)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
- (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
- mbstate_t *ps));
+ (wchar_t *restrict dest,
+ const char **restrict srcp, size_t srclen, size_t len,
+ mbstate_t *restrict ps));
# endif
_GL_CXXALIASWARN (mbsnrtowcs);
#elif defined GNULIB_POSIXCHECK
@@ -371,13 +391,17 @@ _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
# undef wcrtomb
# define wcrtomb rpl_wcrtomb
# endif
-_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
-_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
+_GL_FUNCDECL_RPL (wcrtomb, size_t,
+ (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 *s, wchar_t wc, mbstate_t *ps));
+_GL_FUNCDECL_SYS (wcrtomb, size_t,
+ (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
# endif
-_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
+_GL_CXXALIAS_SYS (wcrtomb, size_t,
+ (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcrtomb);
@@ -399,20 +423,26 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
# define wcsrtombs rpl_wcsrtombs
# endif
_GL_FUNCDECL_RPL (wcsrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
+ (char *restrict dest, const wchar_t **restrict srcp,
+ size_t len,
+ mbstate_t *restrict ps)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (wcsrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t len,
- mbstate_t *ps));
+ (char *restrict dest, const wchar_t **restrict srcp,
+ size_t len,
+ mbstate_t *restrict ps));
# else
# if !@HAVE_WCSRTOMBS@
_GL_FUNCDECL_SYS (wcsrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
+ (char *restrict dest, const wchar_t **restrict srcp,
+ size_t len,
+ mbstate_t *restrict ps)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (wcsrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t len,
- mbstate_t *ps));
+ (char *restrict dest, const wchar_t **restrict srcp,
+ size_t len,
+ mbstate_t *restrict ps));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcsrtombs);
@@ -434,22 +464,30 @@ _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
# define wcsnrtombs rpl_wcsnrtombs
# endif
_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
- mbstate_t *ps)
+ (char *restrict dest,
+ const wchar_t **restrict srcp, size_t srclen,
+ size_t len,
+ mbstate_t *restrict ps)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
- mbstate_t *ps));
+ (char *restrict dest,
+ const wchar_t **restrict srcp, size_t srclen,
+ size_t len,
+ mbstate_t *restrict ps));
# else
# if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
- mbstate_t *ps)
+ (char *restrict dest,
+ const wchar_t **restrict srcp, size_t srclen,
+ size_t len,
+ mbstate_t *restrict ps)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
- (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
- mbstate_t *ps));
+ (char *restrict dest,
+ const wchar_t **restrict srcp, size_t srclen,
+ size_t len,
+ mbstate_t *restrict ps));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcsnrtombs);
@@ -547,10 +585,12 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
#if @GNULIB_WMEMCPY@
# if !@HAVE_WMEMCPY@
_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
# endif
_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wmemcpy);
# endif
@@ -584,6 +624,29 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
#endif
+/* Copy N wide characters of SRC to DEST.
+ Return pointer to wide characters after the last written wide character. */
+#if @GNULIB_WMEMPCPY@
+# if !@HAVE_WMEMPCPY@
+_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
+# endif
+_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (wmempcpy);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wmempcpy
+# if HAVE_RAW_DECL_WMEMPCPY
+_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
+ "use gnulib module wmempcpy for portability");
+# endif
+#endif
+
+
/* Set N wide characters of S to C. */
#if @GNULIB_WMEMSET@
# if !@HAVE_WMEMSET@
@@ -640,9 +703,11 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
/* Copy SRC to DEST. */
#if @GNULIB_WCSCPY@
# if !@HAVE_WCSCPY@
-_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_FUNCDECL_SYS (wcscpy, wchar_t *,
+ (wchar_t *restrict dest, const wchar_t *restrict src));
# endif
-_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_CXXALIAS_SYS (wcscpy, wchar_t *,
+ (wchar_t *restrict dest, const wchar_t *restrict src));
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcscpy);
# endif
@@ -658,9 +723,11 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
#if @GNULIB_WCPCPY@
# if !@HAVE_WCPCPY@
-_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
+ (wchar_t *restrict dest, const wchar_t *restrict src));
# endif
-_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
+ (wchar_t *restrict dest, const wchar_t *restrict src));
_GL_CXXALIASWARN (wcpcpy);
#elif defined GNULIB_POSIXCHECK
# undef wcpcpy
@@ -675,10 +742,12 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
#if @GNULIB_WCSNCPY@
# if !@HAVE_WCSNCPY@
_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
# endif
_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcsncpy);
# endif
@@ -696,10 +765,12 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
#if @GNULIB_WCPNCPY@
# if !@HAVE_WCPNCPY@
_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
# endif
_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
+ (wchar_t *restrict dest,
+ const wchar_t *restrict src, size_t n));
_GL_CXXALIASWARN (wcpncpy);
#elif defined GNULIB_POSIXCHECK
# undef wcpncpy
@@ -713,9 +784,11 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
/* Append SRC onto DEST. */
#if @GNULIB_WCSCAT@
# if !@HAVE_WCSCAT@
-_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_FUNCDECL_SYS (wcscat, wchar_t *,
+ (wchar_t *restrict dest, const wchar_t *restrict src));
# endif
-_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
+_GL_CXXALIAS_SYS (wcscat, wchar_t *,
+ (wchar_t *restrict dest, const wchar_t *restrict src));
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcscat);
# endif
@@ -732,10 +805,12 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
#if @GNULIB_WCSNCAT@
# if !@HAVE_WCSNCAT@
_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
+ (wchar_t *restrict dest, const wchar_t *restrict src,
+ size_t n));
# endif
_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
- (wchar_t *dest, const wchar_t *src, size_t n));
+ (wchar_t *restrict dest, const wchar_t *restrict src,
+ size_t n));
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcsncat);
# endif
@@ -848,9 +923,11 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
original strings. */
#if @GNULIB_WCSXFRM@
# if !@HAVE_WCSXFRM@
-_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_FUNCDECL_SYS (wcsxfrm, size_t,
+ (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
# endif
-_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
+_GL_CXXALIAS_SYS (wcsxfrm, size_t,
+ (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcsxfrm);
# endif
@@ -1016,7 +1093,8 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
#if @GNULIB_WCSSTR@
# if !@HAVE_WCSSTR@
_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
- (const wchar_t *haystack, const wchar_t *needle)
+ (const wchar_t *restrict haystack,
+ const wchar_t *restrict needle)
_GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -1025,14 +1103,18 @@ _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
} */
_GL_CXXALIAS_SYS_CAST2 (wcsstr,
- wchar_t *, (const wchar_t *, const wchar_t *),
- const wchar_t *, (const wchar_t *, const wchar_t *));
+ wchar_t *,
+ (const wchar_t *restrict, const wchar_t *restrict),
+ const wchar_t *,
+ (const wchar_t *restrict, const wchar_t *restrict));
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
- (wchar_t *haystack, const wchar_t *needle));
+ (wchar_t *restrict haystack,
+ const wchar_t *restrict needle));
_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
- (const wchar_t *haystack, const wchar_t *needle));
+ (const wchar_t *restrict haystack,
+ const wchar_t *restrict needle));
# elif __GLIBC__ >= 2
_GL_CXXALIASWARN (wcsstr);
# endif
@@ -1053,16 +1135,20 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
# define wcstok rpl_wcstok
# endif
_GL_FUNCDECL_RPL (wcstok, wchar_t *,
- (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+ (wchar_t *restrict wcs, const wchar_t *restrict delim,
+ wchar_t **restrict ptr));
_GL_CXXALIAS_RPL (wcstok, wchar_t *,
- (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+ (wchar_t *restrict wcs, const wchar_t *restrict delim,
+ wchar_t **restrict ptr));
# else
# if !@HAVE_WCSTOK@
_GL_FUNCDECL_SYS (wcstok, wchar_t *,
- (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+ (wchar_t *restrict wcs, const wchar_t *restrict delim,
+ wchar_t **restrict ptr));
# endif
_GL_CXXALIAS_SYS (wcstok, wchar_t *,
- (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
+ (wchar_t *restrict wcs, const wchar_t *restrict delim,
+ wchar_t **restrict ptr));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcstok);
@@ -1114,19 +1200,27 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
# undef wcsftime
# define wcsftime rpl_wcsftime
# endif
-_GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize,
- const wchar_t *__fmt, const struct tm *__tp)
- _GL_ARG_NONNULL ((1, 3, 4)));
-_GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize,
- const wchar_t *__fmt, const struct tm *__tp));
+_GL_FUNCDECL_RPL (wcsftime, size_t,
+ (wchar_t *restrict __buf, size_t __bufsize,
+ const wchar_t *restrict __fmt,
+ const struct tm *restrict __tp)
+ _GL_ARG_NONNULL ((1, 3, 4)));
+_GL_CXXALIAS_RPL (wcsftime, size_t,
+ (wchar_t *restrict __buf, size_t __bufsize,
+ const wchar_t *restrict __fmt,
+ const struct tm *restrict __tp));
# else
# if !@HAVE_WCSFTIME@
-_GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize,
- const wchar_t *__fmt, const struct tm *__tp)
- _GL_ARG_NONNULL ((1, 3, 4)));
+_GL_FUNCDECL_SYS (wcsftime, size_t,
+ (wchar_t *restrict __buf, size_t __bufsize,
+ const wchar_t *restrict __fmt,
+ const struct tm *restrict __tp)
+ _GL_ARG_NONNULL ((1, 3, 4)));
# endif
-_GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize,
- const wchar_t *__fmt, const struct tm *__tp));
+_GL_CXXALIAS_SYS (wcsftime, size_t,
+ (wchar_t *restrict __buf, size_t __bufsize,
+ const wchar_t *restrict __fmt,
+ const struct tm *restrict __tp));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (wcsftime);
diff --git a/gnulib/import/windows-rwlock.c b/gnulib/import/windows-rwlock.c
index aafc5dd..64e761c 100644
--- a/gnulib/import/windows-rwlock.c
+++ b/gnulib/import/windows-rwlock.c
@@ -25,6 +25,10 @@
#include <errno.h>
#include <stdlib.h>
+/* Don't assume that UNICODE is not defined. */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
/* In this file, the waitqueues are implemented as circular arrays. */
#define glwthread_waitqueue_t glwthread_carray_waitqueue_t
diff --git a/gnulib/import/wmemchr-impl.h b/gnulib/import/wmemchr-impl.h
new file mode 100644
index 0000000..55231b3
--- /dev/null
+++ b/gnulib/import/wmemchr-impl.h
@@ -0,0 +1,27 @@
+/* Search wide character array for a wide character.
+ Copyright (C) 1999, 2011-2020 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 1999.
+
+ 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,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+wchar_t *
+wmemchr (const wchar_t *s, wchar_t c, size_t n)
+{
+ for (; n > 0; s++, n--)
+ {
+ if (*s == c)
+ return (wchar_t *) s;
+ }
+ return NULL;
+}
diff --git a/gnulib/import/wmemchr.c b/gnulib/import/wmemchr.c
new file mode 100644
index 0000000..b4f1970
--- /dev/null
+++ b/gnulib/import/wmemchr.c
@@ -0,0 +1,23 @@
+/* Search wide character array for a wide character.
+ Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+ 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,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <wchar.h>
+
+#include "wmemchr-impl.h"
diff --git a/gnulib/import/wmempcpy.c b/gnulib/import/wmempcpy.c
new file mode 100644
index 0000000..2e96ed8
--- /dev/null
+++ b/gnulib/import/wmempcpy.c
@@ -0,0 +1,28 @@
+/* Copy wide character array, return pointer after last written wide character.
+ Copyright (C) 2020 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, 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <wchar.h>
+
+/* Copy N wide characters of SRC to DEST.
+ Return pointer to wide characters after the last written wide character. */
+wchar_t *
+wmempcpy (wchar_t *dest, const wchar_t *src, size_t n)
+{
+ return wmemcpy (dest, src, n) + n;
+}