[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Run gnulib-tool --add-import at top level
From: |
Patrice Dumas |
Subject: |
branch master updated: Run gnulib-tool --add-import at top level |
Date: |
Sat, 10 Aug 2024 09:17:19 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 49bb65fa31 Run gnulib-tool --add-import at top level
49bb65fa31 is described below
commit 49bb65fa313da12eab9ad3361208b986d11d5bae
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 10 15:17:13 2024 +0200
Run gnulib-tool --add-import at top level
---
ChangeLog | 4 +
build-aux/config.rpath | 87 ++++++-
gnulib/lib/Makefile.am | 25 +-
gnulib/lib/attribute.h | 49 +++-
gnulib/lib/c++defs.h | 37 ++-
gnulib/lib/c32is-impl.h | 2 +-
gnulib/lib/c32to-impl.h | 2 +-
gnulib/lib/c32width.c | 2 +-
gnulib/lib/cdefs.h | 2 +-
gnulib/lib/errno.in.h | 2 +-
gnulib/lib/error.in.h | 8 +-
gnulib/lib/fcntl.in.h | 8 +-
gnulib/lib/float.c | 95 +++++++-
gnulib/lib/float.in.h | 152 +++++++++++++
gnulib/lib/glthread/lock.c | 42 ----
gnulib/lib/glthread/lock.h | 151 +------------
gnulib/lib/glthread/once.c | 80 +++++++
gnulib/lib/glthread/once.h | 266 ++++++++++++++++++++++
gnulib/lib/inttypes.in.h | 8 +-
gnulib/lib/locale.in.h | 12 +-
gnulib/lib/mbrtoc32.c | 2 +-
gnulib/lib/printf-args.c | 2 -
gnulib/lib/printf-args.h | 11 +-
gnulib/lib/printf-parse.c | 6 -
gnulib/lib/pthread.in.h | 185 +++++++--------
gnulib/lib/stddef.in.h | 7 +-
gnulib/lib/stdio.in.h | 484 ++++++++++++++++++++++++++++++---------
gnulib/lib/stdlib.in.h | 334 +++++++++++++++------------
gnulib/lib/string.in.h | 114 +++++-----
gnulib/lib/strnlen.c | 16 +-
gnulib/lib/sys_random.in.h | 11 +-
gnulib/lib/sys_stat.in.h | 78 ++++---
gnulib/lib/time.in.h | 58 +++--
gnulib/lib/uchar.in.h | 26 ++-
gnulib/lib/unistd.in.h | 289 ++++++++++++++----------
gnulib/lib/vasnprintf.c | 538 ++++++++++++++++++++++++++++++++++----------
gnulib/lib/vasprintf.c | 12 +-
gnulib/lib/wchar.in.h | 98 ++++----
gnulib/lib/wctype.in.h | 8 +-
gnulib/lib/windows-mutex.c | 24 ++
gnulib/lib/windows-mutex.h | 1 +
gnulib/lib/xsize.h | 18 +-
gnulib/m4/c32rtomb.m4 | 186 +++++++++++++++
gnulib/m4/calloc.m4 | 7 +-
gnulib/m4/errno_h.m4 | 7 +-
gnulib/m4/extensions-aix.m4 | 25 ++
gnulib/m4/float_h.m4 | 27 ++-
gnulib/m4/gnulib-common.m4 | 191 +++++++++++++++-
gnulib/m4/gnulib-comp.m4 | 58 ++++-
gnulib/m4/largefile.m4 | 6 +-
gnulib/m4/malloc.m4 | 7 +-
gnulib/m4/math_h.m4 | 10 +-
gnulib/m4/mbrtoc32.m4 | 5 +-
gnulib/m4/mbrtowc.m4 | 2 +-
gnulib/m4/memchr.m4 | 4 +-
gnulib/m4/once.m4 | 13 ++
gnulib/m4/printf.m4 | 31 ++-
gnulib/m4/realloc.m4 | 7 +-
gnulib/m4/std-gnu11.m4 | 8 +-
gnulib/m4/stddef_h.m4 | 9 +-
gnulib/m4/stdio_h.m4 | 14 +-
gnulib/m4/stdlib_h.m4 | 4 +-
gnulib/m4/strcasestr.m4 | 4 +-
gnulib/m4/strnlen.m4 | 51 ++++-
gnulib/m4/strstr.m4 | 4 +-
gnulib/m4/time_h.m4 | 3 +-
gnulib/m4/vasnprintf.m4 | 39 +++-
gnulib/m4/wchar_t.m4 | 25 --
gnulib/m4/wcwidth.m4 | 3 +-
69 files changed, 2976 insertions(+), 1130 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3da7bfde32..d8651cdb4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-08-10 Patrice Dumas <pertusus@free.fr>
+
+ Run gnulib-tool --add-import at top level
+
2024-08-10 Patrice Dumas <pertusus@free.fr>
* tp/maintain/regenerate_C_options_info.pl,
diff --git a/build-aux/config.rpath b/build-aux/config.rpath
index 3893ddd861..58870bd70d 100755
--- a/build-aux/config.rpath
+++ b/build-aux/config.rpath
@@ -1,6 +1,7 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
-# run time search path of shared libraries in an executable.
+# run time search path of shared libraries in a binary (executable or
+# shared library).
#
# Copyright 1996-2024 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
@@ -9,15 +10,6 @@
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-#
-# The first argument passed to this file is the canonical host specification,
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
-# should be set by the caller.
-#
-# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
@@ -25,6 +17,81 @@
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
+# func_usage
+# outputs to stdout the --help usage message.
+func_usage ()
+{
+ echo "\
+Usage: config.rpath [OPTION] HOST
+
+Prints shell variable assignments that describe how to hardcode a directory
+for the lookup of shared libraries into a binary (executable or shared
library).
+
+The first argument passed to this file is the canonical host specification,
+ CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+or
+ CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+
+The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+should be set by the caller.
+
+The set of defined variables is at the end of this script.
+
+Options:
+ --help print this help and exit
+ --version print version information and exit
+
+Send patches and bug reports to <bug-gnulib@gnu.org>."
+}
+
+# func_version
+# outputs to stdout the --version message.
+func_version ()
+{
+ echo "config.rpath (GNU gnulib, module havelib)"
+ echo "Copyright (C) 2024 Free Software Foundation, Inc.
+License: All-Permissive.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+ echo
+ printf 'Written by %s.\n' "Bruno Haible"
+}
+
+# func_fatal_error message
+# outputs to stderr a fatal error message, and terminates the program.
+func_fatal_error ()
+{
+ echo "config.rpath: *** $1" 1>&2
+ echo "config.rpath: *** Stop." 1>&2
+ exit 1
+}
+
+# Command-line option processing.
+while test $# -gt 0; do
+ case "$1" in
+ --help | --hel | --he | --h )
+ func_usage
+ exit 0 ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v )
+ func_version
+ exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ -* )
+ func_fatal_error "unrecognized option: $1"
+ ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# -gt 1; then
+ func_fatal_error "too many arguments"
+fi
+if test $# -lt 1; then
+ func_fatal_error "too few arguments"
+fi
+
# All known linkers require a '.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
index 1b756d417d..0c49c6cfb7 100644
--- a/gnulib/lib/Makefile.am
+++ b/gnulib/lib/Makefile.am
@@ -1212,6 +1212,14 @@ EXTRA_DIST += windows-initguard.h
## end gnulib module nl_langinfo
+## begin gnulib module once
+
+if gl_GNULIB_ENABLED_once
+libgnu_a_SOURCES += glthread/once.h glthread/once.c
+
+endif
+## end gnulib module once
+
## begin gnulib module open
if gl_GNULIB_ENABLED_open
@@ -1629,7 +1637,6 @@ stddef.h: stddef.in.h $(top_builddir)/config.status
-e 's|@''STDDEF_NOT_IDEMPOTENT''@|$(STDDEF_NOT_IDEMPOTENT)|g' \
-e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
-e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
- -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
$(srcdir)/stddef.in.h > $@-t
$(AM_V_at)mv $@-t $@
else
@@ -1704,6 +1711,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status
$(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
-e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \
+ -e 's/@''GNULIB_DZPRINTF''@/$(GL_GNULIB_DZPRINTF)/g' \
-e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \
-e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \
-e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \
@@ -1724,12 +1732,14 @@ stdio.h: stdio.in.h $(top_builddir)/config.status
$(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \
-e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \
-e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \
+ -e 's/@''GNULIB_FZPRINTF''@/$(GL_GNULIB_FZPRINTF)/g' \
-e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \
-e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \
-e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \
-e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \
-e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \
-e
's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \
+ -e
's/@''GNULIB_OBSTACK_ZPRINTF''@/$(GL_GNULIB_OBSTACK_ZPRINTF)/g' \
-e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \
-e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \
-e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \
@@ -1743,20 +1753,29 @@ stdio.h: stdio.in.h $(top_builddir)/config.status
$(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \
-e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \
-e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \
+ -e 's/@''GNULIB_SNZPRINTF''@/$(GL_GNULIB_SNZPRINTF)/g' \
-e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \
-e
's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \
-e
's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \
+ -e 's/@''GNULIB_SZPRINTF''@/$(GL_GNULIB_SZPRINTF)/g' \
-e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \
-e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \
+ -e 's/@''GNULIB_VASZPRINTF''@/$(GL_GNULIB_VASZPRINTF)/g' \
-e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \
+ -e 's/@''GNULIB_VDZPRINTF''@/$(GL_GNULIB_VDZPRINTF)/g' \
-e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \
-e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_VFZPRINTF''@/$(GL_GNULIB_VFZPRINTF)/g' \
-e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \
-e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \
-e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \
-e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \
-e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \
+ -e 's/@''GNULIB_VSNZPRINTF''@/$(GL_GNULIB_VSNZPRINTF)/g' \
-e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_VSZPRINTF''@/$(GL_GNULIB_VSZPRINTF)/g' \
+ -e 's/@''GNULIB_VZPRINTF''@/$(GL_GNULIB_VZPRINTF)/g' \
+ -e 's/@''GNULIB_ZPRINTF''@/$(GL_GNULIB_ZPRINTF)/g' \
-e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \
-e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \
-e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \
@@ -1890,6 +1909,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status
$(CXXDEFS_H) \
-e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \
-e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \
-e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \
+ -e 's/@''GNULIB_STACK_TRACE''@/$(GL_GNULIB_STACK_TRACE)/g' \
-e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \
-e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \
-e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \
@@ -1999,6 +2019,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status
$(CXXDEFS_H) \
-e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
+ -e 's|@''CAN_PRINT_STACK_TRACE''@|$(CAN_PRINT_STACK_TRACE)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _Noreturn/r $(_NORETURN_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
@@ -2407,6 +2428,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status
$(srcdir)/sys_types.in.h > $@-t
$(AM_V_at)mv $@-t $@
MOSTLYCLEANFILES += sys/types.h sys/types.h-t
+MOSTLYCLEANDIRS += sys
EXTRA_DIST += sys_types.in.h
@@ -2456,6 +2478,7 @@ time.h: time.in.h $(top_builddir)/config.status
$(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e
's/@''GNULIB_TIMESPEC_GETRES''@/$(GL_GNULIB_TIMESPEC_GETRES)/g' \
-e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \
-e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \
+ -e 's/@''GNULIB_TZNAME''@/$(GL_GNULIB_TZNAME)/g' \
-e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \
-e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \
-e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
diff --git a/gnulib/lib/attribute.h b/gnulib/lib/attribute.h
index 604965a6d1..186faa5526 100644
--- a/gnulib/lib/attribute.h
+++ b/gnulib/lib/attribute.h
@@ -20,12 +20,49 @@
/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_*
macros used within Gnulib. */
-/* These attributes can be placed in two ways:
- - At the start of a declaration (i.e. even before storage-class
- specifiers!); then they apply to all entities that are declared
- by the declaration.
- - Immediately after the name of an entity being declared by the
- declaration; then they apply to that entity only. */
+/* The placement of these attributes depends on the kind of declaration
+ and, in some cases, also on the programming language (C vs. C++).
+
+ In function declarations and function definitions:
+
+ * ATTRIBUTE_NOTHROW must come after the parameter list.
+
+ * The macros
+ ATTRIBUTE_CONST
+ ATTRIBUTE_PURE
+ DEPRECATED
+ MAYBE_UNUSED
+ NODISCARD
+ REPRODUCIBLE
+ UNSEQUENCED
+ must come before the return type, and more precisely:
+ - In a function declaration/definition without a storage-class
+ specifier: at the beginning of the declaration/definition.
+ - In a function declaration/definition with a storage-class
+ specifier:
+ - In C: before the storage-class specifier.
+ - In C++: between the storage-class specifier and the return type.
+
+ * The other macros can be placed
+ - Either
+ - In a function declaration/definition without a storage-class
+ specifier: at the beginning of the declaration/definition.
+ - In a function declaration/definition with a storage-class
+ specifier: between the storage-class specifier and the return
+ type.
+ - Or after the parameter list,
+ ∙ but after ATTRIBUTE_NOTHROW if present.
+
+ In other declarations, such as variable declarations:
+
+ * Either
+ - In C: before the storage-class specifier.
+ - In C++: between the storage-class specifier and the return type.
+ Then they apply to all entities that are declared by the declaration.
+
+ * Or immediately after the name of an entity being declared by the
+ declaration. Then they apply to that entity only.
+ */
#ifndef _GL_ATTRIBUTE_H
#define _GL_ATTRIBUTE_H
diff --git a/gnulib/lib/c++defs.h b/gnulib/lib/c++defs.h
index eb66967b09..af5e9bb2b3 100644
--- a/gnulib/lib/c++defs.h
+++ b/gnulib/lib/c++defs.h
@@ -93,11 +93,22 @@
# define _GL_EXTERN_C extern
#endif
-/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
+/* _GL_EXTERN_C_FUNC declaration;
+ performs the declaration of a function with C linkage. */
+#if defined __cplusplus
+# define _GL_EXTERN_C_FUNC extern "C"
+#else
+/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax
+ are not allowed between 'extern' and the return type (see gnulib-common.m4).
+ */
+# define _GL_EXTERN_C_FUNC
+#endif
+
+/* _GL_FUNCDECL_RPL (func, rettype, parameters[, attributes]);
declares a replacement function, named rpl_func, with the given prototype,
consisting of return type, parameters, and attributes.
Example:
- _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
+ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
_GL_ARG_NONNULL ((1)));
Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
@@ -105,21 +116,27 @@
because
[[...]] extern "C" <declaration>;
is invalid syntax in C++.)
+
+ Note: The attribute _GL_ATTRIBUTE_NOTHROW, if needed, must be placed outside
+ of the _GL_FUNCDECL_RPL invocation, at the end of the declaration.
*/
-#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
- _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
-#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
- _GL_EXTERN_C rettype rpl_func parameters_and_attributes
+#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \
+ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__)
+#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
+ _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters
-/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
+/* _GL_FUNCDECL_SYS (func, rettype, parameters[, attributes]);
declares the system function, named func, with the given prototype,
consisting of return type, parameters, and attributes.
Example:
- _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
+ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...),
_GL_ARG_NONNULL ((1)));
+
+ Note: The attribute _GL_ATTRIBUTE_NOTHROW, if needed, must be placed outside
+ of the _GL_FUNCDECL_SYS invocation, at the end of the declaration.
*/
-#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
- _GL_EXTERN_C rettype func parameters_and_attributes
+#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
+ _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters
/* _GL_CXXALIAS_RPL (func, rettype, parameters);
declares a C++ alias called GNULIB_NAMESPACE::func
diff --git a/gnulib/lib/c32is-impl.h b/gnulib/lib/c32is-impl.h
index 084b3a02cf..9e9802583f 100644
--- a/gnulib/lib/c32is-impl.h
+++ b/gnulib/lib/c32is-impl.h
@@ -57,7 +57,7 @@ FUNC (wint_t wc)
else
return 0;
-#elif HAVE_WORKING_MBRTOC32 /* glibc, Android */
+#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */
/* mbrtoc32() is essentially defined by the system libc. */
# if _GL_WCHAR_T_IS_UCS4
diff --git a/gnulib/lib/c32to-impl.h b/gnulib/lib/c32to-impl.h
index e94fa7dc9c..32039c612d 100644
--- a/gnulib/lib/c32to-impl.h
+++ b/gnulib/lib/c32to-impl.h
@@ -53,7 +53,7 @@ FUNC (wint_t wc)
else
return wc;
-#elif HAVE_WORKING_MBRTOC32 /* glibc, Android */
+#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */
/* mbrtoc32() is essentially defined by the system libc. */
# if _GL_WCHAR_T_IS_UCS4
diff --git a/gnulib/lib/c32width.c b/gnulib/lib/c32width.c
index 7edf0088f9..37ce1a57dc 100644
--- a/gnulib/lib/c32width.c
+++ b/gnulib/lib/c32width.c
@@ -58,7 +58,7 @@ c32width (char32_t wc)
else
return wcwidth (wc);
-#elif HAVE_WORKING_MBRTOC32 /* glibc, Android */
+#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */
/* mbrtoc32() is essentially defined by the system libc. */
# if _GL_WCHAR_T_IS_UCS4
diff --git a/gnulib/lib/cdefs.h b/gnulib/lib/cdefs.h
index d38382ad9d..9c49eeb413 100644
--- a/gnulib/lib/cdefs.h
+++ b/gnulib/lib/cdefs.h
@@ -83,7 +83,7 @@
# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
# else
-# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
+# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
# if __cplusplus >= 201103L
# define __THROW noexcept (true)
# else
diff --git a/gnulib/lib/errno.in.h b/gnulib/lib/errno.in.h
index aa658e6270..ba927037f6 100644
--- a/gnulib/lib/errno.in.h
+++ b/gnulib/lib/errno.in.h
@@ -133,7 +133,7 @@
/* These are intentionally the same values as the WSA* error numbers, defined
in <winsock2.h>. */
-# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */
+# define ESOCKTNOSUPPORT 10044
# define EPFNOSUPPORT 10046 /* not required by POSIX */
# define ESHUTDOWN 10058 /* not required by POSIX */
# define ETOOMANYREFS 10059 /* not required by POSIX */
diff --git a/gnulib/lib/error.in.h b/gnulib/lib/error.in.h
index 1ba066a863..4deaf98ded 100644
--- a/gnulib/lib/error.in.h
+++ b/gnulib/lib/error.in.h
@@ -92,7 +92,7 @@ extern "C" {
# define error rpl_error
# endif
_GL_FUNCDECL_RPL (error, void,
- (int __status, int __errnum, const char *__format, ...)
+ (int __status, int __errnum, const char *__format, ...),
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3,
4)));
_GL_CXXALIAS_RPL (error, void,
(int __status, int __errnum, const char *__format, ...));
@@ -104,7 +104,7 @@ _GL_CXXALIAS_RPL (error, void,
#else
# if ! @HAVE_ERROR@
_GL_FUNCDECL_SYS (error, void,
- (int __status, int __errnum, const char *__format, ...)
+ (int __status, int __errnum, const char *__format, ...),
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3,
4)));
# endif
_GL_CXXALIAS_SYS (error, void,
@@ -147,7 +147,7 @@ _GL_CXXALIASWARN (error);
# endif
_GL_FUNCDECL_RPL (error_at_line, void,
(int __status, int __errnum, const char *__filename,
- unsigned int __lineno, const char *__format, ...)
+ unsigned int __lineno, const char *__format, ...),
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5,
6)));
_GL_CXXALIAS_RPL (error_at_line, void,
(int __status, int __errnum, const char *__filename,
@@ -161,7 +161,7 @@ _GL_CXXALIAS_RPL (error_at_line, void,
# if ! @HAVE_ERROR_AT_LINE@
_GL_FUNCDECL_SYS (error_at_line, void,
(int __status, int __errnum, const char *__filename,
- unsigned int __lineno, const char *__format, ...)
+ unsigned int __lineno, const char *__format, ...),
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5,
6)));
# endif
_GL_CXXALIAS_SYS (error_at_line, void,
diff --git a/gnulib/lib/fcntl.in.h b/gnulib/lib/fcntl.in.h
index 1465ce594d..8b8274295a 100644
--- a/gnulib/lib/fcntl.in.h
+++ b/gnulib/lib/fcntl.in.h
@@ -100,7 +100,7 @@
# undef creat
# define creat rpl_creat
# endif
-_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode)
+_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
# elif defined _WIN32 && !defined __CYGWIN__
@@ -170,7 +170,7 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX
compliant - "
# undef open
# define open rpl_open
# endif
-_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
+_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
# elif defined _WIN32 && !defined __CYGWIN__
@@ -217,14 +217,14 @@ _GL_CXXALIASWARN (open);
# define openat rpl_openat
# endif
_GL_FUNCDECL_RPL (openat, int,
- (int fd, char const *file, int flags, /* mode_t mode */ ...)
+ (int fd, char const *file, int flags, /* mode_t mode */ ...),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (openat, int,
(int fd, char const *file, int flags, /* mode_t mode */
...));
# else
# if !@HAVE_OPENAT@
_GL_FUNCDECL_SYS (openat, int,
- (int fd, char const *file, int flags, /* mode_t mode */ ...)
+ (int fd, char const *file, int flags, /* mode_t mode */ ...),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (openat, int,
diff --git a/gnulib/lib/float.c b/gnulib/lib/float.c
index a9ea40b063..7a563048e2 100644
--- a/gnulib/lib/float.c
+++ b/gnulib/lib/float.c
@@ -20,14 +20,101 @@
/* Specification. */
#include <float.h>
-#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined
__linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
+#if GNULIB_defined_long_double_union
+# if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined
__linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
const union gl_long_double_union gl_LDBL_MAX =
{ { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
-#elif defined __i386__
+# elif defined __i386__
const union gl_long_double_union gl_LDBL_MAX =
{ { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } };
-#else
+# endif
+# if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__)
+/* We can't even simply evaluate the formula (LDBL_MIN /
9223372036854775808.0L)
+ at run time, because it would require BEGIN_LONG_DOUBLE_ROUNDING /
+ END_LONG_DOUBLE_ROUNDING invocations. It simpler to just write down the
+ representation of LDBL_TRUE_MIN, based on
+
<https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format>.
*/
+const union gl_long_double_union gl_LDBL_TRUE_MIN =
+ { { 0x00000001, 0x00000000, 0 } };
+# endif
+#endif
+
+#if GNULIB_defined_FLT_SNAN
+/* Define like memory_positive_SNaNf(), see signed-snan.h and snan.h,
+ or like setpayloadsigf() with an arbitrary payload. */
+gl_FLT_SNAN_t gl_FLT_SNAN =
+# if FLT_MANT_DIG == 24
+# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined
__sh__
+ /* sign bit: 0, 8 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
+ { { 0x7FE00000U } }
+# else
+ /* sign bit: 0, 8 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
+ { { 0x7FA00000U } }
+# endif
+# endif
+ ;
+#endif
+
+#if GNULIB_defined_DBL_SNAN
+/* Define like memory_positive_SNaNd(), see signed-snan.h and snan.h,
+ or like setpayloadsig() with an arbitrary payload. */
+gl_DBL_SNAN_t gl_DBL_SNAN =
+# if DBL_MANT_DIG == 53
+# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined
__sh__
+ /* sign bit: 0, 11 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
+ { { 0x7FFC000000000000ULL } }
+# else
+ /* sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
+ { { 0x7FF4000000000000ULL } }
+# endif
+# endif
+ ;
+#endif
+
+#if GNULIB_defined_LDBL_SNAN
+# ifdef WORDS_BIGENDIAN
+# define TWO(hi,lo) { hi, lo }
+# else
+# define TWO(hi,lo) { lo, hi }
+# endif
+/* Define like memory_positive_SNaNl(), see signed-snan.h and snan.h,
+ or like setpayloadsigl() with an arbitrary payload. */
+gl_LDBL_SNAN_t gl_LDBL_SNAN =
+# if LDBL_MANT_DIG == 53 /* on arm, hppa, mips, sh, but also MSVC */
+# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined
__sh__
+ /* sign bit: 0, 11 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
+ { { 0x7FFC000000000000ULL } }
+# else
+ /* sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
+ { { 0x7FF4000000000000ULL } }
+# endif
+# elif LDBL_MANT_DIG == 64 /* on i386, x86_64, ia64, m68k */
+# if defined __m68k__
+ /* sign bit: 0, 15 exponent bits: all 1, 16 gap bits: all 0,
+ always=1 bit: 1, next bit: 0, payload: 0b10...0 */
+ { { 0x7FFF0000ULL, 0xA0000000ULL, 0x00000000ULL } }
+# else
+ /* sign bit: 0, 15 exponent bits: all 1, always=1 bit: 1, next bit: 0,
payload: 0b10...0
+ (see
<https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format>)
*/
+ { TWO (0x00007FFFULL, 0xA000000000000000ULL) }
+# endif
+# elif LDBL_MANT_DIG == 106 /* on powerpc, powerpc64, powerpc64le */
+ /* most-significant double:
+ sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0,
+ least-significant double: 0.0 */
+ { { 0x7FF4000000000000ULL, 0ULL } }
+# elif LDBL_MANT_DIG == 113 /* on alpha, arm64, loongarch64, mips64, riscv64,
s390x, sparc64 */
+# if (defined __mips__ && !MIPS_NAN2008_FLOAT)
+ /* sign bit: 0, 15 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
+ { TWO (0x7FFFC00000000000ULL, 0ULL) }
+# else
+ /* sign bit: 0, 15 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
+ { TWO (0x7FFF400000000000ULL, 0ULL) }
+# endif
+# endif
+ ;
+#endif
+
/* This declaration is solely to ensure that after preprocessing
this file is never empty. */
typedef int dummy;
-#endif
diff --git a/gnulib/lib/float.in.h b/gnulib/lib/float.in.h
index 73e8d40621..5e78b4f296 100644
--- a/gnulib/lib/float.in.h
+++ b/gnulib/lib/float.in.h
@@ -28,6 +28,8 @@
#ifndef _@GUARD_PREFIX@_FLOAT_H
#define _@GUARD_PREFIX@_FLOAT_H
+/* ============================ ISO C99 support ============================ */
+
/* 'long double' properties. */
#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
@@ -179,6 +181,156 @@ extern const union gl_long_double_union gl_LDBL_MAX;
# endif
#endif
+/* ============================ ISO C11 support ============================ */
+
+/* 'float' properties */
+
+#ifndef FLT_HAS_SUBNORM
+# define FLT_HAS_SUBNORM 1
+#endif
+#ifndef FLT_DECIMAL_DIG
+/* FLT_MANT_DIG = 24 => FLT_DECIMAL_DIG = 9 */
+# define FLT_DECIMAL_DIG ((int)(FLT_MANT_DIG * 0.3010299956639812 + 2))
+#endif
+#if defined _AIX && !defined __GNUC__
+/* On AIX, the value of FLT_TRUE_MIN in /usr/include/float.h is a 'double',
+ not a 'float'. */
+# undef FLT_TRUE_MIN
+#endif
+#ifndef FLT_TRUE_MIN
+/* FLT_MIN / 2^(FLT_MANT_DIG-1) */
+# define FLT_TRUE_MIN (FLT_MIN / 8388608.0f)
+#endif
+
+/* 'double' properties */
+
+#ifndef DBL_HAS_SUBNORM
+# define DBL_HAS_SUBNORM 1
+#endif
+#ifndef DBL_DECIMAL_DIG
+/* DBL_MANT_DIG = 53 => DBL_DECIMAL_DIG = 17 */
+# define DBL_DECIMAL_DIG ((int)(DBL_MANT_DIG * 0.3010299956639812 + 2))
+#endif
+#ifndef DBL_TRUE_MIN
+/* DBL_MIN / 2^(DBL_MANT_DIG-1) */
+# define DBL_TRUE_MIN (DBL_MIN / 4503599627370496.0)
+#endif
+
+/* 'long double' properties */
+
+#ifndef LDBL_HAS_SUBNORM
+# define LDBL_HAS_SUBNORM 1
+#endif
+#ifndef LDBL_DECIMAL_DIG
+/* LDBL_MANT_DIG = 53 => LDBL_DECIMAL_DIG = 17 */
+/* LDBL_MANT_DIG = 64 => LDBL_DECIMAL_DIG = 21 */
+/* LDBL_MANT_DIG = 106 => LDBL_DECIMAL_DIG = 33 */
+/* LDBL_MANT_DIG = 113 => LDBL_DECIMAL_DIG = 36 */
+# define LDBL_DECIMAL_DIG ((int)(LDBL_MANT_DIG * 0.3010299956639812 + 2))
+#endif
+#ifndef LDBL_TRUE_MIN
+/* LDBL_MIN / 2^(LDBL_MANT_DIG-1) */
+# if LDBL_MANT_DIG == 53
+# define LDBL_TRUE_MIN (LDBL_MIN / 4503599627370496.0L)
+# elif LDBL_MANT_DIG == 64
+# if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__)
+/* Work around FreeBSD/x86 problem mentioned above. */
+extern const union gl_long_double_union gl_LDBL_TRUE_MIN;
+# define LDBL_TRUE_MIN (gl_LDBL_TRUE_MIN.ld)
+# else
+# define LDBL_TRUE_MIN (LDBL_MIN / 9223372036854775808.0L)
+# endif
+# elif LDBL_MANT_DIG == 106
+# define LDBL_TRUE_MIN (LDBL_MIN / 40564819207303340847894502572032.0L)
+# elif LDBL_MANT_DIG == 113
+# define LDBL_TRUE_MIN (LDBL_MIN / 5192296858534827628530496329220096.0L)
+# endif
+#endif
+
+/* ============================ ISO C23 support ============================ */
+
+/* 'float' properties */
+
+#ifndef FLT_IS_IEC_60559
+# if defined __m68k__
+# define FLT_IS_IEC_60559 0
+# else
+# define FLT_IS_IEC_60559 1
+# endif
+#endif
+#ifndef FLT_NORM_MAX
+# define FLT_NORM_MAX FLT_MAX
+#endif
+#ifndef FLT_SNAN
+/* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */
+# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined
__sh__
+# define FLT_SNAN __builtin_nansf ("")
+# else
+typedef union { unsigned int word[1]; float value; } gl_FLT_SNAN_t;
+extern gl_FLT_SNAN_t gl_FLT_SNAN;
+# define FLT_SNAN (gl_FLT_SNAN.value)
+# define GNULIB_defined_FLT_SNAN 1
+# endif
+#endif
+
+/* 'double' properties */
+
+#ifndef DBL_IS_IEC_60559
+# if defined __m68k__
+# define DBL_IS_IEC_60559 0
+# else
+# define DBL_IS_IEC_60559 1
+# endif
+#endif
+#ifndef DBL_NORM_MAX
+# define DBL_NORM_MAX DBL_MAX
+#endif
+#ifndef DBL_SNAN
+/* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */
+# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined
__sh__
+# define DBL_SNAN __builtin_nans ("")
+# else
+typedef union { unsigned long long word[1]; double value; } gl_DBL_SNAN_t;
+extern gl_DBL_SNAN_t gl_DBL_SNAN;
+# define DBL_SNAN (gl_DBL_SNAN.value)
+# define GNULIB_defined_DBL_SNAN 1
+# endif
+#endif
+
+/* 'long double' properties */
+
+#ifndef LDBL_IS_IEC_60559
+# if defined __m68k__
+# define LDBL_IS_IEC_60559 0
+# elif LDBL_MANT_DIG == 53 || LDBL_MANT_DIG == 113
+# define LDBL_IS_IEC_60559 1
+# else
+# define LDBL_IS_IEC_60559 0
+# endif
+#endif
+#ifndef LDBL_NORM_MAX
+# define LDBL_NORM_MAX LDBL_MAX
+#endif
+#ifndef LDBL_SNAN
+/* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */
+# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined
__sh__
+# define LDBL_SNAN __builtin_nansl ("")
+# else
+# if LDBL_MANT_DIG == 53
+typedef union { unsigned long long word[1]; long double value; }
gl_LDBL_SNAN_t;
+# elif defined __m68k__
+typedef union { unsigned int word[3]; long double value; } gl_LDBL_SNAN_t;
+# else
+typedef union { unsigned long long word[2]; long double value; }
gl_LDBL_SNAN_t;
+# endif
+extern gl_LDBL_SNAN_t gl_LDBL_SNAN;
+# define LDBL_SNAN (gl_LDBL_SNAN.value)
+# define GNULIB_defined_LDBL_SNAN 1
+# endif
+#endif
+
+/* ================================= Other ================================= */
+
#if @REPLACE_ITOLD@
/* Pull in a function that fixes the 'int' to 'long double' conversion
of glibc 2.7. */
diff --git a/gnulib/lib/glthread/lock.c b/gnulib/lib/glthread/lock.c
index 6661ad6a82..40b2a5ee4f 100644
--- a/gnulib/lib/glthread/lock.c
+++ b/gnulib/lib/glthread/lock.c
@@ -240,8 +240,6 @@ glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
return 0;
}
-/* -------------------------- gl_once_t datatype -------------------------- */
-
#endif
/* ========================================================================= */
@@ -698,46 +696,6 @@ glthread_recursive_lock_destroy_multithreaded
(gl_recursive_lock_t *lock)
# endif
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT;
-
-int
-glthread_once_singlethreaded (pthread_once_t *once_control)
-{
- /* We don't know whether pthread_once_t is an integer type, a floating-point
- type, a pointer type, or a structure type. */
- char *firstbyte = (char *)once_control;
- if (*firstbyte == *(const char *)&fresh_once)
- {
- /* First time use of once_control. Invert the first byte. */
- *firstbyte = ~ *(const char *)&fresh_once;
- return 1;
- }
- else
- return 0;
-}
-
-# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK)
-
-int
-glthread_once_multithreaded (pthread_once_t *once_control,
- void (*init_function) (void))
-{
- int err = pthread_once (once_control, init_function);
- if (err == ENOSYS)
- {
- /* This happens on FreeBSD 11: The pthread_once function in libc returns
- ENOSYS. */
- if (glthread_once_singlethreaded (once_control))
- init_function ();
- return 0;
- }
- return err;
-}
-
-# endif
-
#endif
/* ========================================================================= */
diff --git a/gnulib/lib/glthread/lock.h b/gnulib/lib/glthread/lock.h
index 2d5cb3209c..2b9c0f2e14 100644
--- a/gnulib/lib/glthread/lock.h
+++ b/gnulib/lib/glthread/lock.h
@@ -64,13 +64,6 @@
Taking the lock: err = glthread_recursive_lock_lock (&name);
Releasing the lock: err = glthread_recursive_lock_unlock (&name);
De-initialization: err = glthread_recursive_lock_destroy (&name);
-
- Once-only execution:
- Type: gl_once_t
- Initializer: gl_once_define(extern, name)
- Execution: gl_once (name, initfunction);
- Equivalent functions with control of error handling:
- Execution: err = glthread_once (&name, initfunction);
*/
@@ -88,17 +81,9 @@
#include <errno.h>
#include <stdlib.h>
-#if !defined c11_threads_in_use
-# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC
-# define c11_threads_in_use() 1
-# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK
-# include <threads.h>
-# pragma weak thrd_exit
-# define c11_threads_in_use() (thrd_exit != NULL)
-# else
-# define c11_threads_in_use() 0
-# endif
-#endif
+#include "glthread/once.h"
+
+/* c11_threads_in_use() is defined in glthread/once.h. */
/* ========================================================================= */
@@ -195,14 +180,6 @@ extern int glthread_recursive_lock_lock
(gl_recursive_lock_t *lock);
extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef once_flag gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS once_flag NAME = ONCE_FLAG_INIT;
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
- (call_once (ONCE_CONTROL, INITFUNCTION), 0)
-
# ifdef __cplusplus
}
# endif
@@ -221,80 +198,7 @@ typedef once_flag gl_once_t;
extern "C" {
# endif
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The pthread_in_use() detection needs to be done at runtime. */
-# define pthread_in_use() \
- glthread_in_use ()
-extern int glthread_in_use (void);
-
-# endif
-
-# if USE_POSIX_THREADS_WEAK
-
-/* Use weak references to the POSIX threads library. */
-
-/* Weak references avoid dragging in external libraries if the other parts
- of the program don't use them. Here we use them, because we don't want
- every program that uses libintl to depend on libpthread. This assumes
- that libpthread would not be loaded after libintl; i.e. if libintl is
- loaded first, by an executable that does not depend on libpthread, and
- then a module is dynamically loaded that depends on libpthread, libintl
- will not be multithread-safe. */
-
-/* The way to test at runtime whether libpthread is present is to test
- whether a function pointer's value, such as &pthread_mutex_init, is
- non-NULL. However, some versions of GCC have a bug through which, in
- PIC mode, &foo != NULL always evaluates to true if there is a direct
- call to foo(...) in the same function. To avoid this, we test the
- address of a function in libpthread that we don't use. */
-
-# pragma weak pthread_mutex_init
-# pragma weak pthread_mutex_lock
-# pragma weak pthread_mutex_unlock
-# pragma weak pthread_mutex_destroy
-# pragma weak pthread_rwlock_init
-# pragma weak pthread_rwlock_rdlock
-# pragma weak pthread_rwlock_wrlock
-# pragma weak pthread_rwlock_unlock
-# pragma weak pthread_rwlock_destroy
-# pragma weak pthread_once
-# pragma weak pthread_cond_init
-# pragma weak pthread_cond_wait
-# pragma weak pthread_cond_signal
-# pragma weak pthread_cond_broadcast
-# pragma weak pthread_cond_destroy
-# pragma weak pthread_mutexattr_init
-# pragma weak pthread_mutexattr_settype
-# pragma weak pthread_mutexattr_destroy
-# pragma weak pthread_rwlockattr_init
-# if __GNU_LIBRARY__ > 1
-# pragma weak pthread_rwlockattr_setkind_np
-# endif
-# pragma weak pthread_rwlockattr_destroy
-# ifndef pthread_self
-# pragma weak pthread_self
-# endif
-
-# if !PTHREAD_IN_USE_DETECTION_HARD
- /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols
- can be used to determine whether libpthread is in use. These are:
- pthread_mutexattr_gettype
- pthread_rwlockattr_destroy
- pthread_rwlockattr_init
- */
-# pragma weak pthread_mutexattr_gettype
-# define pthread_in_use() \
- (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
-# endif
-
-# else
-
-# if !PTHREAD_IN_USE_DETECTION_HARD
-# define pthread_in_use() 1
-# endif
-
-# endif
+/* pthread_in_use() is defined in glthread/once.h. */
/* -------------------------- gl_lock_t datatype -------------------------- */
@@ -510,26 +414,6 @@ extern int glthread_recursive_lock_destroy_multithreaded
(gl_recursive_lock_t *l
# endif
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef pthread_once_t gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
-# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
- (pthread_in_use ()
\
- ? pthread_once (ONCE_CONTROL, INITFUNCTION)
\
- : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) :
0))
-# else
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
- (pthread_in_use ()
\
- ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION)
\
- : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) :
0))
-extern int glthread_once_multithreaded (pthread_once_t *once_control,
- void (*init_function) (void));
-# endif
-extern int glthread_once_singlethreaded (pthread_once_t *once_control);
-
# ifdef __cplusplus
}
# endif
@@ -546,7 +430,6 @@ extern int glthread_once_singlethreaded (pthread_once_t
*once_control);
# include "windows-mutex.h"
# include "windows-rwlock.h"
# include "windows-recmutex.h"
-# include "windows-once.h"
# ifdef __cplusplus
extern "C" {
@@ -619,14 +502,6 @@ typedef glwthread_recmutex_t gl_recursive_lock_t;
# define glthread_recursive_lock_destroy(LOCK) \
glwthread_recmutex_destroy (LOCK)
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef glwthread_once_t gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT;
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
- (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0)
-
# ifdef __cplusplus
}
# endif
@@ -670,14 +545,6 @@ typedef int gl_recursive_lock_t;
# define glthread_recursive_lock_unlock(NAME) 0
# define glthread_recursive_lock_destroy(NAME) 0
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-typedef int gl_once_t;
-# define gl_once_define(STORAGECLASS, NAME) \
- STORAGECLASS gl_once_t NAME = 0;
-# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
- (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0)
-
#endif
/* ========================================================================= */
@@ -784,16 +651,6 @@ typedef int gl_once_t;
} \
while (0)
-/* -------------------------- gl_once_t datatype -------------------------- */
-
-#define gl_once(NAME, INITFUNCTION) \
- do \
- { \
- if (glthread_once (&NAME, INITFUNCTION)) \
- abort (); \
- } \
- while (0)
-
/* ========================================================================= */
#endif /* _LOCK_H */
diff --git a/gnulib/lib/glthread/once.c b/gnulib/lib/glthread/once.c
new file mode 100644
index 0000000000..869ba3ba9a
--- /dev/null
+++ b/gnulib/lib/glthread/once.c
@@ -0,0 +1,80 @@
+/* Once-only initialization in multithreaded situations.
+ Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+ Based on GCC's gthr-posix.h, gthr-posix95.h. */
+
+#include <config.h>
+
+#include "glthread/once.h"
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT;
+
+int
+glthread_once_singlethreaded (pthread_once_t *once_control)
+{
+ /* We don't know whether pthread_once_t is an integer type, a floating-point
+ type, a pointer type, or a structure type. */
+ char *firstbyte = (char *)once_control;
+ if (*firstbyte == *(const char *)&fresh_once)
+ {
+ /* First time use of once_control. Invert the first byte. */
+ *firstbyte = ~ *(const char *)&fresh_once;
+ return 1;
+ }
+ else
+ return 0;
+}
+
+# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK)
+
+int
+glthread_once_multithreaded (pthread_once_t *once_control,
+ void (*init_function) (void))
+{
+ int err = pthread_once (once_control, init_function);
+ if (err == ENOSYS)
+ {
+ /* This happens on FreeBSD 11: The pthread_once function in libc returns
+ ENOSYS. */
+ if (glthread_once_singlethreaded (once_control))
+ init_function ();
+ return 0;
+ }
+ return err;
+}
+
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+#endif
+
+/* ========================================================================= */
diff --git a/gnulib/lib/glthread/once.h b/gnulib/lib/glthread/once.h
new file mode 100644
index 0000000000..fd00e42350
--- /dev/null
+++ b/gnulib/lib/glthread/once.h
@@ -0,0 +1,266 @@
+/* Once-only initialization in multithreaded situations.
+ Copyright (C) 2005-2024 Free Software Foundation, Inc.
+
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.
+ Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */
+
+/* This file contains once-only initialization primitives for use with a given
+ thread library.
+ It does not contain primitives for creating threads or for other
+ synchronization primitives.
+
+ Once-only execution:
+ Type: gl_once_t
+ Initializer: gl_once_define(extern, name)
+ Execution: gl_once (name, initfunction);
+ Equivalent functions with control of error handling:
+ Execution: err = glthread_once (&name, initfunction);
+*/
+
+
+#ifndef _ONCE_H
+#define _ONCE_H
+
+/* This file uses HAVE_THREADS_H. */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+
+#if !defined c11_threads_in_use
+# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC
+# define c11_threads_in_use() 1
+# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK
+# include <threads.h>
+# pragma weak thrd_exit
+# define c11_threads_in_use() (thrd_exit != NULL)
+# else
+# define c11_threads_in_use() 0
+# endif
+#endif
+
+/* ========================================================================= */
+
+#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
+
+/* Use the ISO C threads library. */
+
+# include <threads.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef once_flag gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+ STORAGECLASS once_flag NAME = ONCE_FLAG_INIT;
+# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+ (call_once (ONCE_CONTROL, INITFUNCTION), 0)
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+/* Use the POSIX threads library. */
+
+# include <pthread.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if PTHREAD_IN_USE_DETECTION_HARD
+
+/* The pthread_in_use() detection needs to be done at runtime. */
+# define pthread_in_use() \
+ glthread_in_use ()
+extern int glthread_in_use (void);
+
+# endif
+
+# if USE_POSIX_THREADS_WEAK
+
+/* Use weak references to the POSIX threads library. */
+
+/* Weak references avoid dragging in external libraries if the other parts
+ of the program don't use them. Here we use them, because we don't want
+ every program that uses libintl to depend on libpthread. This assumes
+ that libpthread would not be loaded after libintl; i.e. if libintl is
+ loaded first, by an executable that does not depend on libpthread, and
+ then a module is dynamically loaded that depends on libpthread, libintl
+ will not be multithread-safe. */
+
+/* The way to test at runtime whether libpthread is present is to test
+ whether a function pointer's value, such as &pthread_mutex_init, is
+ non-NULL. However, some versions of GCC have a bug through which, in
+ PIC mode, &foo != NULL always evaluates to true if there is a direct
+ call to foo(...) in the same function. To avoid this, we test the
+ address of a function in libpthread that we don't use. */
+
+# pragma weak pthread_mutex_init
+# pragma weak pthread_mutex_lock
+# pragma weak pthread_mutex_unlock
+# pragma weak pthread_mutex_destroy
+# pragma weak pthread_rwlock_init
+# pragma weak pthread_rwlock_rdlock
+# pragma weak pthread_rwlock_wrlock
+# pragma weak pthread_rwlock_unlock
+# pragma weak pthread_rwlock_destroy
+# pragma weak pthread_once
+# pragma weak pthread_cond_init
+# pragma weak pthread_cond_wait
+# pragma weak pthread_cond_signal
+# pragma weak pthread_cond_broadcast
+# pragma weak pthread_cond_destroy
+# pragma weak pthread_mutexattr_init
+# pragma weak pthread_mutexattr_settype
+# pragma weak pthread_mutexattr_destroy
+# pragma weak pthread_rwlockattr_init
+# if __GNU_LIBRARY__ > 1
+# pragma weak pthread_rwlockattr_setkind_np
+# endif
+# pragma weak pthread_rwlockattr_destroy
+# ifndef pthread_self
+# pragma weak pthread_self
+# endif
+
+# if !PTHREAD_IN_USE_DETECTION_HARD
+ /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols
+ can be used to determine whether libpthread is in use. These are:
+ pthread_mutexattr_gettype
+ pthread_rwlockattr_destroy
+ pthread_rwlockattr_init
+ */
+# pragma weak pthread_mutexattr_gettype
+# define pthread_in_use() \
+ (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
+# endif
+
+# else
+
+# if !PTHREAD_IN_USE_DETECTION_HARD
+# define pthread_in_use() 1
+# endif
+
+# endif
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef pthread_once_t gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+ STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
+# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK
+# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+ (pthread_in_use ()
\
+ ? pthread_once (ONCE_CONTROL, INITFUNCTION)
\
+ : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) :
0))
+# else
+# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+ (pthread_in_use ()
\
+ ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION)
\
+ : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) :
0))
+extern int glthread_once_multithreaded (pthread_once_t *once_control,
+ void (*init_function) (void));
+# endif
+extern int glthread_once_singlethreaded (pthread_once_t *once_control);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if USE_WINDOWS_THREADS
+
+# define WIN32_LEAN_AND_MEAN /* avoid including junk */
+# include <windows.h>
+
+# include "windows-once.h"
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* We can use CRITICAL_SECTION directly, rather than the native Windows Event,
+ Mutex, Semaphore types, because
+ - we need only to synchronize inside a single process (address space),
+ not inter-process locking,
+ - we don't need to support trylock operations. (TryEnterCriticalSection
+ does not work on Windows 95/98/ME. Packages that need trylock usually
+ define their own mutex type.) */
+
+/* There is no way to statically initialize a CRITICAL_SECTION. It needs
+ to be done lazily, once only. For this we need spinlocks. */
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef glwthread_once_t gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+ STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT;
+# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+ (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0)
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+/* ========================================================================= */
+
+#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS ||
USE_WINDOWS_THREADS)
+
+/* Provide dummy implementation if threads are not supported. */
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+typedef int gl_once_t;
+# define gl_once_define(STORAGECLASS, NAME) \
+ STORAGECLASS gl_once_t NAME = 0;
+# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
+ (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0)
+
+#endif
+
+/* ========================================================================= */
+
+/* Macros with built-in error handling. */
+
+/* -------------------------- gl_once_t datatype -------------------------- */
+
+#define gl_once(NAME, INITFUNCTION) \
+ do \
+ { \
+ if (glthread_once (&NAME, INITFUNCTION)) \
+ abort (); \
+ } \
+ while (0)
+
+/* ========================================================================= */
+
+#endif /* _ONCE_H */
diff --git a/gnulib/lib/inttypes.in.h b/gnulib/lib/inttypes.in.h
index b9ab8a4b42..e9c80f3dca 100644
--- a/gnulib/lib/inttypes.in.h
+++ b/gnulib/lib/inttypes.in.h
@@ -970,7 +970,7 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
# define strtoimax rpl_strtoimax
# endif
_GL_FUNCDECL_RPL (strtoimax, intmax_t,
- (const char *restrict, char **restrict, int)
+ (const char *restrict, char **restrict, int),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtoimax, intmax_t,
(const char *restrict, char **restrict, int));
@@ -978,7 +978,7 @@ _GL_CXXALIAS_RPL (strtoimax, intmax_t,
# if !@HAVE_DECL_STRTOIMAX@
# undef strtoimax
_GL_FUNCDECL_SYS (strtoimax, intmax_t,
- (const char *restrict, char **restrict, int)
+ (const char *restrict, char **restrict, int),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtoimax, intmax_t,
@@ -1000,7 +1000,7 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
# define strtoumax rpl_strtoumax
# endif
_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
- (const char *restrict, char **restrict, int)
+ (const char *restrict, char **restrict, int),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtoumax, uintmax_t,
(const char *restrict, char **restrict, int));
@@ -1008,7 +1008,7 @@ _GL_CXXALIAS_RPL (strtoumax, uintmax_t,
# if !@HAVE_DECL_STRTOUMAX@
# undef strtoumax
_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
- (const char *restrict, char **restrict, int)
+ (const char *restrict, char **restrict, int),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtoumax, uintmax_t,
diff --git a/gnulib/lib/locale.in.h b/gnulib/lib/locale.in.h
index 1b11a41c4d..d025ef53ca 100644
--- a/gnulib/lib/locale.in.h
+++ b/gnulib/lib/locale.in.h
@@ -177,8 +177,10 @@ _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
_GL_CXXALIASWARN (localeconv);
# endif
#elif @REPLACE_STRUCT_LCONV@
-# undef localeconv
-# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
+# if !GNULIB_LOCALECONV
+# undef localeconv
+# define localeconv
localeconv_used_without_requesting_gnulib_module_localeconv
+# endif
#elif defined GNULIB_POSIXCHECK
# undef localeconv
# if HAVE_RAW_DECL_LOCALECONV
@@ -224,7 +226,7 @@ _GL_WARN_ON_USE (setlocale, "setlocale works differently on
native Windows - "
# define GNULIB_defined_newlocale 1
# endif
_GL_FUNCDECL_RPL (newlocale, locale_t,
- (int category_mask, const char *name, locale_t base)
+ (int category_mask, const char *name, locale_t base),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (newlocale, locale_t,
(int category_mask, const char *name, locale_t base));
@@ -257,7 +259,7 @@ _GL_WARN_ON_USE (newlocale, "newlocale is not portable");
# define duplocale rpl_duplocale
# define GNULIB_defined_duplocale 1
# endif
-_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL
((1)));
+_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale), _GL_ARG_NONNULL
((1)));
_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
# else
_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
@@ -286,7 +288,7 @@ _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some
glibc systems - "
# define freelocale rpl_freelocale
# define GNULIB_defined_freelocale 1
# endif
-_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (freelocale, void, (locale_t locale));
# else
# if @HAVE_FREELOCALE@
diff --git a/gnulib/lib/mbrtoc32.c b/gnulib/lib/mbrtoc32.c
index d97912876c..771c857d7d 100644
--- a/gnulib/lib/mbrtoc32.c
+++ b/gnulib/lib/mbrtoc32.c
@@ -117,7 +117,7 @@ mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t
*ps)
if (ps == NULL)
ps = &internal_state;
-# if HAVE_WORKING_MBRTOC32 && !MBRTOC32_MULTIBYTE_LOCALE_BUG
+# if HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB &&
!MBRTOC32_MULTIBYTE_LOCALE_BUG
/* mbrtoc32() may produce different values for wc than mbrtowc(). Therefore
use mbrtoc32(). */
diff --git a/gnulib/lib/printf-args.c b/gnulib/lib/printf-args.c
index eb0d2cdc0f..c20225039d 100644
--- a/gnulib/lib/printf-args.c
+++ b/gnulib/lib/printf-args.c
@@ -198,7 +198,6 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
if (ap->a.a_string == NULL)
ap->a.a_string = "(NULL)";
break;
-#if HAVE_WCHAR_T
case TYPE_WIDE_STRING:
ap->a.a_wide_string = va_arg (args, const wchar_t *);
/* A null pointer is an invalid argument for "%ls", but in practice
@@ -216,7 +215,6 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
ap->a.a_wide_string = wide_null_string;
}
break;
-#endif
case TYPE_POINTER:
ap->a.a_pointer = va_arg (args, void *);
break;
diff --git a/gnulib/lib/printf-args.h b/gnulib/lib/printf-args.h
index 9b80bb3929..24a86748b1 100644
--- a/gnulib/lib/printf-args.h
+++ b/gnulib/lib/printf-args.h
@@ -28,14 +28,9 @@
# define PRINTF_FETCHARGS printf_fetchargs
#endif
-/* Get size_t. */
+/* Get size_t, wchar_t. */
#include <stddef.h>
-/* Get wchar_t. */
-#if HAVE_WCHAR_T
-# include <stddef.h>
-#endif
-
/* Get wint_t. */
#if HAVE_WINT_T
# include <wchar.h>
@@ -89,9 +84,7 @@ typedef enum
TYPE_WIDE_CHAR,
#endif
TYPE_STRING,
-#if HAVE_WCHAR_T
TYPE_WIDE_STRING,
-#endif
TYPE_POINTER,
TYPE_COUNT_SCHAR_POINTER,
TYPE_COUNT_SHORT_POINTER,
@@ -154,9 +147,7 @@ typedef struct
wint_t a_wide_char;
#endif
const char* a_string;
-#if HAVE_WCHAR_T
const wchar_t* a_wide_string;
-#endif
void* a_pointer;
signed char * a_count_schar_pointer;
short * a_count_short_pointer;
diff --git a/gnulib/lib/printf-parse.c b/gnulib/lib/printf-parse.c
index a33e27a0b8..7628cb2335 100644
--- a/gnulib/lib/printf-parse.c
+++ b/gnulib/lib/printf-parse.c
@@ -600,20 +600,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d,
arguments *a)
if (signed_type == TYPE_LONGINT
/* For backward compatibility only. */
|| signed_type == TYPE_LONGLONGINT)
-#if HAVE_WCHAR_T
type = TYPE_WIDE_STRING;
-#else
- goto error;
-#endif
else
type = TYPE_STRING;
break;
-#if HAVE_WCHAR_T
case 'S':
type = TYPE_WIDE_STRING;
c = 's';
break;
-#endif
case 'p':
type = TYPE_POINTER;
break;
diff --git a/gnulib/lib/pthread.in.h b/gnulib/lib/pthread.in.h
index 81598616df..4bf35b5051 100644
--- a/gnulib/lib/pthread.in.h
+++ b/gnulib/lib/pthread.in.h
@@ -1,4 +1,4 @@
-/* Implement the most essential subset of POSIX 1003.1-2008 pthread.h.
+/* Implement the most essential subset of POSIX pthread.h.
Copyright (C) 2009-2024 Free Software Foundation, Inc.
@@ -275,7 +275,7 @@ typedef unsigned int pthread_rwlockattr_t;
# undef PTHREAD_RWLOCK_INITIALIZER
# define PTHREAD_RWLOCK_INITIALIZER { 0 }
# endif
-#elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e.
PTHREAD_RWLOCK_UNIMPLEMENTED */
+#elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_DESTROY@ /* i.e.
PTHREAD_RWLOCK_UNIMPLEMENTED */
# if @HAVE_PTHREAD_T@
# define pthread_rwlock_t rpl_pthread_rwlock_t
# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
@@ -296,6 +296,11 @@ typedef unsigned int pthread_rwlockattr_t;
# undef PTHREAD_RWLOCK_INITIALIZER
# define PTHREAD_RWLOCK_INITIALIZER \
{ PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER,
PTHREAD_COND_INITIALIZER, 0, 0 }
+#elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e.
PTHREAD_RWLOCK_BAD_WAITQUEUE */
+/* Use rwlocks of kind PREFER_WRITER or PREFER_WRITER_NONRECURSIVE instead of
+ the DEFAULT. */
+# undef PTHREAD_RWLOCK_INITIALIZER
+# define PTHREAD_RWLOCK_INITIALIZER
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
#else
# if @HAVE_PTHREAD_T@
# if !defined PTHREAD_RWLOCK_INITIALIZER && defined
PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
@@ -494,7 +499,7 @@ typedef unsigned int pthread_barrierattr_t;
_GL_FUNCDECL_RPL (pthread_create, int,
(pthread_t *restrict threadp,
const pthread_attr_t *restrict attr,
- void * (*mainfunc) (void *), void *restrict arg)
+ void * (*mainfunc) (void *), void *restrict arg),
_GL_ARG_NONNULL ((1, 3)));
_GL_CXXALIAS_RPL (pthread_create, int,
(pthread_t *restrict threadp,
@@ -505,7 +510,7 @@ _GL_CXXALIAS_RPL (pthread_create, int,
_GL_FUNCDECL_SYS (pthread_create, int,
(pthread_t *restrict threadp,
const pthread_attr_t *restrict attr,
- void * (*mainfunc) (void *), void *restrict arg)
+ void * (*mainfunc) (void *), void *restrict arg),
_GL_ARG_NONNULL ((1, 3)));
# endif
_GL_CXXALIAS_SYS_CAST (pthread_create, int,
@@ -530,12 +535,12 @@ _GL_WARN_ON_USE (pthread_create, "pthread_create is not
portable - "
# undef pthread_attr_init
# define pthread_attr_init rpl_pthread_attr_init
# endif
-_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr)
+_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
# else
# if !@HAVE_PTHREAD_ATTR_INIT@
-_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr)
+_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
@@ -558,14 +563,14 @@ _GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is
not portable - "
# define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
# endif
_GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
- (const pthread_attr_t *attr, int *detachstatep)
+ (const pthread_attr_t *attr, int *detachstatep),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
(const pthread_attr_t *attr, int *detachstatep));
# else
# if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
_GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
- (const pthread_attr_t *attr, int *detachstatep)
+ (const pthread_attr_t *attr, int *detachstatep),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
@@ -589,14 +594,14 @@ _GL_WARN_ON_USE (pthread_attr_getdetachstate,
"pthread_attr_getdetachstate is no
# define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
# endif
_GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
- (pthread_attr_t *attr, int detachstate)
+ (pthread_attr_t *attr, int detachstate),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
(pthread_attr_t *attr, int detachstate));
# else
# if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
_GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
- (pthread_attr_t *attr, int detachstate)
+ (pthread_attr_t *attr, int detachstate),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
@@ -619,12 +624,12 @@ _GL_WARN_ON_USE (pthread_attr_setdetachstate,
"pthread_attr_setdetachstate is no
# undef pthread_attr_destroy
# define pthread_attr_destroy rpl_pthread_attr_destroy
# endif
-_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr)
+_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
# else
# if !@HAVE_PTHREAD_ATTR_DESTROY@
-_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr)
+_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
@@ -646,11 +651,11 @@ _GL_WARN_ON_USE (pthread_attr_destroy,
"pthread_attr_destroy is not portable - "
# undef pthread_self
# define pthread_self rpl_pthread_self
# endif
-_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
# else
# if !@HAVE_PTHREAD_SELF@
-_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
# endif
@@ -775,14 +780,14 @@ _GL_WARN_ON_USE (pthread_exit, "pthread_exit is not
portable - "
# define pthread_once rpl_pthread_once
# endif
_GL_FUNCDECL_RPL (pthread_once, int,
- (pthread_once_t *once_control, void (*initfunction) (void))
+ (pthread_once_t *once_control, void (*initfunction) (void)),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (pthread_once, int,
(pthread_once_t *once_control, void (*initfunction) (void)));
# else
# if !@HAVE_PTHREAD_ONCE@
_GL_FUNCDECL_SYS (pthread_once, int,
- (pthread_once_t *once_control, void (*initfunction) (void))
+ (pthread_once_t *once_control, void (*initfunction) (void)),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS_CAST (pthread_once, int,
@@ -810,7 +815,7 @@ _GL_WARN_ON_USE (pthread_once, "pthread_once is not
portable - "
# endif
_GL_FUNCDECL_RPL (pthread_mutex_init, int,
(pthread_mutex_t *restrict mutex,
- const pthread_mutexattr_t *restrict attr)
+ const pthread_mutexattr_t *restrict attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_mutex_init, int,
(pthread_mutex_t *restrict mutex,
@@ -819,7 +824,7 @@ _GL_CXXALIAS_RPL (pthread_mutex_init, int,
# if !@HAVE_PTHREAD_MUTEX_INIT@
_GL_FUNCDECL_SYS (pthread_mutex_init, int,
(pthread_mutex_t *restrict mutex,
- const pthread_mutexattr_t *restrict attr)
+ const pthread_mutexattr_t *restrict attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutex_init, int,
@@ -843,12 +848,12 @@ _GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init
is not portable - "
# undef pthread_mutexattr_init
# define pthread_mutexattr_init rpl_pthread_mutexattr_init
# endif
-_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
+_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
# else
# if !@HAVE_PTHREAD_MUTEXATTR_INIT@
-_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
+_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
@@ -872,7 +877,7 @@ _GL_WARN_ON_USE (pthread_mutexattr_init,
"pthread_mutexattr_init is not portable
# endif
_GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
(const pthread_mutexattr_t *restrict attr,
- int *restrict typep)
+ int *restrict typep),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
(const pthread_mutexattr_t *restrict attr,
@@ -881,7 +886,7 @@ _GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
# if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
_GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
(const pthread_mutexattr_t *restrict attr,
- int *restrict typep)
+ int *restrict typep),
_GL_ARG_NONNULL ((1, 2)));
# endif
/* Need to cast, because on FreeBSD the first parameter is
@@ -908,13 +913,13 @@ _GL_WARN_ON_USE (pthread_mutexattr_gettype,
"pthread_mutexattr_gettype is not po
# define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
# endif
_GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
- (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
+ (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL
((1)));
_GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
(pthread_mutexattr_t *attr, int type));
# else
# if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
_GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
- (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
+ (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL
((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
(pthread_mutexattr_t *attr, int type));
@@ -938,7 +943,7 @@ _GL_WARN_ON_USE (pthread_mutexattr_settype,
"pthread_mutexattr_settype is not po
# endif
_GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
(const pthread_mutexattr_t *restrict attr,
- int *restrict robustp)
+ int *restrict robustp),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
(const pthread_mutexattr_t *restrict attr,
@@ -947,7 +952,7 @@ _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
# if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
_GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
(const pthread_mutexattr_t *restrict attr,
- int *restrict robustp)
+ int *restrict robustp),
_GL_ARG_NONNULL ((1, 2)));
# endif
/* Need to cast, because on FreeBSD the first parameter is
@@ -974,14 +979,14 @@ _GL_WARN_ON_USE (pthread_mutexattr_getrobust,
"pthread_mutexattr_getrobust is no
# define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
# endif
_GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
- (pthread_mutexattr_t *attr, int robust)
+ (pthread_mutexattr_t *attr, int robust),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
(pthread_mutexattr_t *attr, int robust));
# else
# if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
_GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
- (pthread_mutexattr_t *attr, int robust)
+ (pthread_mutexattr_t *attr, int robust),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
@@ -1004,12 +1009,12 @@ _GL_WARN_ON_USE (pthread_mutexattr_setrobust,
"pthread_mutexattr_setrobust is no
# undef pthread_mutexattr_destroy
# define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
# endif
-_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
+_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
# else
# if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
-_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
+_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
@@ -1031,12 +1036,12 @@ _GL_WARN_ON_USE (pthread_mutexattr_destroy,
"pthread_mutexattr_destroy is not po
# undef pthread_mutex_lock
# define pthread_mutex_lock rpl_pthread_mutex_lock
# endif
-_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
+_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
# else
# if !@HAVE_PTHREAD_MUTEX_LOCK@
-_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
+_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
@@ -1058,12 +1063,12 @@ _GL_WARN_ON_USE (pthread_mutex_lock,
"pthread_mutex_lock is not portable - "
# undef pthread_mutex_trylock
# define pthread_mutex_trylock rpl_pthread_mutex_trylock
# endif
-_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
+_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
# else
# if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
-_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
+_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
@@ -1087,7 +1092,7 @@ _GL_WARN_ON_USE (pthread_mutex_trylock,
"pthread_mutex_trylock is not portable -
# endif
_GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
(pthread_mutex_t *restrict mutex,
- const struct timespec *restrict abstime)
+ const struct timespec *restrict abstime),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
(pthread_mutex_t *restrict mutex,
@@ -1096,7 +1101,7 @@ _GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
# if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
_GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
(pthread_mutex_t *restrict mutex,
- const struct timespec *restrict abstime)
+ const struct timespec *restrict abstime),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
@@ -1120,12 +1125,12 @@ _GL_WARN_ON_USE (pthread_mutex_timedlock,
"pthread_mutex_timedlock is not portab
# undef pthread_mutex_unlock
# define pthread_mutex_unlock rpl_pthread_mutex_unlock
# endif
-_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
+_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
# else
# if !@HAVE_PTHREAD_MUTEX_UNLOCK@
-_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
+_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
@@ -1147,12 +1152,12 @@ _GL_WARN_ON_USE (pthread_mutex_unlock,
"pthread_mutex_unlock is not portable - "
# undef pthread_mutex_destroy
# define pthread_mutex_destroy rpl_pthread_mutex_destroy
# endif
-_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
+_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
# else
# if !@HAVE_PTHREAD_MUTEX_DESTROY@
-_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
+_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
@@ -1178,7 +1183,7 @@ _GL_WARN_ON_USE (pthread_mutex_destroy,
"pthread_mutex_destroy is not portable -
# endif
_GL_FUNCDECL_RPL (pthread_rwlock_init, int,
(pthread_rwlock_t *restrict lock,
- const pthread_rwlockattr_t *restrict attr)
+ const pthread_rwlockattr_t *restrict attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlock_init, int,
(pthread_rwlock_t *restrict lock,
@@ -1187,7 +1192,7 @@ _GL_CXXALIAS_RPL (pthread_rwlock_init, int,
# if !@HAVE_PTHREAD_RWLOCK_INIT@
_GL_FUNCDECL_SYS (pthread_rwlock_init, int,
(pthread_rwlock_t *restrict lock,
- const pthread_rwlockattr_t *restrict attr)
+ const pthread_rwlockattr_t *restrict attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_init, int,
@@ -1211,12 +1216,12 @@ _GL_WARN_ON_USE (pthread_rwlock_init,
"pthread_rwlock_init is not portable - "
# undef pthread_rwlockattr_init
# define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
# endif
-_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
+_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
# else
# if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
-_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
+_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
@@ -1239,13 +1244,13 @@ _GL_WARN_ON_USE (pthread_rwlockattr_init,
"pthread_rwlockattr_init is not portab
# define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
# endif
_GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
- (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
+ (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
(pthread_rwlockattr_t *attr));
# else
# if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
_GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
- (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
+ (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
(pthread_rwlockattr_t *attr));
@@ -1267,12 +1272,12 @@ _GL_WARN_ON_USE (pthread_rwlockattr_destroy,
"pthread_rwlockattr_destroy is not
# undef pthread_rwlock_rdlock
# define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
# endif
-_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
# else
# if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
-_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
@@ -1294,12 +1299,12 @@ _GL_WARN_ON_USE (pthread_rwlock_rdlock,
"pthread_rwlock_rdlock is not portable -
# undef pthread_rwlock_wrlock
# define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
# endif
-_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
# else
# if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
-_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
@@ -1321,12 +1326,12 @@ _GL_WARN_ON_USE (pthread_rwlock_wrlock,
"pthread_rwlock_wrlock is not portable -
# undef pthread_rwlock_tryrdlock
# define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
# endif
-_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
# else
# if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
-_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
@@ -1348,12 +1353,12 @@ _GL_WARN_ON_USE (pthread_rwlock_tryrdlock,
"pthread_rwlock_tryrdlock is not port
# undef pthread_rwlock_trywrlock
# define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
# endif
-_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
# else
# if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
-_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
@@ -1377,7 +1382,7 @@ _GL_WARN_ON_USE (pthread_rwlock_trywrlock,
"pthread_rwlock_trywrlock is not port
# endif
_GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
(pthread_rwlock_t *restrict lock,
- const struct timespec *restrict abstime)
+ const struct timespec *restrict abstime),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
(pthread_rwlock_t *restrict lock,
@@ -1386,7 +1391,7 @@ _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
# if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
_GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
(pthread_rwlock_t *restrict lock,
- const struct timespec *restrict abstime)
+ const struct timespec *restrict abstime),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
@@ -1412,7 +1417,7 @@ _GL_WARN_ON_USE (pthread_rwlock_timedrdlock,
"pthread_rwlock_timedrdlock is not
# endif
_GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
(pthread_rwlock_t *restrict lock,
- const struct timespec *restrict abstime)
+ const struct timespec *restrict abstime),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
(pthread_rwlock_t *restrict lock,
@@ -1421,7 +1426,7 @@ _GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
# if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
_GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
(pthread_rwlock_t *restrict lock,
- const struct timespec *restrict abstime)
+ const struct timespec *restrict abstime),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
@@ -1445,12 +1450,12 @@ _GL_WARN_ON_USE (pthread_rwlock_timedwrlock,
"pthread_rwlock_timedwrlock is not
# undef pthread_rwlock_unlock
# define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
# endif
-_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
# else
# if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
-_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
@@ -1472,12 +1477,12 @@ _GL_WARN_ON_USE (pthread_rwlock_unlock,
"pthread_rwlock_unlock is not portable -
# undef pthread_rwlock_destroy
# define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
# endif
-_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
# else
# if !@HAVE_PTHREAD_RWLOCK_DESTROY@
-_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
@@ -1503,7 +1508,7 @@ _GL_WARN_ON_USE (pthread_rwlock_destroy,
"pthread_rwlock_destroy is not portable
# endif
_GL_FUNCDECL_RPL (pthread_cond_init, int,
(pthread_cond_t *restrict cond,
- const pthread_condattr_t *restrict attr)
+ const pthread_condattr_t *restrict attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_cond_init, int,
(pthread_cond_t *restrict cond,
@@ -1512,7 +1517,7 @@ _GL_CXXALIAS_RPL (pthread_cond_init, int,
# if !@HAVE_PTHREAD_COND_INIT@
_GL_FUNCDECL_SYS (pthread_cond_init, int,
(pthread_cond_t *restrict cond,
- const pthread_condattr_t *restrict attr)
+ const pthread_condattr_t *restrict attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_cond_init, int,
@@ -1536,12 +1541,12 @@ _GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init
is not portable - "
# undef pthread_condattr_init
# define pthread_condattr_init rpl_pthread_condattr_init
# endif
-_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr)
+_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
# else
# if !@HAVE_PTHREAD_CONDATTR_INIT@
-_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr)
+_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
@@ -1563,12 +1568,12 @@ _GL_WARN_ON_USE (pthread_condattr_init,
"pthread_condattr_init is not portable -
# undef pthread_condattr_destroy
# define pthread_condattr_destroy rpl_pthread_condattr_destroy
# endif
-_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
+_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
# else
# if !@HAVE_PTHREAD_CONDATTR_DESTROY@
-_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
+_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
@@ -1592,7 +1597,7 @@ _GL_WARN_ON_USE (pthread_condattr_destroy,
"pthread_condattr_destroy is not port
# endif
_GL_FUNCDECL_RPL (pthread_cond_wait, int,
(pthread_cond_t *restrict cond,
- pthread_mutex_t *restrict mutex)
+ pthread_mutex_t *restrict mutex),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (pthread_cond_wait, int,
(pthread_cond_t *restrict cond,
@@ -1601,7 +1606,7 @@ _GL_CXXALIAS_RPL (pthread_cond_wait, int,
# if !@HAVE_PTHREAD_COND_WAIT@
_GL_FUNCDECL_SYS (pthread_cond_wait, int,
(pthread_cond_t *restrict cond,
- pthread_mutex_t *restrict mutex)
+ pthread_mutex_t *restrict mutex),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (pthread_cond_wait, int,
@@ -1628,7 +1633,7 @@ _GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is
not portable - "
_GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
(pthread_cond_t *restrict cond,
pthread_mutex_t *restrict mutex,
- const struct timespec *restrict abstime)
+ const struct timespec *restrict abstime),
_GL_ARG_NONNULL ((1, 2, 3)));
_GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
(pthread_cond_t *restrict cond,
@@ -1639,7 +1644,7 @@ _GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
_GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
(pthread_cond_t *restrict cond,
pthread_mutex_t *restrict mutex,
- const struct timespec *restrict abstime)
+ const struct timespec *restrict abstime),
_GL_ARG_NONNULL ((1, 2, 3)));
# endif
_GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
@@ -1664,12 +1669,12 @@ _GL_WARN_ON_USE (pthread_cond_timedwait,
"pthread_cond_timedwait is not portable
# undef pthread_cond_signal
# define pthread_cond_signal rpl_pthread_cond_signal
# endif
-_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond)
+_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
# else
# if !@HAVE_PTHREAD_COND_SIGNAL@
-_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond)
+_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
@@ -1691,12 +1696,12 @@ _GL_WARN_ON_USE (pthread_cond_signal,
"pthread_cond_signal is not portable - "
# undef pthread_cond_broadcast
# define pthread_cond_broadcast rpl_pthread_cond_broadcast
# endif
-_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond)
+_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
# else
# if !@HAVE_PTHREAD_COND_BROADCAST@
-_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond)
+_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
@@ -1718,12 +1723,12 @@ _GL_WARN_ON_USE (pthread_cond_broadcast,
"pthread_cond_broadcast is not portable
# undef pthread_cond_destroy
# define pthread_cond_destroy rpl_pthread_cond_destroy
# endif
-_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond)
+_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
# else
# if !@HAVE_PTHREAD_COND_DESTROY@
-_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond)
+_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
@@ -1748,14 +1753,14 @@ _GL_WARN_ON_USE (pthread_cond_destroy,
"pthread_cond_destroy is not portable - "
# define pthread_key_create rpl_pthread_key_create
# endif
_GL_FUNCDECL_RPL (pthread_key_create, int,
- (pthread_key_t *keyp, void (*destructor) (void *))
+ (pthread_key_t *keyp, void (*destructor) (void *)),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_key_create, int,
(pthread_key_t *keyp, void (*destructor) (void *)));
# else
# if !@HAVE_PTHREAD_KEY_CREATE@
_GL_FUNCDECL_SYS (pthread_key_create, int,
- (pthread_key_t *keyp, void (*destructor) (void *))
+ (pthread_key_t *keyp, void (*destructor) (void *)),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
@@ -1860,14 +1865,14 @@ _GL_WARN_ON_USE (pthread_key_delete,
"pthread_key_delete is not portable - "
# define pthread_spin_init rpl_pthread_spin_init
# endif
_GL_FUNCDECL_RPL (pthread_spin_init, int,
- (pthread_spinlock_t *lock, int shared_across_processes)
+ (pthread_spinlock_t *lock, int shared_across_processes),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_spin_init, int,
(pthread_spinlock_t *lock, int shared_across_processes));
# else
# if !@HAVE_PTHREAD_SPIN_INIT@
_GL_FUNCDECL_SYS (pthread_spin_init, int,
- (pthread_spinlock_t *lock, int shared_across_processes)
+ (pthread_spinlock_t *lock, int shared_across_processes),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_spin_init, int,
@@ -1890,12 +1895,12 @@ _GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init
is not portable - "
# undef pthread_spin_lock
# define pthread_spin_lock rpl_pthread_spin_lock
# endif
-_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
# else
# if !@HAVE_PTHREAD_SPIN_LOCK@
-_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
@@ -1917,12 +1922,12 @@ _GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock
is not portable - "
# undef pthread_spin_trylock
# define pthread_spin_trylock rpl_pthread_spin_trylock
# endif
-_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
# else
# if !@HAVE_PTHREAD_SPIN_TRYLOCK@
-_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
@@ -1944,12 +1949,12 @@ _GL_WARN_ON_USE (pthread_spin_trylock,
"pthread_spin_trylock is not portable - "
# undef pthread_spin_unlock
# define pthread_spin_unlock rpl_pthread_spin_unlock
# endif
-_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
# else
# if !@HAVE_PTHREAD_SPIN_UNLOCK@
-_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
@@ -1971,12 +1976,12 @@ _GL_WARN_ON_USE (pthread_spin_unlock,
"pthread_spin_unlock is not portable - "
# undef pthread_spin_destroy
# define pthread_spin_destroy rpl_pthread_spin_destroy
# endif
-_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
+_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
# else
# if !@HAVE_PTHREAD_SPIN_DESTROY@
-_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
+_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
diff --git a/gnulib/lib/stddef.in.h b/gnulib/lib/stddef.in.h
index 63bb500e26..49449315cf 100644
--- a/gnulib/lib/stddef.in.h
+++ b/gnulib/lib/stddef.in.h
@@ -131,7 +131,7 @@ typedef long max_align_t;
*/
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
-# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
@@ -149,11 +149,6 @@ typedef long max_align_t;
# endif
#endif
-/* Some platforms lack wchar_t. */
-#if !@HAVE_WCHAR_T@
-# define wchar_t int
-#endif
-
/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is
a hack in case the configure-time test was done with g++ even though
we are currently compiling with gcc.
diff --git a/gnulib/lib/stdio.in.h b/gnulib/lib/stdio.in.h
index 1c0c9661bf..e693fd7d06 100644
--- a/gnulib/lib/stdio.in.h
+++ b/gnulib/lib/stdio.in.h
@@ -64,8 +64,8 @@
#define _@GUARD_PREFIX@_STDIO_H
/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT,
- _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK,
- HAVE_RAW_DECL_*. */
+ _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW,
+ GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -155,7 +155,7 @@
*/
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
-# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
@@ -280,18 +280,37 @@
#endif
+#if @GNULIB_DZPRINTF@
+/* Prints formatted output to file descriptor FD.
+ Returns the number of bytes written to the file descriptor. Upon
+ failure, returns -1 with errno set.
+ Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure codes are ENOMEM
+ and the possible failure codes from write(), excluding EINTR. */
+_GL_FUNCDECL_SYS (dzprintf, off64_t,
+ (int fd, const char *restrict format, ...),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_SYS (dzprintf, off64_t,
+ (int fd, const char *restrict format, ...));
+#endif
+
#if @GNULIB_DPRINTF@
+/* Prints formatted output to file descriptor FD.
+ Returns the number of bytes written to the file descriptor. Upon
+ failure, returns a negative value. */
# if @REPLACE_DPRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define dprintf rpl_dprintf
# endif
-_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...)
+_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
# else
# if !@HAVE_DPRINTF@
-_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...)
+_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
_GL_ARG_NONNULL ((2)));
# endif
@@ -314,7 +333,7 @@ _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define fclose rpl_fclose
# endif
-_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (fclose, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
# else
_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
@@ -361,9 +380,10 @@ _GL_CXXALIASWARN (fcloseall);
# define fdopen rpl_fdopen
# endif
_GL_FUNCDECL_RPL (fdopen, FILE *,
- (int fd, const char *mode)
+ (int fd, const char *mode),
_GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -376,15 +396,17 @@ _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char
*mode));
/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (fdopen, FILE *,
- (int fd, const char *mode)
- _GL_ATTRIBUTE_NOTHROW
+ (int fd, const char *mode),
_GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC
+ _GL_ATTRIBUTE_NODISCARD)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (fdopen, FILE *,
- (int fd, const char *mode)
+ (int fd, const char *mode),
_GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC
+ _GL_ATTRIBUTE_NODISCARD);
# endif
# endif
_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
@@ -395,13 +417,13 @@ _GL_CXXALIASWARN (fdopen);
/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (fdopen, FILE *,
- (int fd, const char *mode)
- _GL_ATTRIBUTE_NOTHROW
+ (int fd, const char *mode),
_GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (fdopen, FILE *,
- (int fd, const char *mode)
+ (int fd, const char *mode),
_GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
_GL_ATTRIBUTE_MALLOC);
# endif
@@ -460,7 +482,7 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX
compliant - "
# undef fgetc
# define fgetc rpl_fgetc
# endif
-_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
# else
_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
@@ -477,8 +499,8 @@ _GL_CXXALIASWARN (fgetc);
# define fgets rpl_fgets
# endif
_GL_FUNCDECL_RPL (fgets, char *,
- (char *restrict s, int n, FILE *restrict stream)
- _GL_ARG_NONNULL ((1, 3)));
+ (char *restrict s, int n, FILE *restrict stream),
+ _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fgets, char *,
(char *restrict s, int n, FILE *restrict stream));
# else
@@ -514,17 +536,18 @@ _GL_CXXALIASWARN (fileno);
# define fopen rpl_fopen
# endif
_GL_FUNCDECL_RPL (fopen, FILE *,
- (const char *restrict filename, const char *restrict mode)
+ (const char *restrict filename, const char *restrict mode),
_GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fopen, FILE *,
(const char *restrict filename, const char *restrict mode));
# else
# if __GNUC__ >= 11
/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
_GL_FUNCDECL_SYS (fopen, FILE *,
- (const char *restrict filename, const char *restrict mode)
- _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
+ (const char *restrict filename, const char *restrict mode),
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
+ _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (fopen, FILE *,
(const char *restrict filename, const char *restrict mode));
@@ -536,7 +559,7 @@ _GL_CXXALIASWARN (fopen);
# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen
/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
_GL_FUNCDECL_SYS (fopen, FILE *,
- (const char *restrict filename, const char *restrict mode)
+ (const char *restrict filename, const char *restrict mode),
_GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
# endif
# if defined GNULIB_POSIXCHECK
@@ -547,7 +570,26 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms
is not POSIX complian
# endif
#endif
+#if @GNULIB_FZPRINTF@
+/* Prints formatted output to stream FP.
+ Returns the number of bytes written to the stream. Upon failure,
+ returns -1 with the stream's error indicator set.
+ Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure causes are ENOMEM
+ and the possible failure causes from fwrite(). */
+_GL_FUNCDECL_SYS (fzprintf, off64_t,
+ (FILE *restrict fp, const char *restrict format, ...),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (fzprintf, off64_t,
+ (FILE *restrict fp, const char *restrict format, ...));
+#endif
+
#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
+/* Prints formatted output to stream FP.
+ Returns the number of bytes written to the stream. Upon failure,
+ returns a negative value with the stream's error indicator set. */
# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
|| (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ &&
(@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -556,12 +598,12 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows
platforms is not POSIX complian
# define GNULIB_overrides_fprintf 1
# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
_GL_FUNCDECL_RPL (fprintf, int,
- (FILE *restrict fp, const char *restrict format, ...)
+ (FILE *restrict fp, const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
_GL_ARG_NONNULL ((1, 2)));
# else
_GL_FUNCDECL_RPL (fprintf, int,
- (FILE *restrict fp, const char *restrict format, ...)
+ (FILE *restrict fp, const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
_GL_ARG_NONNULL ((1, 2)));
# endif
@@ -596,11 +638,11 @@ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX
compliant - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define fpurge rpl_fpurge
# endif
-_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
# else
# if !@HAVE_DECL_FPURGE@
-_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
# endif
@@ -619,7 +661,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
# undef fputc
# define fputc rpl_fputc
# endif
-_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
+_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
# else
_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
@@ -636,7 +678,7 @@ _GL_CXXALIASWARN (fputc);
# define fputs rpl_fputs
# endif
_GL_FUNCDECL_RPL (fputs, int,
- (const char *restrict string, FILE *restrict stream)
+ (const char *restrict string, FILE *restrict stream),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (fputs, int,
(const char *restrict string, FILE *restrict stream));
@@ -657,8 +699,8 @@ _GL_CXXALIASWARN (fputs);
# endif
_GL_FUNCDECL_RPL (fread, size_t,
(void *restrict ptr, size_t s, size_t n,
- FILE *restrict stream)
- _GL_ARG_NONNULL ((4)));
+ FILE *restrict stream),
+ _GL_ARG_NONNULL ((4)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fread, size_t,
(void *restrict ptr, size_t s, size_t n,
FILE *restrict stream));
@@ -680,8 +722,8 @@ _GL_CXXALIASWARN (fread);
# endif
_GL_FUNCDECL_RPL (freopen, FILE *,
(const char *restrict filename, const char *restrict mode,
- FILE *restrict stream)
- _GL_ARG_NONNULL ((2, 3)));
+ FILE *restrict stream),
+ _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (freopen, FILE *,
(const char *restrict filename, const char *restrict mode,
FILE *restrict stream));
@@ -708,9 +750,9 @@ _GL_WARN_ON_USE (freopen,
# define fscanf rpl_fscanf
# endif
_GL_FUNCDECL_RPL (fscanf, int,
- (FILE *restrict stream, const char *restrict format, ...)
+ (FILE *restrict stream, const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fscanf, int,
(FILE *restrict stream, const char *restrict format, ...));
# else
@@ -764,7 +806,7 @@ _GL_CXXALIASWARN (fscanf);
# undef fseek
# define fseek rpl_fseek
# endif
-_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
+_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
# else
@@ -787,12 +829,12 @@ _GL_CXXALIASWARN (fseek);
# undef fseeko
# define fseeko rpl_fseeko
# endif
-_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
+_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
# else
# if ! @HAVE_DECL_FSEEKO@
-_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
+_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
@@ -830,7 +872,8 @@ _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger
than 4 GB "
# undef ftell
# define ftell rpl_ftell
# endif
-_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (ftell, long, (FILE *fp),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
# else
_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
@@ -850,11 +893,13 @@ _GL_CXXALIASWARN (ftell);
# undef ftello
# define ftello rpl_ftello
# endif
-_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp),
+ _GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
# else
# if ! @HAVE_DECL_FTELLO@
-_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp),
+ _GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
# endif
@@ -887,7 +932,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger
than 4 GB "
# endif
_GL_FUNCDECL_RPL (fwrite, size_t,
(const void *restrict ptr, size_t s, size_t n,
- FILE *restrict stream)
+ FILE *restrict stream),
_GL_ARG_NONNULL ((1, 4)));
_GL_CXXALIAS_RPL (fwrite, size_t,
(const void *restrict ptr, size_t s, size_t n,
@@ -931,7 +976,7 @@ _GL_CXXALIASWARN (fwrite);
# undef getc
# define getc rpl_fgetc
# endif
-_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
# else
_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
@@ -972,8 +1017,8 @@ _GL_CXXALIASWARN (getchar);
_GL_FUNCDECL_RPL (getdelim, ssize_t,
(char **restrict lineptr, size_t *restrict linesize,
int delimiter,
- FILE *restrict stream)
- _GL_ARG_NONNULL ((1, 2, 4)));
+ FILE *restrict stream),
+ _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (getdelim, ssize_t,
(char **restrict lineptr, size_t *restrict linesize,
int delimiter,
@@ -983,8 +1028,8 @@ _GL_CXXALIAS_RPL (getdelim, ssize_t,
_GL_FUNCDECL_SYS (getdelim, ssize_t,
(char **restrict lineptr, size_t *restrict linesize,
int delimiter,
- FILE *restrict stream)
- _GL_ARG_NONNULL ((1, 2, 4)));
+ FILE *restrict stream),
+ _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (getdelim, ssize_t,
(char **restrict lineptr, size_t *restrict linesize,
@@ -1016,8 +1061,8 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
# endif
_GL_FUNCDECL_RPL (getline, ssize_t,
(char **restrict lineptr, size_t *restrict linesize,
- FILE *restrict stream)
- _GL_ARG_NONNULL ((1, 2, 3)));
+ FILE *restrict stream),
+ _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (getline, ssize_t,
(char **restrict lineptr, size_t *restrict linesize,
FILE *restrict stream));
@@ -1025,8 +1070,8 @@ _GL_CXXALIAS_RPL (getline, ssize_t,
# if !@HAVE_DECL_GETLINE@
_GL_FUNCDECL_SYS (getline, ssize_t,
(char **restrict lineptr, size_t *restrict linesize,
- FILE *restrict stream)
- _GL_ARG_NONNULL ((1, 2, 3)));
+ FILE *restrict stream),
+ _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (getline, ssize_t,
(char **restrict lineptr, size_t *restrict linesize,
@@ -1075,19 +1120,45 @@ _GL_CXXALIASWARN (getw);
# endif
#endif
+#if @GNULIB_OBSTACK_ZPRINTF@
+struct obstack;
+/* Grows an obstack with formatted output. Returns the number of
+ bytes added to OBS. No trailing nul byte is added, and the
+ object should be closed with obstack_finish before use.
+ Upon memory allocation error, calls obstack_alloc_failed_handler.
+ Upon other error, returns -1 with errno set.
+
+ Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure code is through
+ obstack_alloc_failed_handler. */
+_GL_FUNCDECL_SYS (obstack_zprintf, ptrdiff_t,
+ (struct obstack *obs, const char *format, ...),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (obstack_zprintf, ptrdiff_t,
+ (struct obstack *obs, const char *format, ...));
+_GL_FUNCDECL_SYS (obstack_vzprintf, ptrdiff_t,
+ (struct obstack *obs, const char *format, va_list args),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (obstack_vzprintf, ptrdiff_t,
+ (struct obstack *obs, const char *format, va_list args));
+#endif
+
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
struct obstack;
-/* Grow an obstack with formatted output. Return the number of
+/* Grows an obstack with formatted output. Returns the number of
bytes added to OBS. No trailing nul byte is added, and the
- object should be closed with obstack_finish before use. Upon
- memory allocation error, call obstack_alloc_failed_handler. Upon
- other error, return -1. */
+ object should be closed with obstack_finish before use.
+ Upon memory allocation error, calls obstack_alloc_failed_handler.
+ Upon other error, returns -1. */
# if @REPLACE_OBSTACK_PRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define obstack_printf rpl_obstack_printf
# endif
_GL_FUNCDECL_RPL (obstack_printf, int,
- (struct obstack *obs, const char *format, ...)
+ (struct obstack *obs, const char *format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (obstack_printf, int,
@@ -1095,7 +1166,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int,
# else
# if !@HAVE_DECL_OBSTACK_PRINTF@
_GL_FUNCDECL_SYS (obstack_printf, int,
- (struct obstack *obs, const char *format, ...)
+ (struct obstack *obs, const char *format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
_GL_ARG_NONNULL ((1, 2)));
# endif
@@ -1108,7 +1179,7 @@ _GL_CXXALIASWARN (obstack_printf);
# define obstack_vprintf rpl_obstack_vprintf
# endif
_GL_FUNCDECL_RPL (obstack_vprintf, int,
- (struct obstack *obs, const char *format, va_list args)
+ (struct obstack *obs, const char *format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (obstack_vprintf, int,
@@ -1116,7 +1187,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int,
# else
# if !@HAVE_DECL_OBSTACK_PRINTF@
_GL_FUNCDECL_SYS (obstack_vprintf, int,
- (struct obstack *obs, const char *format, va_list args)
+ (struct obstack *obs, const char *format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
_GL_ARG_NONNULL ((1, 2)));
# endif
@@ -1128,7 +1199,7 @@ _GL_CXXALIASWARN (obstack_vprintf);
#if @GNULIB_PCLOSE@
# if !@HAVE_PCLOSE@
-_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (pclose, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
_GL_CXXALIASWARN (pclose);
@@ -1170,16 +1241,16 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX
compliant - "
# define popen rpl_popen
# endif
_GL_FUNCDECL_RPL (popen, FILE *,
- (const char *cmd, const char *mode)
+ (const char *cmd, const char *mode),
_GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
# else
# if !@HAVE_POPEN@ || __GNUC__ >= 11
_GL_FUNCDECL_SYS (popen, FILE *,
- (const char *cmd, const char *mode)
+ (const char *cmd, const char *mode),
_GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
# endif
@@ -1188,7 +1259,7 @@ _GL_CXXALIASWARN (popen);
# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen
/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */
_GL_FUNCDECL_SYS (popen, FILE *,
- (const char *cmd, const char *mode)
+ (const char *cmd, const char *mode),
_GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
_GL_ATTRIBUTE_MALLOC);
# endif
@@ -1201,7 +1272,24 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some
platforms - "
# endif
#endif
+#if @GNULIB_ZPRINTF@
+/* Prints formatted output to standard output.
+ Returns the number of bytes written to standard output. Upon failure,
+ returns -1 with stdout's error indicator set.
+ Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure causes are ENOMEM
+ and the possible failure causes from fwrite(). */
+_GL_FUNCDECL_SYS (zprintf, off64_t, (const char *restrict format, ...),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...));
+#endif
+
#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
+/* Prints formatted output to standard output.
+ Returns the number of bytes written to standard output. Upon failure,
+ returns a negative value with stdout's error indicator set. */
# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
|| (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ &&
(@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if defined __GNUC__ || defined __clang__
@@ -1213,14 +1301,14 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some
platforms - "
_GL_FUNCDECL_RPL_1 (__printf__, int,
(const char *restrict format, ...)
__asm__ (@ASM_SYMBOL_PREFIX@
- _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
+ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
_GL_ARG_NONNULL ((1)));
# else
_GL_FUNCDECL_RPL_1 (__printf__, int,
(const char *restrict format, ...)
__asm__ (@ASM_SYMBOL_PREFIX@
- _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
+ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)),
_GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
_GL_ARG_NONNULL ((1)));
# endif
@@ -1230,7 +1318,7 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char
*format, ...));
# define printf rpl_printf
# endif
_GL_FUNCDECL_RPL (printf, int,
- (const char *restrict format, ...)
+ (const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
@@ -1259,7 +1347,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX
compliant - "
# undef putc
# define putc rpl_fputc
# endif
-_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
+_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
# else
_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
@@ -1291,7 +1379,7 @@ _GL_CXXALIASWARN (putchar);
# undef puts
# define puts rpl_puts
# endif
-_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (puts, int, (const char *string), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (puts, int, (const char *string));
# else
_GL_CXXALIAS_SYS (puts, int, (const char *string));
@@ -1331,7 +1419,7 @@ _GL_CXXALIASWARN (putw);
# undef remove
# define remove rpl_remove
# endif
-_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (remove, int, (const char *name), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (remove, int, (const char *name));
# else
_GL_CXXALIAS_SYS (remove, int, (const char *name));
@@ -1353,7 +1441,7 @@ _GL_WARN_ON_USE (remove, "remove cannot handle
directories on some platforms - "
# define rename rpl_rename
# endif
_GL_FUNCDECL_RPL (rename, int,
- (const char *old_filename, const char *new_filename)
+ (const char *old_filename, const char *new_filename),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (rename, int,
(const char *old_filename, const char *new_filename));
@@ -1378,14 +1466,14 @@ _GL_WARN_ON_USE (rename, "rename is buggy on some
platforms - "
# define renameat rpl_renameat
# endif
_GL_FUNCDECL_RPL (renameat, int,
- (int fd1, char const *file1, int fd2, char const *file2)
+ (int fd1, char const *file1, int fd2, char const *file2),
_GL_ARG_NONNULL ((2, 4)));
_GL_CXXALIAS_RPL (renameat, int,
(int fd1, char const *file1, int fd2, char const *file2));
# else
# if !@HAVE_RENAMEAT@
_GL_FUNCDECL_SYS (renameat, int,
- (int fd1, char const *file1, int fd2, char const *file2)
+ (int fd1, char const *file1, int fd2, char const *file2),
_GL_ARG_NONNULL ((2, 4)));
# endif
_GL_CXXALIAS_SYS (renameat, int,
@@ -1411,18 +1499,18 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
_GL_FUNCDECL_RPL_1 (__scanf__, int,
(const char *restrict format, ...)
__asm__ (@ASM_SYMBOL_PREFIX@
- _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
+ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)),
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
- _GL_ARG_NONNULL ((1)));
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
# else
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef scanf
# define scanf rpl_scanf
# endif
-_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...)
+_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
- _GL_ARG_NONNULL ((1)));
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
# endif
# else
@@ -1433,7 +1521,31 @@ _GL_CXXALIASWARN (scanf);
# endif
#endif
+#if @GNULIB_SNZPRINTF@
+/* Prints formatted output to string STR. Similar to sprintf, but the
+ additional parameter SIZE limits how much is written into STR.
+ STR may be NULL, in which case nothing will be written.
+ Returns the string length of the formatted string (which may be larger
+ than SIZE). Upon failure, returns -1 with errno set.
+ Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure code is ENOMEM. */
+_GL_FUNCDECL_SYS (snzprintf, ptrdiff_t,
+ (char *restrict str, size_t size,
+ const char *restrict format, ...),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
+ _GL_ARG_NONNULL ((3)));
+_GL_CXXALIAS_SYS (snzprintf, ptrdiff_t,
+ (char *restrict str, size_t size,
+ const char *restrict format, ...));
+#endif
+
#if @GNULIB_SNPRINTF@
+/* Prints formatted output to string STR. Similar to sprintf, but the
+ additional parameter SIZE limits how much is written into STR.
+ STR may be NULL, in which case nothing will be written.
+ Returns the string length of the formatted string (which may be larger
+ than SIZE). Upon failure, returns a negative value. */
# if @REPLACE_SNPRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define snprintf rpl_snprintf
@@ -1441,7 +1553,7 @@ _GL_CXXALIASWARN (scanf);
# define GNULIB_overrides_snprintf 1
_GL_FUNCDECL_RPL (snprintf, int,
(char *restrict str, size_t size,
- const char *restrict format, ...)
+ const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
_GL_ARG_NONNULL ((3)));
_GL_CXXALIAS_RPL (snprintf, int,
@@ -1451,7 +1563,7 @@ _GL_CXXALIAS_RPL (snprintf, int,
# if !@HAVE_DECL_SNPRINTF@
_GL_FUNCDECL_SYS (snprintf, int,
(char *restrict str, size_t size,
- const char *restrict format, ...)
+ const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
_GL_ARG_NONNULL ((3)));
# endif
@@ -1470,6 +1582,23 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
# endif
#endif
+#if @GNULIB_SZPRINTF@
+/* Prints formatted output to string STR.
+ Returns the string length of the formatted string. Upon failure,
+ returns -1 with errno set.
+ Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure code is ENOMEM. */
+_GL_FUNCDECL_SYS (szprintf, ptrdiff_t,
+ (char *restrict str,
+ const char *restrict format, ...),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (szprintf, ptrdiff_t,
+ (char *restrict str,
+ const char *restrict format, ...));
+#endif
+
/* Some people would argue that all sprintf uses should be warned about
(for example, OpenBSD issues a link warning for it),
since it can cause security holes due to buffer overruns.
@@ -1480,13 +1609,16 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
GNULIB_POSIXCHECK is defined. */
#if @GNULIB_SPRINTF_POSIX@
+/* Prints formatted output to string STR.
+ Returns the string length of the formatted string. Upon failure,
+ returns a negative value. */
# if @REPLACE_SPRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define sprintf rpl_sprintf
# endif
# define GNULIB_overrides_sprintf 1
_GL_FUNCDECL_RPL (sprintf, int,
- (char *restrict str, const char *restrict format, ...)
+ (char *restrict str, const char *restrict format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (sprintf, int,
@@ -1527,16 +1659,18 @@ _GL_CXXALIASWARN (tempnam);
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define tmpfile rpl_tmpfile
# endif
-_GL_FUNCDECL_RPL (tmpfile, FILE *, (void)
+_GL_FUNCDECL_RPL (tmpfile, FILE *, (void),
_GL_ATTRIBUTE_DEALLOC (fclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
# else
# if __GNUC__ >= 11
/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
-_GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
+_GL_FUNCDECL_SYS (tmpfile, FILE *, (void),
_GL_ATTRIBUTE_DEALLOC (fclose, 1)
- _GL_ATTRIBUTE_MALLOC);
+ _GL_ATTRIBUTE_MALLOC
+ _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
# endif
@@ -1546,7 +1680,7 @@ _GL_CXXALIASWARN (tmpfile);
#else
# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile
/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
-_GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
+_GL_FUNCDECL_SYS (tmpfile, FILE *, (void),
_GL_ATTRIBUTE_DEALLOC (fclose, 1)
_GL_ATTRIBUTE_MALLOC);
# endif
@@ -1559,6 +1693,31 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on
mingw - "
# endif
#endif
+#if @GNULIB_VASZPRINTF@
+/* Prints formatted output to a string dynamically allocated with malloc().
+ If the memory allocation succeeds, it stores the address of the string in
+ *RESULT and returns the number of resulting bytes, excluding the trailing
+ NUL. Upon memory allocation error, or some other error, it returns -1
+ with errno set.
+ Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure code is ENOMEM. */
+_GL_FUNCDECL_SYS (aszprintf, ptrdiff_t,
+ (char **result, const char *format, ...),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+ _GL_ARG_NONNULL ((1, 2))
+ _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_SYS (aszprintf, ptrdiff_t,
+ (char **result, const char *format, ...));
+_GL_FUNCDECL_SYS (vaszprintf, ptrdiff_t,
+ (char **result, const char *format, va_list args),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+ _GL_ARG_NONNULL ((1, 2))
+ _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_SYS (vaszprintf, ptrdiff_t,
+ (char **result, const char *format, va_list args));
+#endif
+
#if @GNULIB_VASPRINTF@
/* Write formatted output to a string dynamically allocated with malloc().
If the memory allocation succeeds, store the address of the string in
@@ -1570,17 +1729,19 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on
mingw - "
# endif
# define GNULIB_overrides_asprintf
_GL_FUNCDECL_RPL (asprintf, int,
- (char **result, const char *format, ...)
+ (char **result, const char *format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
+ _GL_ARG_NONNULL ((1, 2))
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (asprintf, int,
(char **result, const char *format, ...));
# else
# if !@HAVE_VASPRINTF@
_GL_FUNCDECL_SYS (asprintf, int,
- (char **result, const char *format, ...)
+ (char **result, const char *format, ...),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
- _GL_ARG_NONNULL ((1, 2)));
+ _GL_ARG_NONNULL ((1, 2))
+ _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (asprintf, int,
(char **result, const char *format, ...));
@@ -1592,17 +1753,19 @@ _GL_CXXALIASWARN (asprintf);
# endif
# define GNULIB_overrides_vasprintf 1
_GL_FUNCDECL_RPL (vasprintf, int,
- (char **result, const char *format, va_list args)
+ (char **result, const char *format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
+ _GL_ARG_NONNULL ((1, 2))
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (vasprintf, int,
(char **result, const char *format, va_list args));
# else
# if !@HAVE_VASPRINTF@
_GL_FUNCDECL_SYS (vasprintf, int,
- (char **result, const char *format, va_list args)
+ (char **result, const char *format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
+ _GL_ARG_NONNULL ((1, 2))
+ _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (vasprintf, int,
(char **result, const char *format, va_list args));
@@ -1610,13 +1773,32 @@ _GL_CXXALIAS_SYS (vasprintf, int,
_GL_CXXALIASWARN (vasprintf);
#endif
+#if @GNULIB_VDZPRINTF@
+/* Prints formatted output to file descriptor FD.
+ Returns the number of bytes written to the file descriptor. Upon
+ failure, returns -1 with errno set.
+ Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure codes are ENOMEM
+ and the possible failure codes from write(), excluding EINTR. */
+_GL_FUNCDECL_SYS (vdzprintf, off64_t,
+ (int fd, const char *restrict format, va_list args),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_SYS (vdzprintf, off64_t,
+ (int fd, const char *restrict format, va_list args));
+#endif
+
#if @GNULIB_VDPRINTF@
+/* Prints formatted output to file descriptor FD.
+ Returns the number of bytes written to the file descriptor. Upon
+ failure, returns a negative value. */
# if @REPLACE_VDPRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define vdprintf rpl_vdprintf
# endif
_GL_FUNCDECL_RPL (vdprintf, int,
- (int fd, const char *restrict format, va_list args)
+ (int fd, const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (vdprintf, int,
@@ -1624,7 +1806,7 @@ _GL_CXXALIAS_RPL (vdprintf, int,
# else
# if !@HAVE_VDPRINTF@
_GL_FUNCDECL_SYS (vdprintf, int,
- (int fd, const char *restrict format, va_list args)
+ (int fd, const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
_GL_ARG_NONNULL ((2)));
# endif
@@ -1644,7 +1826,28 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
# endif
#endif
+#if @GNULIB_VFZPRINTF@
+/* Prints formatted output to stream FP.
+ Returns the number of bytes written to the stream. Upon failure,
+ returns -1 with the stream's error indicator set.
+ Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure causes are ENOMEM
+ and the possible failure causes from fwrite(). */
+_GL_FUNCDECL_SYS (vfzprintf, off64_t,
+ (FILE *restrict fp,
+ const char *restrict format, va_list args),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (vfzprintf, off64_t,
+ (FILE *restrict fp,
+ const char *restrict format, va_list args));
+#endif
+
#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
+/* Prints formatted output to stream FP.
+ Returns the number of bytes written to the stream. Upon failure,
+ returns a negative value with the stream's error indicator set. */
# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
|| (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ &&
(@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1654,13 +1857,13 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
# if @GNULIB_VFPRINTF_POSIX@
_GL_FUNCDECL_RPL (vfprintf, int,
(FILE *restrict fp,
- const char *restrict format, va_list args)
+ const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
_GL_ARG_NONNULL ((1, 2)));
# else
_GL_FUNCDECL_RPL (vfprintf, int,
(FILE *restrict fp,
- const char *restrict format, va_list args)
+ const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
_GL_ARG_NONNULL ((1, 2)));
# endif
@@ -1697,9 +1900,9 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX
compliant - "
# endif
_GL_FUNCDECL_RPL (vfscanf, int,
(FILE *restrict stream,
- const char *restrict format, va_list args)
+ const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
- _GL_ARG_NONNULL ((1, 2)));
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (vfscanf, int,
(FILE *restrict stream,
const char *restrict format, va_list args));
@@ -1713,7 +1916,26 @@ _GL_CXXALIASWARN (vfscanf);
# endif
#endif
+#if @GNULIB_VZPRINTF@
+/* Prints formatted output to standard output.
+ Returns the number of bytes written to standard output. Upon failure,
+ returns -1 with stdout's error indicator set.
+ Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure causes are ENOMEM
+ and the possible failure causes from fwrite(). */
+_GL_FUNCDECL_SYS (vzprintf, off64_t,
+ (const char *restrict format, va_list args),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (vzprintf, off64_t,
+ (const char *restrict format, va_list args));
+#endif
+
#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
+/* Prints formatted output to standard output.
+ Returns the number of bytes written to standard output. Upon failure,
+ returns a negative value with stdout's error indicator set. */
# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
|| (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ &&
(@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1721,11 +1943,11 @@ _GL_CXXALIASWARN (vfscanf);
# endif
# define GNULIB_overrides_vprintf 1
# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
-_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
+_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
_GL_ARG_NONNULL ((1)));
# else
-_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
+_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
_GL_ARG_NONNULL ((1)));
# endif
@@ -1757,9 +1979,9 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX
compliant - "
# undef vscanf
# define vscanf rpl_vscanf
# endif
-_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args)
+_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
- _GL_ARG_NONNULL ((1)));
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
# else
_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
@@ -1769,7 +1991,31 @@ _GL_CXXALIASWARN (vscanf);
# endif
#endif
+#if @GNULIB_VSNZPRINTF@
+/* Prints formatted output to string STR. Similar to sprintf, but the
+ additional parameter SIZE limits how much is written into STR.
+ STR may be NULL, in which case nothing will be written.
+ Returns the string length of the formatted string (which may be larger
+ than SIZE). Upon failure, returns -1 with errno set.
+ Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure code is ENOMEM. */
+_GL_FUNCDECL_SYS (vsnzprintf, ptrdiff_t,
+ (char *restrict str, size_t size,
+ const char *restrict format, va_list args),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
+ _GL_ARG_NONNULL ((3)));
+_GL_CXXALIAS_SYS (vsnzprintf, ptrdiff_t,
+ (char *restrict str, size_t size,
+ const char *restrict format, va_list args));
+#endif
+
#if @GNULIB_VSNPRINTF@
+/* Prints formatted output to string STR. Similar to vsprintf, but the
+ additional parameter SIZE limits how much is written into STR.
+ STR may be NULL, in which case nothing will be written.
+ Returns the string length of the formatted string (which may be larger
+ than SIZE). Upon failure, returns a negative value. */
# if @REPLACE_VSNPRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define vsnprintf rpl_vsnprintf
@@ -1777,7 +2023,7 @@ _GL_CXXALIASWARN (vscanf);
# define GNULIB_overrides_vsnprintf 1
_GL_FUNCDECL_RPL (vsnprintf, int,
(char *restrict str, size_t size,
- const char *restrict format, va_list args)
+ const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
_GL_ARG_NONNULL ((3)));
_GL_CXXALIAS_RPL (vsnprintf, int,
@@ -1787,7 +2033,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int,
# if !@HAVE_DECL_VSNPRINTF@
_GL_FUNCDECL_SYS (vsnprintf, int,
(char *restrict str, size_t size,
- const char *restrict format, va_list args)
+ const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
_GL_ARG_NONNULL ((3)));
# endif
@@ -1806,7 +2052,27 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
# endif
#endif
+#if @GNULIB_VSZPRINTF@
+/* Prints formatted output to string STR.
+ Returns the string length of the formatted string. Upon failure,
+ returns -1 with errno set.
+ Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
+ Therefore, if the format string is valid and does not use %ls/%lc
+ directives nor widths, the only possible failure code is ENOMEM. */
+_GL_FUNCDECL_SYS (vszprintf, ptrdiff_t,
+ (char *restrict str,
+ const char *restrict format, va_list args),
+ _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+ _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (vszprintf, ptrdiff_t,
+ (char *restrict str,
+ const char *restrict format, va_list args));
+#endif
+
#if @GNULIB_VSPRINTF_POSIX@
+/* Prints formatted output to string STR.
+ Returns the string length of the formatted string. Upon failure,
+ returns a negative value. */
# if @REPLACE_VSPRINTF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define vsprintf rpl_vsprintf
@@ -1814,7 +2080,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
# define GNULIB_overrides_vsprintf 1
_GL_FUNCDECL_RPL (vsprintf, int,
(char *restrict str,
- const char *restrict format, va_list args)
+ const char *restrict format, va_list args),
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (vsprintf, int,
diff --git a/gnulib/lib/stdlib.in.h b/gnulib/lib/stdlib.in.h
index cfc69d0a50..2a94b73f72 100644
--- a/gnulib/lib/stdlib.in.h
+++ b/gnulib/lib/stdlib.in.h
@@ -20,9 +20,18 @@
#endif
@PRAGMA_COLUMNS@
-#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
+#if (defined __need_system_stdlib_h && !defined _GLIBCXX_STDLIB_H) || defined
__need_malloc_and_calloc
/* Special invocation conventions inside some gnulib header files,
- and inside some glibc header files, respectively. */
+ and inside some glibc header files, respectively.
+ Do not recognize this special invocation convention when GCC's
+ c++/11/stdlib.h is being included or has been included. This is needed
+ to support the use of clang+llvm binaries on Ubuntu 22.04 with
+ CXX="$clangdir/bin/clang++ -I/usr/include/c++/11 \
+ -I/usr/include/x86_64-linux-gnu/c++/11
+ -L/usr/lib/gcc/x86_64-linux-gnu/11
+ -Wl,-rpath,$clangdir/lib"
+ because in this case /usr/include/c++/11/stdlib.h (which does not support
+ the convention) is seen before the gnulib-generated stdlib.h. */
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
@@ -42,8 +51,8 @@
#define _@GUARD_PREFIX@_STDLIB_H
/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
- _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
- HAVE_RAW_DECL_*. */
+ _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE,
+ GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -108,6 +117,17 @@ struct random_data
# include <unistd.h>
#endif
+#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ &&
@REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) ||
(@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined
GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && defined __sun
+/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
+ below, this may cause compilation errors later in the libstdc++ header files
+ (that are part of GCC), such as:
+ error: 'rpl_strtol' is not a member of 'std'
+ To avoid this, include the relevant header files here, before these symbols
+ get defined as macros. But do so only on Solaris 11 (where it is needed),
+ not on mingw (where it would cause other compilation errors). */
+# include <string>
+#endif
+
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
that can be freed by passing them as the Ith argument to the
function F. */
@@ -141,7 +161,7 @@ struct random_data
*/
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
-# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
@@ -221,6 +241,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
#if @GNULIB_ABORT_DEBUG@
+/* Terminates the current process with signal SIGABRT.
+ Note: While the original abort() function is safe to call in signal
handlers,
+ the overridden abort() function is not. */
# if @REPLACE_ABORT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef abort
@@ -235,14 +258,6 @@ _GL_CXXALIAS_SYS (abort, void, (void));
_GL_CXXALIASWARN (abort);
# endif
#endif
-#if @GNULIB_ABORT_DEBUG@ && @REPLACE_ABORT@
-_GL_EXTERN_C void _gl_pre_abort (void);
-#else
-# if !GNULIB_defined_gl_pre_abort
-# define _gl_pre_abort() /* nothing */
-# define GNULIB_defined_gl_pre_abort 1
-# endif
-#endif
#if @GNULIB_FREE_POSIX@
@@ -252,7 +267,7 @@ _GL_EXTERN_C void _gl_pre_abort (void);
# define free rpl_free
# endif
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
-_GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW);
+_GL_FUNCDECL_RPL (free, void, (void *ptr)) _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_RPL (free, void, (void *ptr));
# endif
@@ -279,8 +294,9 @@ _GL_WARN_ON_USE (free, "free is not future POSIX compliant
everywhere - "
# define aligned_alloc rpl_aligned_alloc
# endif
_GL_FUNCDECL_RPL (aligned_alloc, void *,
- (size_t alignment, size_t size)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t alignment, size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
# else
# if @HAVE_ALIGNED_ALLOC@
@@ -288,13 +304,15 @@ _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t
alignment, size_t size));
/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
_GL_FUNCDECL_SYS (aligned_alloc, void *,
- (size_t alignment, size_t size)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t alignment, size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (aligned_alloc, void *,
- (size_t alignment, size_t size)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t alignment, size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD);
# endif
# endif
_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
@@ -308,12 +326,12 @@ _GL_CXXALIASWARN (aligned_alloc);
/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
_GL_FUNCDECL_SYS (aligned_alloc, void *,
- (size_t alignment, size_t size)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t alignment, size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (aligned_alloc, void *,
- (size_t alignment, size_t size)
+ (size_t alignment, size_t size),
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
# endif
@@ -330,9 +348,10 @@ _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not
portable - "
/* Parse a signed decimal integer.
Returns the value of the integer. Errors are not detected. */
# if !@HAVE_ATOLL@
-_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
- _GL_ATTRIBUTE_PURE
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (atoll, long long,
+ (const char *string),
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
_GL_CXXALIASWARN (atoll);
@@ -352,21 +371,24 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
# define calloc rpl_calloc
# endif
_GL_FUNCDECL_RPL (calloc, void *,
- (size_t nmemb, size_t size)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t nmemb, size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
# else
# if __GNUC__ >= 11
/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
_GL_FUNCDECL_SYS (calloc, void *,
- (size_t nmemb, size_t size)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t nmemb, size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (calloc, void *,
- (size_t nmemb, size_t size)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t nmemb, size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD);
# endif
# endif
_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
@@ -379,12 +401,12 @@ _GL_CXXALIASWARN (calloc);
/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
_GL_FUNCDECL_SYS (calloc, void *,
- (size_t nmemb, size_t size)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t nmemb, size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (calloc, void *,
- (size_t nmemb, size_t size)
+ (size_t nmemb, size_t size),
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
# endif
@@ -402,23 +424,26 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant
everywhere - "
# define canonicalize_file_name rpl_canonicalize_file_name
# endif
_GL_FUNCDECL_RPL (canonicalize_file_name, char *,
- (const char *name)
+ (const char *name),
_GL_ARG_NONNULL ((1))
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
# else
# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
- (const char *name)
- _GL_ATTRIBUTE_NOTHROW
+ (const char *name),
_GL_ARG_NONNULL ((1))
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
- (const char *name)
+ (const char *name),
_GL_ARG_NONNULL ((1))
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD);
# endif
# endif
_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
@@ -434,13 +459,13 @@ _GL_CXXALIASWARN (canonicalize_file_name);
rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
- (const char *name)
- _GL_ATTRIBUTE_NOTHROW
+ (const char *name),
_GL_ARG_NONNULL ((1))
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
- (const char *name)
+ (const char *name),
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
@@ -532,12 +557,12 @@ _GL_CXXALIASWARN (gcvt);
# undef getloadavg
# define getloadavg rpl_getloadavg
# endif
-_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem)
+_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
# else
# if !@HAVE_DECL_GETLOADAVG@
-_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
+_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
@@ -562,7 +587,7 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
# define getprogname rpl_getprogname
# endif
# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
-_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_RPL (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
# else
_GL_FUNCDECL_RPL (getprogname, const char *, (void));
# endif
@@ -570,7 +595,7 @@ _GL_CXXALIAS_RPL (getprogname, const char *, (void));
# else
# if !@HAVE_GETPROGNAME@
# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
-_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
# else
_GL_FUNCDECL_SYS (getprogname, const char *, (void));
# endif
@@ -606,15 +631,15 @@ _GL_WARN_ON_USE (getprogname, "getprogname is unportable
- "
# define getsubopt rpl_getsubopt
# endif
_GL_FUNCDECL_RPL (getsubopt, int,
- (char **optionp, char *const *tokens, char **valuep)
- _GL_ARG_NONNULL ((1, 2, 3)));
+ (char **optionp, char *const *tokens, char **valuep),
+ _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (getsubopt, int,
(char **optionp, char *const *tokens, char **valuep));
# else
# if !@HAVE_GETSUBOPT@
_GL_FUNCDECL_SYS (getsubopt, int,
- (char **optionp, char *const *tokens, char **valuep)
- _GL_ARG_NONNULL ((1, 2, 3)));
+ (char **optionp, char *const *tokens, char **valuep),
+ _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (getsubopt, int,
(char **optionp, char *const *tokens, char **valuep));
@@ -659,21 +684,24 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
# define malloc rpl_malloc
# endif
_GL_FUNCDECL_RPL (malloc, void *,
- (size_t size)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
# else
# if __GNUC__ >= 11
/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
_GL_FUNCDECL_SYS (malloc, void *,
- (size_t size)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (malloc, void *,
- (size_t size)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_NODISCARD);
# endif
# endif
_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
@@ -686,12 +714,12 @@ _GL_CXXALIASWARN (malloc);
/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
_GL_FUNCDECL_SYS (malloc, void *,
- (size_t size)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (size_t size),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (malloc, void *,
- (size_t size)
+ (size_t size),
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
# endif
@@ -727,7 +755,7 @@ int gl_MB_CUR_MAX (void)
# endif
_GL_FUNCDECL_RPL (mbstowcs, size_t,
(wchar_t *restrict dest, const char *restrict src,
- size_t len)
+ size_t len),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mbstowcs, size_t,
(wchar_t *restrict dest, const char *restrict src,
@@ -785,7 +813,9 @@ _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
Returns TEMPLATE, or a null pointer if it cannot get a unique name.
The directory is created mode 700. */
# if !@HAVE_MKDTEMP@
-_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL
((1)));
+_GL_FUNCDECL_SYS (mkdtemp, char *,
+ (char * /*template*/),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
_GL_CXXALIASWARN (mkdtemp);
@@ -815,13 +845,13 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
# undef mkostemp
# define mkostemp rpl_mkostemp
# endif
-_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/),
+ _GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
# else
# if !@HAVE_MKOSTEMP@
-_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/),
+ _GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
# endif
@@ -856,15 +886,15 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
# define mkostemps rpl_mkostemps
# endif
_GL_FUNCDECL_RPL (mkostemps, int,
- (char * /*template*/, int /*suffixlen*/, int /*flags*/)
- _GL_ARG_NONNULL ((1)));
+ (char * /*template*/, int /*suffixlen*/, int /*flags*/),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (mkostemps, int,
(char * /*template*/, int /*suffixlen*/, int /*flags*/));
# else
# if !@HAVE_MKOSTEMPS@
_GL_FUNCDECL_SYS (mkostemps, int,
- (char * /*template*/, int /*suffixlen*/, int /*flags*/)
- _GL_ARG_NONNULL ((1)));
+ (char * /*template*/, int /*suffixlen*/, int /*flags*/),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (mkostemps, int,
(char * /*template*/, int /*suffixlen*/, int /*flags*/));
@@ -894,11 +924,13 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mkstemp rpl_mkstemp
# endif
-_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
# else
# if ! @HAVE_MKSTEMP@
-_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
# endif
@@ -923,8 +955,8 @@ _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
Returns the open file descriptor if successful, otherwise -1 and errno
set. */
# if !@HAVE_MKSTEMPS@
-_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/),
+ _GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
_GL_CXXALIASWARN (mkstemps);
@@ -960,8 +992,8 @@ _GL_CXXALIASWARN (mktemp);
# define posix_memalign rpl_posix_memalign
# endif
_GL_FUNCDECL_RPL (posix_memalign, int,
- (void **memptr, size_t alignment, size_t size)
- _GL_ARG_NONNULL ((1)));
+ (void **memptr, size_t alignment, size_t size),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (posix_memalign, int,
(void **memptr, size_t alignment, size_t size));
# else
@@ -989,11 +1021,11 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not
portable - "
# undef posix_openpt
# define posix_openpt rpl_posix_openpt
# endif
-_GL_FUNCDECL_RPL (posix_openpt, int, (int flags));
+_GL_FUNCDECL_RPL (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
# else
# if !@HAVE_POSIX_OPENPT@
-_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
+_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
# endif
@@ -1016,11 +1048,11 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not
portable - "
# undef ptsname
# define ptsname rpl_ptsname
# endif
-_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
+_GL_FUNCDECL_RPL (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
# else
# if !@HAVE_PTSNAME@
-_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
+_GL_FUNCDECL_SYS (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
# endif
@@ -1068,7 +1100,7 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
# undef putenv
# define putenv rpl_putenv
# endif
-_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (putenv, int, (char *string), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (putenv, int, (char *string));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1127,7 +1159,8 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void
const *, void *);
# endif
_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
_gl_qsort_r_compar_fn compare,
- void *arg) _GL_ARG_NONNULL ((1, 4)));
+ void *arg),
+ _GL_ARG_NONNULL ((1, 4)));
_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
_gl_qsort_r_compar_fn compare,
void *arg));
@@ -1135,7 +1168,8 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t
nmemb, size_t size,
# if !@HAVE_QSORT_R@
_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
_gl_qsort_r_compar_fn compare,
- void *arg) _GL_ARG_NONNULL ((1, 4)));
+ void *arg),
+ _GL_ARG_NONNULL ((1, 4)));
# endif
_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
_gl_qsort_r_compar_fn compare,
@@ -1238,14 +1272,14 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
# define initstate rpl_initstate
# endif
_GL_FUNCDECL_RPL (initstate, char *,
- (unsigned int seed, char *buf, size_t buf_size)
+ (unsigned int seed, char *buf, size_t buf_size),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (initstate, char *,
(unsigned int seed, char *buf, size_t buf_size));
# else
# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
_GL_FUNCDECL_SYS (initstate, char *,
- (unsigned int seed, char *buf, size_t buf_size)
+ (unsigned int seed, char *buf, size_t buf_size),
_GL_ARG_NONNULL ((2)));
# endif
/* Need to cast, because on FreeBSD, the first parameter is
@@ -1270,11 +1304,11 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - "
# undef setstate
# define setstate rpl_setstate
# endif
-_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
# else
# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
-_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
# endif
/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
is const char *arg_state. */
@@ -1298,12 +1332,12 @@ _GL_WARN_ON_USE (setstate, "setstate is unportable - "
# undef random_r
# define random_r rpl_random_r
# endif
-_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
+_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
# else
# if !@HAVE_RANDOM_R@
-_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
+_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
@@ -1324,14 +1358,14 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
# define srandom_r rpl_srandom_r
# endif
_GL_FUNCDECL_RPL (srandom_r, int,
- (unsigned int seed, struct random_data *rand_state)
+ (unsigned int seed, struct random_data *rand_state),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (srandom_r, int,
(unsigned int seed, struct random_data *rand_state));
# else
# if !@HAVE_RANDOM_R@
_GL_FUNCDECL_SYS (srandom_r, int,
- (unsigned int seed, struct random_data *rand_state)
+ (unsigned int seed, struct random_data *rand_state),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (srandom_r, int,
@@ -1354,7 +1388,7 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
# endif
_GL_FUNCDECL_RPL (initstate_r, int,
(unsigned int seed, char *buf, size_t buf_size,
- struct random_data *rand_state)
+ struct random_data *rand_state),
_GL_ARG_NONNULL ((2, 4)));
_GL_CXXALIAS_RPL (initstate_r, int,
(unsigned int seed, char *buf, size_t buf_size,
@@ -1363,7 +1397,7 @@ _GL_CXXALIAS_RPL (initstate_r, int,
# if !@HAVE_RANDOM_R@
_GL_FUNCDECL_SYS (initstate_r, int,
(unsigned int seed, char *buf, size_t buf_size,
- struct random_data *rand_state)
+ struct random_data *rand_state),
_GL_ARG_NONNULL ((2, 4)));
# endif
/* Need to cast, because on Haiku, the third parameter is
@@ -1388,14 +1422,14 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is
unportable - "
# define setstate_r rpl_setstate_r
# endif
_GL_FUNCDECL_RPL (setstate_r, int,
- (char *arg_state, struct random_data *rand_state)
+ (char *arg_state, struct random_data *rand_state),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (setstate_r, int,
(char *arg_state, struct random_data *rand_state));
# else
# if !@HAVE_RANDOM_R@
_GL_FUNCDECL_SYS (setstate_r, int,
- (char *arg_state, struct random_data *rand_state)
+ (char *arg_state, struct random_data *rand_state),
_GL_ARG_NONNULL ((1, 2)));
# endif
/* Need to cast, because on Haiku, the first parameter is
@@ -1421,21 +1455,22 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable
- "
# undef realloc
# define realloc rpl_realloc
# endif
-_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
- _GL_ATTRIBUTE_DEALLOC_FREE);
+_GL_FUNCDECL_RPL (realloc, void *,
+ (void *ptr, size_t size),
+ _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
# else
# if __GNUC__ >= 11
/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
_GL_FUNCDECL_SYS (realloc, void *,
- (void *ptr, size_t size)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_DEALLOC_FREE);
+ (void *ptr, size_t size),
+ _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (realloc, void *,
- (void *ptr, size_t size)
- _GL_ATTRIBUTE_DEALLOC_FREE);
+ (void *ptr, size_t size),
+ _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
# endif
# endif
_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
@@ -1448,12 +1483,12 @@ _GL_CXXALIASWARN (realloc);
/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
_GL_FUNCDECL_SYS (realloc, void *,
- (void *ptr, size_t size)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_DEALLOC_FREE);
+ (void *ptr, size_t size),
+ _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (realloc, void *,
- (void *ptr, size_t size)
+ (void *ptr, size_t size),
_GL_ATTRIBUTE_DEALLOC_FREE);
# endif
# endif
@@ -1473,13 +1508,15 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX
compliant everywhere - "
# define reallocarray rpl_reallocarray
# endif
_GL_FUNCDECL_RPL (reallocarray, void *,
- (void *ptr, size_t nmemb, size_t size));
+ (void *ptr, size_t nmemb, size_t size),
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size));
# else
# if ! @HAVE_REALLOCARRAY@
_GL_FUNCDECL_SYS (reallocarray, void *,
- (void *ptr, size_t nmemb, size_t size));
+ (void *ptr, size_t nmemb, size_t size),
+ _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size));
@@ -1501,15 +1538,15 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not
portable - "
# define realpath rpl_realpath
# endif
_GL_FUNCDECL_RPL (realpath, char *,
- (const char *restrict name, char *restrict resolved)
- _GL_ARG_NONNULL ((1)));
+ (const char *restrict name, char *restrict resolved),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (realpath, char *,
(const char *restrict name, char *restrict resolved));
# else
# if !@HAVE_REALPATH@
_GL_FUNCDECL_SYS (realpath, char *,
- (const char *restrict name, char *restrict resolved)
- _GL_ARG_NONNULL ((1)));
+ (const char *restrict name, char *restrict resolved),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (realpath, char *,
(const char *restrict name, char *restrict resolved));
@@ -1527,7 +1564,8 @@ _GL_WARN_ON_USE (realpath, "realpath is unportable - use
gnulib module "
/* Test a user response to a question.
Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
# if !@HAVE_RPMATCH@
-_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (rpmatch, int, (const char *response),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
_GL_CXXALIASWARN (rpmatch);
@@ -1543,7 +1581,8 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
/* Look up NAME in the environment, returning 0 in insecure situations. */
# if !@HAVE_SECURE_GETENV@
_GL_FUNCDECL_SYS (secure_getenv, char *,
- (char const *name) _GL_ARG_NONNULL ((1)));
+ (char const *name),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
_GL_CXXALIASWARN (secure_getenv);
@@ -1564,14 +1603,14 @@ _GL_WARN_ON_USE (secure_getenv, "secure_getenv is
unportable - "
# define setenv rpl_setenv
# endif
_GL_FUNCDECL_RPL (setenv, int,
- (const char *name, const char *value, int replace)
+ (const char *name, const char *value, int replace),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (setenv, int,
(const char *name, const char *value, int replace));
# else
# if !@HAVE_DECL_SETENV@
_GL_FUNCDECL_SYS (setenv, int,
- (const char *name, const char *value, int replace)
+ (const char *name, const char *value, int replace),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (setenv, int,
@@ -1588,6 +1627,19 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
# endif
#endif
+#if @GNULIB_STACK_TRACE@
+/* Prints a stack trace of the current thread to standard error,
+ if possible. */
+# if @CAN_PRINT_STACK_TRACE@
+_GL_EXTERN_C void print_stack_trace (void);
+# else
+# if !GNULIB_defined_print_stack_trace
+# define print_stack_trace() /* nothing */
+# define GNULIB_defined_print_stack_trace 1
+# endif
+# endif
+#endif
+
#if @GNULIB_STRTOD@
/* Parse a double from STRING, updating ENDP if appropriate. */
# if @REPLACE_STRTOD@
@@ -1596,14 +1648,14 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
# endif
# define GNULIB_defined_strtod_function 1
_GL_FUNCDECL_RPL (strtod, double,
- (const char *restrict str, char **restrict endp)
+ (const char *restrict str, char **restrict endp),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtod, double,
(const char *restrict str, char **restrict endp));
# else
# if !@HAVE_STRTOD@
_GL_FUNCDECL_SYS (strtod, double,
- (const char *restrict str, char **restrict endp)
+ (const char *restrict str, char **restrict endp),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtod, double,
@@ -1628,14 +1680,14 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
# endif
# define GNULIB_defined_strtof_function 1
_GL_FUNCDECL_RPL (strtof, float,
- (const char *restrict str, char **restrict endp)
+ (const char *restrict str, char **restrict endp),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtof, float,
(const char *restrict str, char **restrict endp));
# else
# if !@HAVE_STRTOF@
_GL_FUNCDECL_SYS (strtof, float,
- (const char *restrict str, char **restrict endp)
+ (const char *restrict str, char **restrict endp),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtof, float,
@@ -1660,14 +1712,14 @@ _GL_WARN_ON_USE (strtof, "strtof is unportable - "
# endif
# define GNULIB_defined_strtold_function 1
_GL_FUNCDECL_RPL (strtold, long double,
- (const char *restrict str, char **restrict endp)
+ (const char *restrict str, char **restrict endp),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtold, long double,
(const char *restrict str, char **restrict endp));
# else
# if !@HAVE_STRTOLD@
_GL_FUNCDECL_SYS (strtold, long double,
- (const char *restrict str, char **restrict endp)
+ (const char *restrict str, char **restrict endp),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtold, long double,
@@ -1698,7 +1750,7 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - "
# define GNULIB_defined_strtol_function 1
_GL_FUNCDECL_RPL (strtol, long,
(const char *restrict string, char **restrict endptr,
- int base)
+ int base),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtol, long,
(const char *restrict string, char **restrict endptr,
@@ -1707,7 +1759,7 @@ _GL_CXXALIAS_RPL (strtol, long,
# if !@HAVE_STRTOL@
_GL_FUNCDECL_SYS (strtol, long,
(const char *restrict string, char **restrict endptr,
- int base)
+ int base),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtol, long,
@@ -1741,7 +1793,7 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - "
# define GNULIB_defined_strtoll_function 1
_GL_FUNCDECL_RPL (strtoll, long long,
(const char *restrict string, char **restrict endptr,
- int base)
+ int base),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtoll, long long,
(const char *restrict string, char **restrict endptr,
@@ -1750,7 +1802,7 @@ _GL_CXXALIAS_RPL (strtoll, long long,
# if !@HAVE_STRTOLL@
_GL_FUNCDECL_SYS (strtoll, long long,
(const char *restrict string, char **restrict endptr,
- int base)
+ int base),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtoll, long long,
@@ -1781,7 +1833,7 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
# define GNULIB_defined_strtoul_function 1
_GL_FUNCDECL_RPL (strtoul, unsigned long,
(const char *restrict string, char **restrict endptr,
- int base)
+ int base),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtoul, unsigned long,
(const char *restrict string, char **restrict endptr,
@@ -1790,7 +1842,7 @@ _GL_CXXALIAS_RPL (strtoul, unsigned long,
# if !@HAVE_STRTOUL@
_GL_FUNCDECL_SYS (strtoul, unsigned long,
(const char *restrict string, char **restrict endptr,
- int base)
+ int base),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtoul, unsigned long,
@@ -1824,7 +1876,7 @@ _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
# define GNULIB_defined_strtoull_function 1
_GL_FUNCDECL_RPL (strtoull, unsigned long long,
(const char *restrict string, char **restrict endptr,
- int base)
+ int base),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strtoull, unsigned long long,
(const char *restrict string, char **restrict endptr,
@@ -1833,7 +1885,7 @@ _GL_CXXALIAS_RPL (strtoull, unsigned long long,
# if !@HAVE_STRTOULL@
_GL_FUNCDECL_SYS (strtoull, unsigned long long,
(const char *restrict string, char **restrict endptr,
- int base)
+ int base),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (strtoull, unsigned long long,
@@ -1872,11 +1924,11 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
# undef unsetenv
# define unsetenv rpl_unsetenv
# endif
-_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
# else
# if !@HAVE_DECL_UNSETENV@
-_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
# endif
diff --git a/gnulib/lib/string.in.h b/gnulib/lib/string.in.h
index 44ec2e7ecd..b415982d3c 100644
--- a/gnulib/lib/string.in.h
+++ b/gnulib/lib/string.in.h
@@ -115,7 +115,7 @@
*/
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
-# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
@@ -198,7 +198,7 @@ _GL_EXTERN_C void free (void *);
#if @GNULIB_EXPLICIT_BZERO@
# if ! @HAVE_EXPLICIT_BZERO@
_GL_FUNCDECL_SYS (explicit_bzero, void,
- (void *__dest, size_t __n) _GL_ARG_NONNULL ((1)));
+ (void *__dest, size_t __n), _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n));
_GL_CXXALIASWARN (explicit_bzero);
@@ -274,7 +274,7 @@ _GL_CXXALIASWARN (memccpy);
# undef memchr
# define memchr rpl_memchr
# endif
-_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
+_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
@@ -313,7 +313,7 @@ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs
- "
# endif
_GL_FUNCDECL_RPL (memmem, void *,
(void const *__haystack, size_t __haystack_len,
- void const *__needle, size_t __needle_len)
+ void const *__needle, size_t __needle_len),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 3)));
_GL_CXXALIAS_RPL (memmem, void *,
@@ -323,7 +323,7 @@ _GL_CXXALIAS_RPL (memmem, void *,
# if ! @HAVE_DECL_MEMMEM@
_GL_FUNCDECL_SYS (memmem, void *,
(void const *__haystack, size_t __haystack_len,
- void const *__needle, size_t __needle_len)
+ void const *__needle, size_t __needle_len),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 3)));
# endif
@@ -351,7 +351,7 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often
quadratic - "
# endif
_GL_FUNCDECL_RPL (mempcpy, void *,
(void *restrict __dest, void const *restrict __src,
- size_t __n)
+ size_t __n),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (mempcpy, void *,
(void *restrict __dest, void const *restrict __src,
@@ -360,7 +360,7 @@ _GL_CXXALIAS_RPL (mempcpy, void *,
# if !@HAVE_MEMPCPY@
_GL_FUNCDECL_SYS (mempcpy, void *,
(void *restrict __dest, void const *restrict __src,
- size_t __n)
+ size_t __n),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (mempcpy, void *,
@@ -381,7 +381,7 @@ _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
/* Search backwards through a block for a byte (specified as an int). */
#if @GNULIB_MEMRCHR@
# if ! @HAVE_DECL_MEMRCHR@
-_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
+_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
@@ -420,12 +420,12 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
# define memset_explicit rpl_memset_explicit
# endif
_GL_FUNCDECL_RPL (memset_explicit, void *,
- (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
+ (void *__dest, int __c, size_t __n), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t
__n));
# else
# if !@HAVE_MEMSET_EXPLICIT@
_GL_FUNCDECL_SYS (memset_explicit, void *,
- (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
+ (void *__dest, int __c, size_t __n), _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t
__n));
# endif
@@ -443,7 +443,7 @@ _GL_WARN_ON_USE (memset_explicit, "memset_explicit is
unportable - "
occur within N bytes. */
#if @GNULIB_RAWMEMCHR@
# if ! @HAVE_RAWMEMCHR@
-_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
+_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
@@ -481,14 +481,14 @@ _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
# define stpcpy rpl_stpcpy
# endif
_GL_FUNCDECL_RPL (stpcpy, char *,
- (char *restrict __dst, char const *restrict __src)
+ (char *restrict __dst, char const *restrict __src),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (stpcpy, char *,
(char *restrict __dst, char const *restrict __src));
# else
# if !@HAVE_STPCPY@
_GL_FUNCDECL_SYS (stpcpy, char *,
- (char *restrict __dst, char const *restrict __src)
+ (char *restrict __dst, char const *restrict __src),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (stpcpy, char *,
@@ -515,7 +515,7 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
# endif
_GL_FUNCDECL_RPL (stpncpy, char *,
(char *restrict __dst, char const *restrict __src,
- size_t __n)
+ size_t __n),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (stpncpy, char *,
(char *restrict __dst, char const *restrict __src,
@@ -524,7 +524,7 @@ _GL_CXXALIAS_RPL (stpncpy, char *,
# if ! @HAVE_STPNCPY@
_GL_FUNCDECL_SYS (stpncpy, char *,
(char *restrict __dst, char const *restrict __src,
- size_t __n)
+ size_t __n),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (stpncpy, char *,
@@ -560,14 +560,14 @@ _GL_WARN_ON_USE_CXX (strchr,
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define strchrnul rpl_strchrnul
# endif
-_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
+_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strchrnul, char *,
(const char *str, int ch));
# else
# if ! @HAVE_STRCHRNUL@
-_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
+_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
@@ -606,7 +606,7 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
# define strdup rpl_strdup
# endif
_GL_FUNCDECL_RPL (strdup, char *,
- (char const *__s)
+ (char const *__s),
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
@@ -624,13 +624,13 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
# if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (strdup, char *,
- (char const *__s)
- _GL_ATTRIBUTE_NOTHROW
+ (char const *__s),
_GL_ARG_NONNULL ((1))
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (strdup, char *,
- (char const *__s)
+ (char const *__s),
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
@@ -643,13 +643,13 @@ _GL_CXXALIASWARN (strdup);
/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (strdup, char *,
- (char const *__s)
- _GL_ATTRIBUTE_NOTHROW
+ (char const *__s),
_GL_ARG_NONNULL ((1))
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (strdup, char *,
- (char const *__s)
+ (char const *__s),
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
@@ -688,7 +688,7 @@ _GL_CXXALIASWARN (strdup);
# define strncat rpl_strncat
# endif
_GL_FUNCDECL_RPL (strncat, char *,
- (char *restrict dest, const char *restrict src, size_t n)
+ (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));
@@ -715,7 +715,7 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - "
# define strndup rpl_strndup
# endif
_GL_FUNCDECL_RPL (strndup, char *,
- (char const *__s, size_t __n)
+ (char const *__s, size_t __n),
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
@@ -723,13 +723,13 @@ _GL_CXXALIAS_RPL (strndup, char *, (char const *__s,
size_t __n));
# if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup)
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (strndup, char *,
- (char const *__s, size_t __n)
- _GL_ATTRIBUTE_NOTHROW
+ (char const *__s, size_t __n),
_GL_ARG_NONNULL ((1))
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (strndup, char *,
- (char const *__s, size_t __n)
+ (char const *__s, size_t __n),
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
@@ -742,13 +742,13 @@ _GL_CXXALIASWARN (strndup);
/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (strndup, char *,
- (char const *__s, size_t __n)
- _GL_ATTRIBUTE_NOTHROW
+ (char const *__s, size_t __n),
_GL_ARG_NONNULL ((1))
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (strndup, char *,
- (char const *__s, size_t __n)
+ (char const *__s, size_t __n),
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
@@ -771,13 +771,13 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
# undef strnlen
# define strnlen rpl_strnlen
# endif
-_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)
+_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
# else
# if ! @HAVE_DECL_STRNLEN@
-_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)
+_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
@@ -807,7 +807,7 @@ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on
character strings "
/* Find the first occurrence in S of any character in ACCEPT. */
#if @GNULIB_STRPBRK@
# if ! @HAVE_STRPBRK@
-_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
+_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
# endif
@@ -892,7 +892,7 @@ _GL_WARN_ON_USE_CXX (strrchr,
#if @GNULIB_STRSEP@
# if ! @HAVE_STRSEP@
_GL_FUNCDECL_SYS (strsep, char *,
- (char **restrict __stringp, char const *restrict __delim)
+ (char **restrict __stringp, char const *restrict __delim),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (strsep, char *,
@@ -917,7 +917,7 @@ _GL_WARN_ON_USE (strsep, "strsep is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define strstr rpl_strstr
# endif
-_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
+_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
@@ -963,7 +963,7 @@ _GL_WARN_ON_USE (strstr, "strstr is quadratic on many
systems, and cannot "
# define strcasestr rpl_strcasestr
# endif
_GL_FUNCDECL_RPL (strcasestr, char *,
- (const char *haystack, const char *needle)
+ (const char *haystack, const char *needle),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (strcasestr, char *,
@@ -971,7 +971,7 @@ _GL_CXXALIAS_RPL (strcasestr, char *,
# else
# if ! @HAVE_STRCASESTR@
_GL_FUNCDECL_SYS (strcasestr, char *,
- (const char *haystack, const char *needle)
+ (const char *haystack, const char *needle),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
# endif
@@ -1038,7 +1038,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work
correctly on character "
# endif
_GL_FUNCDECL_RPL (strtok_r, char *,
(char *restrict s, char const *restrict delim,
- char **restrict save_ptr)
+ char **restrict save_ptr),
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (strtok_r, char *,
(char *restrict s, char const *restrict delim,
@@ -1050,7 +1050,7 @@ _GL_CXXALIAS_RPL (strtok_r, char *,
# if ! @HAVE_DECL_STRTOK_R@
_GL_FUNCDECL_SYS (strtok_r, char *,
(char *restrict s, char const *restrict delim,
- char **restrict save_ptr)
+ char **restrict save_ptr),
_GL_ARG_NONNULL ((2, 3)));
# endif
_GL_CXXALIAS_SYS (strtok_r, char *,
@@ -1085,12 +1085,12 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mbslen rpl_mbslen
# endif
-_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
+_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
# else
-_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
+_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
@@ -1117,12 +1117,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t
len)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
# endif
-_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
+_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
# else
-_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
+_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
@@ -1139,12 +1139,12 @@ _GL_CXXALIASWARN (mbschr);
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
# endif
-_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
+_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
# else
-_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
+_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
@@ -1234,12 +1234,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const
char *accept)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
# endif
-_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
+_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
# else
-_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
+_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
@@ -1329,12 +1329,12 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - "
# undef strerror_r
# define strerror_r rpl_strerror_r
# endif
-_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
+_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
# else
# if !@HAVE_DECL_STRERROR_R@
-_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
+_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
@@ -1433,13 +1433,13 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define strverscmp rpl_strverscmp
# endif
-_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *)
+_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *));
# else
# if !@HAVE_STRVERSCMP@
-_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
+_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *),
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
# endif
diff --git a/gnulib/lib/strnlen.c b/gnulib/lib/strnlen.c
index 80857ec22b..5231e4c595 100644
--- a/gnulib/lib/strnlen.c
+++ b/gnulib/lib/strnlen.c
@@ -1,6 +1,5 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc.
- Written by Simon Josefsson.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -19,12 +18,17 @@
#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. */
+/* Find the length of S, but scan at most MAXLEN bytes.
+ S must be a string if it starts with fewer than MAXLEN initialized bytes.
+ If no '\0' terminator is found in that many bytes, return MAXLEN. */
size_t
-strnlen (const char *string, size_t maxlen)
+strnlen (const char *s, size_t maxlen)
{
- const char *end = memchr (string, '\0', maxlen);
- return end ? (size_t) (end - string) : maxlen;
+ /* Do not use memchr, because on some platforms memchr has
+ undefined behavior if MAXLEN exceeds the number of bytes in S. */
+ size_t i;
+ for (i = 0; i < maxlen && s[i]; i++)
+ continue;
+ return i;
}
diff --git a/gnulib/lib/sys_random.in.h b/gnulib/lib/sys_random.in.h
index 22f67b1763..279ce62130 100644
--- a/gnulib/lib/sys_random.in.h
+++ b/gnulib/lib/sys_random.in.h
@@ -45,7 +45,8 @@
#ifndef _@GUARD_PREFIX@_SYS_RANDOM_H
#define _@GUARD_PREFIX@_SYS_RANDOM_H
-/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
+/* This file uses _GL_ATTRIBUTE_NODISCARD, GNULIB_POSIXCHECK,
+ HAVE_RAW_DECL_*. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -76,15 +77,15 @@
# define getrandom rpl_getrandom
# endif
_GL_FUNCDECL_RPL (getrandom, ssize_t,
- (void *buffer, size_t length, unsigned int flags)
- _GL_ARG_NONNULL ((1)));
+ (void *buffer, size_t length, unsigned int flags),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_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)));
+ (void *buffer, size_t length, unsigned int flags),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (getrandom, ssize_t,
(void *buffer, size_t length, unsigned int flags));
diff --git a/gnulib/lib/sys_stat.in.h b/gnulib/lib/sys_stat.in.h
index bf08f33536..531232bbc1 100644
--- a/gnulib/lib/sys_stat.in.h
+++ b/gnulib/lib/sys_stat.in.h
@@ -55,7 +55,8 @@
#ifndef _@GUARD_PREFIX@_SYS_STAT_H
#define _@GUARD_PREFIX@_SYS_STAT_H
-/* This file uses _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.
*/
+/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW,
+ GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -65,7 +66,7 @@
*/
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
-# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
@@ -122,9 +123,11 @@
# if @GNULIB_STAT@
# define stat rpl_stat
# else
- /* Provoke a clear link error if stat() is used as a function and
- module 'stat' is not in use. */
-# define stat stat_used_without_requesting_gnulib_module_stat
+# if !GNULIB_STAT
+ /* Provoke a clear link error if stat() is used as a function and
+ module 'stat' is not in use. */
+# define stat stat_used_without_requesting_gnulib_module_stat
+# endif
# endif
# if !GNULIB_defined_struct_stat
@@ -433,7 +436,7 @@ struct stat
# undef chmod
# define chmod rpl_chmod
# endif
-_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode)
+_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
# elif defined _WIN32 && !defined __CYGWIN__
@@ -478,15 +481,15 @@ _GL_CXXALIASWARN (chmod);
# define fchmodat rpl_fchmodat
# endif
_GL_FUNCDECL_RPL (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag)
- _GL_ARG_NONNULL ((2)));
+ (int fd, char const *file, mode_t mode, int flag),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fchmodat, int,
(int fd, char const *file, mode_t mode, int flag));
# else
# if !@HAVE_FCHMODAT@
_GL_FUNCDECL_SYS (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag)
- _GL_ARG_NONNULL ((2)));
+ (int fd, char const *file, mode_t mode, int flag),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (fchmodat, int,
(int fd, char const *file, mode_t mode, int flag));
@@ -507,7 +510,8 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
# undef fstat
# define fstat rpl_fstat
# endif
-_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL
((2)));
+_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf),
+ _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
# else
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
@@ -516,8 +520,10 @@ _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
_GL_CXXALIASWARN (fstat);
# endif
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
-# undef fstat
-# define fstat fstat_used_without_requesting_gnulib_module_fstat
+# if !GNULIB_FSTAT
+# undef fstat
+# define fstat fstat_used_without_requesting_gnulib_module_fstat
+# endif
#elif @WINDOWS_64_BIT_ST_SIZE@
/* Above, we define stat to _stati64. */
# define fstat _fstati64
@@ -538,7 +544,7 @@ _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
# endif
_GL_FUNCDECL_RPL (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
- int flags)
+ int flags),
_GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_RPL (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
@@ -547,7 +553,7 @@ _GL_CXXALIAS_RPL (fstatat, int,
# if !@HAVE_FSTATAT@
_GL_FUNCDECL_SYS (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
- int flags)
+ int flags),
_GL_ARG_NONNULL ((2, 3)));
# endif
_GL_CXXALIAS_SYS (fstatat, int,
@@ -556,8 +562,10 @@ _GL_CXXALIAS_SYS (fstatat, int,
# endif
_GL_CXXALIASWARN (fstatat);
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
-# undef fstatat
-# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
+# if !GNULIB_FSTATAT
+# undef fstatat
+# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fstatat
# if HAVE_RAW_DECL_FSTATAT
@@ -600,7 +608,7 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
#if @GNULIB_GETUMASK@
# if !@HAVE_GETUMASK@
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
-_GL_FUNCDECL_SYS (getumask, mode_t, (void) _GL_ATTRIBUTE_NOTHROW);
+_GL_FUNCDECL_SYS (getumask, mode_t, (void)) _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (getumask, mode_t, (void));
# endif
@@ -622,7 +630,7 @@ _GL_WARN_ON_USE (getumask, "getumask is not portable - "
/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
denotes a symbolic link. */
# if !@HAVE_LCHMOD@ || defined __hpux
-_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
+_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
@@ -642,7 +650,7 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
# undef mkdir
# define mkdir rpl_mkdir
# endif
-_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
+_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
# elif defined _WIN32 && !defined __CYGWIN__
@@ -700,7 +708,7 @@ _GL_CXXALIASWARN (mkdir);
#if @GNULIB_MKDIRAT@
# if !@HAVE_MKDIRAT@
-_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
+_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
@@ -720,12 +728,12 @@ _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
# undef mkfifo
# define mkfifo rpl_mkfifo
# endif
-_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
+_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
# else
# if !@HAVE_MKFIFO@
-_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
+_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
@@ -746,12 +754,12 @@ _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
# undef mkfifoat
# define mkfifoat rpl_mkfifoat
# endif
-_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
+_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
# else
# if !@HAVE_MKFIFOAT@
-_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
+_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
@@ -774,12 +782,12 @@ _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
# undef mknod
# define mknod rpl_mknod
# endif
-_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
+_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
# else
# if !@HAVE_MKNOD@
-_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
+_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev),
_GL_ARG_NONNULL ((1)));
# endif
/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
@@ -802,14 +810,14 @@ _GL_WARN_ON_USE (mknod, "mknod is not portable - "
# define mknodat rpl_mknodat
# endif
_GL_FUNCDECL_RPL (mknodat, int,
- (int fd, char const *file, mode_t mode, dev_t dev)
+ (int fd, char const *file, mode_t mode, dev_t dev),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mknodat, int,
(int fd, char const *file, mode_t mode, dev_t dev));
# else
# if !@HAVE_MKNODAT@
_GL_FUNCDECL_SYS (mknodat, int,
- (int fd, char const *file, mode_t mode, dev_t dev)
+ (int fd, char const *file, mode_t mode, dev_t dev),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mknodat, int,
@@ -916,7 +924,7 @@ _GL_CXXALIAS_RPL_1 (lstat, stat, int,
# define lstat rpl_lstat
# endif
_GL_FUNCDECL_RPL (lstat, int,
- (const char *restrict name, struct stat *restrict buf)
+ (const char *restrict name, struct stat *restrict buf),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (lstat, int,
(const char *restrict name, struct stat *restrict buf));
@@ -928,8 +936,10 @@ _GL_CXXALIAS_SYS (lstat, int,
_GL_CXXALIASWARN (lstat);
# endif
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
-# undef lstat
-# define lstat lstat_used_without_requesting_gnulib_module_lstat
+# if !GNULIB_LSTAT
+# undef lstat
+# define lstat lstat_used_without_requesting_gnulib_module_lstat
+# endif
#elif defined GNULIB_POSIXCHECK
# undef lstat
# if HAVE_RAW_DECL_LSTAT
@@ -968,14 +978,14 @@ _GL_CXXALIASWARN (umask);
# define utimensat rpl_utimensat
# endif
_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag)
+ struct timespec const times[2], int flag),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
struct timespec const times[2], int flag));
# else
# if !@HAVE_UTIMENSAT@
_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag)
+ struct timespec const times[2], int flag),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
diff --git a/gnulib/lib/time.in.h b/gnulib/lib/time.in.h
index df99c8abca..eebc60d42c 100644
--- a/gnulib/lib/time.in.h
+++ b/gnulib/lib/time.in.h
@@ -122,6 +122,23 @@ struct __time_t_must_be_integral {
# endif
# endif
+# if @GNULIB_TZNAME@
+/* tzname[0..1]: Abbreviated time zone names, set by the tzset() function. */
+# if NEED_DECL_TZNAME
+extern
+# ifdef __cplusplus
+ "C"
+# endif
+ char *tzname[];
+# endif
+# if defined _WIN32 && !defined __CYGWIN__
+/* On native Windows, map 'tzname' to '_tzname' etc., so that -loldnames is not
+ required. */
+# undef tzname
+# define tzname _tzname
+# endif
+# endif
+
/* Set *TS to the current time, and return BASE.
Upon failure, return 0. */
# if @GNULIB_TIMESPEC_GET@
@@ -130,12 +147,12 @@ struct __time_t_must_be_integral {
# undef timespec_get
# define timespec_get rpl_timespec_get
# endif
-_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base)
+_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base));
# else
# if !@HAVE_TIMESPEC_GET@
-_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base)
+_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base));
@@ -159,12 +176,12 @@ _GL_WARN_ON_USE (timespec_get, "timespec_get is
unportable - "
# undef timespec_getres
# define timespec_getres rpl_timespec_getres
# endif
-_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base)
+_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base));
# else
# if !@HAVE_TIMESPEC_GETRES@
-_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base)
+_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
@@ -209,14 +226,14 @@ _GL_WARN_ON_USE (time, "time has consistency problems - "
# define nanosleep rpl_nanosleep
# endif
_GL_FUNCDECL_RPL (nanosleep, int,
- (struct timespec const *__rqtp, struct timespec *__rmtp)
+ (struct timespec const *__rqtp, struct timespec *__rmtp),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (nanosleep, int,
(struct timespec const *__rqtp, struct timespec *__rmtp));
# else
# if ! @HAVE_NANOSLEEP@
_GL_FUNCDECL_SYS (nanosleep, int,
- (struct timespec const *__rqtp, struct timespec *__rmtp)
+ (struct timespec const *__rqtp, struct timespec *__rmtp),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (nanosleep, int,
@@ -278,7 +295,7 @@ _GL_WARN_ON_USE (tzset, "tzset has portability problems - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mktime rpl_mktime
# endif
-_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
# else
_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
@@ -304,14 +321,14 @@ _GL_WARN_ON_USE (mktime, "mktime has portability problems
- "
# define localtime_r rpl_localtime_r
# endif
_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result)
+ struct tm *restrict __result),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# else
# if ! @HAVE_DECL_LOCALTIME_R@
_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result)
+ struct tm *restrict __result),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
@@ -326,14 +343,14 @@ _GL_CXXALIASWARN (localtime_r);
# define gmtime_r rpl_gmtime_r
# endif
_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result)
+ struct tm *restrict __result),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# else
# if ! @HAVE_DECL_LOCALTIME_R@
_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
- struct tm *restrict __result)
+ struct tm *restrict __result),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
@@ -364,7 +381,7 @@ _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - "
# undef localtime
# define localtime rpl_localtime
# endif
-_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
+_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
# else
@@ -387,7 +404,7 @@ _GL_WARN_ON_USE (localtime, "localtime has portability
problems - "
# undef gmtime
# define gmtime rpl_gmtime
# endif
-_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
+_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
# else
@@ -403,7 +420,7 @@ _GL_CXXALIASWARN (gmtime);
# if ! @HAVE_STRPTIME@
_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
char const *restrict __format,
- struct tm *restrict __tm)
+ struct tm *restrict __tm),
_GL_ARG_NONNULL ((1, 2, 3)));
# endif
_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
@@ -428,7 +445,7 @@ _GL_WARN_ON_USE (strptime, "strptime is unportable - "
# ifndef __cplusplus
_GL_ATTRIBUTE_DEPRECATED
# endif
-_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp)
+_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
# else
@@ -450,7 +467,7 @@ _GL_CXXALIASWARN (ctime);
# endif
_GL_FUNCDECL_RPL (strftime, size_t,
(char *restrict __buf, size_t __bufsize,
- const char *restrict __fmt, const struct tm *restrict __tp)
+ const char *restrict __fmt, const struct tm *restrict __tp),
_GL_ARG_NONNULL ((1, 3, 4)));
_GL_CXXALIAS_RPL (strftime, size_t,
(char *restrict __buf, size_t __bufsize,
@@ -504,7 +521,8 @@ _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz));
of an implicit global time zone. */
_GL_FUNCDECL_SYS (localtime_rz, struct tm *,
(timezone_t __tz, time_t const *restrict __timer,
- struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3)));
+ struct tm *restrict __result),
+ _GL_ARG_NONNULL ((2, 3)));
_GL_CXXALIAS_SYS (localtime_rz, struct tm *,
(timezone_t __tz, time_t const *restrict __timer,
struct tm *restrict __result));
@@ -515,7 +533,7 @@ _GL_CXXALIAS_SYS (localtime_rz, struct tm *,
This function is like 'mktime', but relies on the argument TZ instead
of an implicit global time zone. */
_GL_FUNCDECL_SYS (mktime_z, time_t,
- (timezone_t __tz, struct tm *restrict __tm)
+ (timezone_t __tz, struct tm *restrict __tm),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_SYS (mktime_z, time_t,
(timezone_t __tz, struct tm *restrict __tm));
@@ -535,11 +553,11 @@ _GL_CXXALIAS_SYS (mktime_z, time_t,
# undef timegm
# define timegm rpl_timegm
# endif
-_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
# else
# if ! @HAVE_TIMEGM@
-_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
# endif
diff --git a/gnulib/lib/uchar.in.h b/gnulib/lib/uchar.in.h
index 166cbeccf8..a94322b88b 100644
--- a/gnulib/lib/uchar.in.h
+++ b/gnulib/lib/uchar.in.h
@@ -170,7 +170,7 @@ btoc32 (int c)
}
_GL_END_C_LINKAGE
# else
-_GL_FUNCDECL_SYS (btoc32, wint_t, (int c) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_SYS (btoc32, wint_t, (int c), _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (btoc32, wint_t, (int c));
_GL_CXXALIASWARN (btoc32);
@@ -516,7 +516,7 @@ _GL_END_C_LINKAGE
# else
_GL_FUNCDECL_SYS (c32snrtombs, size_t,
(char *dest, const char32_t **srcp, size_t srclen, size_t
len,
- mbstate_t *ps)
+ mbstate_t *ps),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (c32snrtombs, size_t,
@@ -542,7 +542,8 @@ c32srtombs (char *dest, const char32_t **srcp, size_t len,
mbstate_t *ps)
_GL_END_C_LINKAGE
# else
_GL_FUNCDECL_SYS (c32srtombs, size_t,
- (char *dest, const char32_t **srcp, size_t len, mbstate_t
*ps)
+ (char *dest, const char32_t **srcp, size_t len,
+ mbstate_t *ps),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (c32srtombs, size_t,
@@ -567,7 +568,7 @@ c32stombs (char *dest, const char32_t *src, size_t len)
_GL_END_C_LINKAGE
# else
_GL_FUNCDECL_SYS (c32stombs, size_t,
- (char *dest, const char32_t *src, size_t len)
+ (char *dest, const char32_t *src, size_t len),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (c32stombs, size_t,
@@ -591,7 +592,7 @@ c32swidth (const char32_t *s, size_t n)
}
_GL_END_C_LINKAGE
# else
-_GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n)
+_GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (c32swidth, int, (const char32_t *s, size_t n));
@@ -704,7 +705,7 @@ _GL_END_C_LINKAGE
# else
_GL_FUNCDECL_SYS (mbsnrtoc32s, size_t,
(char32_t *dest, const char **srcp, size_t srclen, size_t
len,
- mbstate_t *ps)
+ mbstate_t *ps),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mbsnrtoc32s, size_t,
@@ -730,7 +731,8 @@ mbsrtoc32s (char32_t *dest, const char **srcp, size_t len,
mbstate_t *ps)
_GL_END_C_LINKAGE
# else
_GL_FUNCDECL_SYS (mbsrtoc32s, size_t,
- (char32_t *dest, const char **srcp, size_t len, mbstate_t
*ps)
+ (char32_t *dest, const char **srcp, size_t len,
+ mbstate_t *ps),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mbsrtoc32s, size_t,
@@ -755,7 +757,7 @@ mbstoc32s (char32_t *dest, const char *src, size_t len)
_GL_END_C_LINKAGE
# else
_GL_FUNCDECL_SYS (mbstoc32s, size_t,
- (char32_t *dest, const char *src, size_t len)
+ (char32_t *dest, const char *src, size_t len),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mbstoc32s, size_t,
@@ -796,7 +798,7 @@ c32_get_type_test (const char *name)
}
_GL_END_C_LINKAGE
# else
-_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name)
+_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name));
@@ -828,7 +830,7 @@ _GL_FUNCDECL_SYS (c32_apply_type_test, int,
# endif
# else
_GL_FUNCDECL_SYS (c32_apply_type_test, int,
- (wint_t wc, c32_type_test_t property)
+ (wint_t wc, c32_type_test_t property),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (c32_apply_type_test, int,
@@ -868,7 +870,7 @@ c32_get_mapping (const char *name)
}
_GL_END_C_LINKAGE
# else
-_GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name)
+_GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (c32_get_mapping, c32_mapping_t, (const char *name));
@@ -895,7 +897,7 @@ c32_apply_mapping (wint_t wc, c32_mapping_t mapping)
_GL_END_C_LINKAGE
# else
_GL_FUNCDECL_SYS (c32_apply_mapping, wint_t,
- (wint_t wc, c32_mapping_t mapping)
+ (wint_t wc, c32_mapping_t mapping),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (c32_apply_mapping, wint_t,
diff --git a/gnulib/lib/unistd.in.h b/gnulib/lib/unistd.in.h
index e01629af25..3222f5a568 100644
--- a/gnulib/lib/unistd.in.h
+++ b/gnulib/lib/unistd.in.h
@@ -69,8 +69,8 @@
#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
#define _@GUARD_PREFIX@_UNISTD_H
-/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK,
- HAVE_RAW_DECL_*. */
+/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
+ GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -287,7 +287,7 @@ _GL_INLINE_HEADER_BEGIN
# undef access
# define access rpl_access
# endif
-_GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
+_GL_FUNCDECL_RPL (access, int, (const char *file, int mode),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
# elif defined _WIN32 && !defined __CYGWIN__
@@ -340,7 +340,7 @@ _GL_CXXALIASWARN (chdir);
#elif defined GNULIB_POSIXCHECK
# undef chdir
# if HAVE_RAW_DECL_CHDIR
-_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
+_GL_WARN_ON_USE (chdir, "chdir is not always in <unistd.h> - "
"use gnulib module chdir for portability");
# endif
#elif @GNULIB_MDA_CHDIR@
@@ -371,13 +371,13 @@ _GL_CXXALIASWARN (chdir);
# undef chown
# define chown rpl_chown
# endif
-_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
# else
# if !@HAVE_CHOWN@
-_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
# endif
@@ -412,8 +412,10 @@ _GL_CXXALIAS_SYS (close, int, (int fd));
# endif
_GL_CXXALIASWARN (close);
#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
-# undef close
-# define close close_used_without_requesting_gnulib_module_close
+# if !GNULIB_CLOSE
+# undef close
+# define close close_used_without_requesting_gnulib_module_close
+# endif
#elif defined GNULIB_POSIXCHECK
# undef close
/* Assume close is always declared. */
@@ -474,7 +476,7 @@ _GL_WARN_ON_USE (copy_file_range,
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define dup rpl_dup
# endif
-_GL_FUNCDECL_RPL (dup, int, (int oldfd));
+_GL_FUNCDECL_RPL (dup, int, (int oldfd), _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (dup, int, (int oldfd));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -637,7 +639,7 @@ rpl_environ (void)
/* Like access(), except that it uses the effective user id and group id of
the current process. */
# if !@HAVE_EUIDACCESS@
-_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
+_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
@@ -662,7 +664,7 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
# undef execl
# define execl rpl_execl
# endif
-_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...)
+_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
# else
@@ -697,7 +699,7 @@ _GL_CXXALIASWARN (execl);
# undef execle
# define execle rpl_execle
# endif
-_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...)
+_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
# else
@@ -733,7 +735,7 @@ _GL_CXXALIASWARN (execle);
# undef execlp
# define execlp rpl_execlp
# endif
-_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...)
+_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
# else
@@ -770,7 +772,7 @@ _GL_CXXALIASWARN (execlp);
# undef execv
# define execv rpl_execv
# endif
-_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv)
+_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
# else
@@ -807,7 +809,7 @@ _GL_CXXALIASWARN (execv);
# define execve rpl_execve
# endif
_GL_FUNCDECL_RPL (execve, int,
- (const char *program, char * const *argv, char * const *env)
+ (const char *program, char * const *argv, char * const *env),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (execve, int,
(const char *program, char * const *argv, char * const
*env));
@@ -847,7 +849,7 @@ _GL_CXXALIASWARN (execve);
# undef execvp
# define execvp rpl_execvp
# endif
-_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv)
+_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
# else
@@ -884,14 +886,14 @@ _GL_CXXALIASWARN (execvp);
# define execvpe rpl_execvpe
# endif
_GL_FUNCDECL_RPL (execvpe, int,
- (const char *program, char * const *argv, char * const *env)
+ (const char *program, char * const *argv, char * const *env),
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (execvpe, int,
(const char *program, char * const *argv, char * const
*env));
# else
# if !@HAVE_DECL_EXECVPE@
_GL_FUNCDECL_SYS (execvpe, int,
- (const char *program, char * const *argv, char * const *env)
+ (const char *program, char * const *argv, char * const *env),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (execvpe, int,
@@ -922,7 +924,7 @@ _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
# elif @HAVE_EXECVPE@
# if !@HAVE_DECL_EXECVPE@
_GL_FUNCDECL_SYS (execvpe, int,
- (const char *program, char * const *argv, char * const *env)
+ (const char *program, char * const *argv, char * const *env),
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (execvpe, int,
@@ -941,15 +943,15 @@ _GL_CXXALIASWARN (execvpe);
# define faccessat rpl_faccessat
# endif
_GL_FUNCDECL_RPL (faccessat, int,
- (int fd, char const *name, int mode, int flag)
- _GL_ARG_NONNULL ((2)));
+ (int fd, char const *name, int mode, int flag),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (faccessat, int,
(int fd, char const *name, int mode, int flag));
# else
# if !@HAVE_FACCESSAT@
_GL_FUNCDECL_SYS (faccessat, int,
- (int fd, char const *file, int mode, int flag)
- _GL_ARG_NONNULL ((2)));
+ (int fd, char const *file, int mode, int flag),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (faccessat, int,
(int fd, char const *file, int mode, int flag));
@@ -977,11 +979,11 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
# undef fchdir
# define fchdir rpl_fchdir
# endif
-_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/));
+_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
# else
# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
-_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
+_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
# endif
@@ -1010,15 +1012,15 @@ _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
# define fchownat rpl_fchownat
# endif
_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag)
- _GL_ARG_NONNULL ((2)));
+ uid_t owner, gid_t group, int flag),
+ _GL_ARG_NONNULL ((2))
_GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
uid_t owner, gid_t group, int flag));
# else
# if !@HAVE_FCHOWNAT@
_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag)
- _GL_ARG_NONNULL ((2)));
+ uid_t owner, gid_t group, int flag),
+ _GL_ARG_NONNULL ((2))
_GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
uid_t owner, gid_t group, int flag));
@@ -1092,13 +1094,17 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
# undef ftruncate
# define ftruncate rpl_ftruncate
# endif
-_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
-_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
+_GL_FUNCDECL_RPL (ftruncate, int,
+ (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_RPL (ftruncate, int,
+ (int fd, off_t length));
# else
# if !@HAVE_FTRUNCATE@
-_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
+_GL_FUNCDECL_SYS (ftruncate, int,
+ (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
# endif
-_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
+_GL_CXXALIAS_SYS (ftruncate, int,
+ (int fd, off_t length));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (ftruncate);
@@ -1127,7 +1133,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define getcwd rpl_getcwd
# endif
-_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
+_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size),
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1182,15 +1189,19 @@ _GL_CXXALIASWARN (getcwd);
# undef getdomainname
# define getdomainname rpl_getdomainname
# endif
-_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
+_GL_FUNCDECL_RPL (getdomainname, int,
+ (char *name, size_t len),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_RPL (getdomainname, int,
+ (char *name, size_t len));
# else
# if !@HAVE_DECL_GETDOMAINNAME@
-_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (getdomainname, int,
+ (char *name, size_t len),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
-_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
+_GL_CXXALIAS_SYS (getdomainname, int,
+ (char *name, size_t len));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (getdomainname);
@@ -1239,13 +1250,17 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is
unportable - "
# undef getentropy
# define getentropy rpl_getentropy
# endif
-_GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length));
-_GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length));
+_GL_FUNCDECL_RPL (getentropy, int,
+ (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_RPL (getentropy, int,
+ (void *buffer, size_t length));
# else
# if !@HAVE_GETENTROPY@
-_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
+_GL_FUNCDECL_SYS (getentropy, int,
+ (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
# endif
-_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
+_GL_CXXALIAS_SYS (getentropy, int,
+ (void *buffer, size_t length));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (getentropy);
@@ -1270,13 +1285,17 @@ _GL_WARN_ON_USE (getentropy, "getentropy is unportable
- "
# undef getgroups
# define getgroups rpl_getgroups
# endif
-_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
-_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
+_GL_FUNCDECL_RPL (getgroups, int,
+ (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_RPL (getgroups, int,
+ (int n, gid_t *groups));
# else
# if !@HAVE_GETGROUPS@
-_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
+_GL_FUNCDECL_SYS (getgroups, int,
+ (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
# endif
-_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
+_GL_CXXALIAS_SYS (getgroups, int,
+ (int n, gid_t *groups));
# endif
_GL_CXXALIASWARN (getgroups);
#elif defined GNULIB_POSIXCHECK
@@ -1301,12 +1320,12 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
# undef gethostname
# define gethostname rpl_gethostname
# endif
-_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
+_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
# else
# if !@HAVE_GETHOSTNAME@
-_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
+_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len),
_GL_ARG_NONNULL ((1)));
# endif
/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
@@ -1316,8 +1335,10 @@ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name,
size_t len));
# endif
_GL_CXXALIASWARN (gethostname);
#elif @UNISTD_H_HAVE_WINSOCK2_H@
-# undef gethostname
-# define gethostname
gethostname_used_without_requesting_gnulib_module_gethostname
+# if !GNULIB_GETHOSTNAME
+# undef gethostname
+# define gethostname
gethostname_used_without_requesting_gnulib_module_gethostname
+# endif
#elif defined GNULIB_POSIXCHECK
# undef gethostname
# if HAVE_RAW_DECL_GETHOSTNAME
@@ -1371,12 +1392,12 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define getlogin_r rpl_getlogin_r
# endif
-_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
+_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
# else
# if !@HAVE_DECL_GETLOGIN_R@
-_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
+_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size),
_GL_ARG_NONNULL ((1)));
# endif
/* Need to cast, because on Solaris 10 systems, the second argument is
@@ -1493,12 +1514,12 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is
unportable - "
# undef getpass
# define getpass rpl_getpass
# endif
-_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
+_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
# else
# if !@HAVE_GETPASS@
-_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
+_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
@@ -1674,13 +1695,13 @@ _GL_CXXALIASWARN (isatty);
# undef lchown
# define lchown rpl_lchown
# endif
-_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
# else
# if !@HAVE_LCHOWN@
-_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
# endif
@@ -1703,13 +1724,13 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to
pre-POSIX.1-2001 systems - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define link rpl_link
# endif
-_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
- _GL_ARG_NONNULL ((1, 2)));
+_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2),
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
# else
# if !@HAVE_LINK@
-_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
- _GL_ARG_NONNULL ((1, 2)));
+_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2),
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
# endif
@@ -1734,8 +1755,8 @@ _GL_WARN_ON_USE (link, "link is unportable - "
# endif
_GL_FUNCDECL_RPL (linkat, int,
(int fd1, const char *path1, int fd2, const char *path2,
- int flag)
- _GL_ARG_NONNULL ((2, 4)));
+ int flag),
+ _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (linkat, int,
(int fd1, const char *path1, int fd2, const char *path2,
int flag));
@@ -1743,8 +1764,8 @@ _GL_CXXALIAS_RPL (linkat, int,
# if !@HAVE_LINKAT@
_GL_FUNCDECL_SYS (linkat, int,
(int fd1, const char *path1, int fd2, const char *path2,
- int flag)
- _GL_ARG_NONNULL ((2, 4)));
+ int flag),
+ _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (linkat, int,
(int fd1, const char *path1, int fd2, const char *path2,
@@ -1811,7 +1832,8 @@ _GL_CXXALIASWARN (lseek);
Store the read-end as fd[0] and the write-end as fd[1].
Return 0 upon success, or -1 with errno set upon failure. */
# if !@HAVE_PIPE@
-_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (pipe, int, (int fd[2]),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
_GL_CXXALIASWARN (pipe);
@@ -1838,10 +1860,12 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
# undef pipe2
# define pipe2 rpl_pipe2
# endif
-_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
# else
-_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
# endif
# if __GLIBC__ >= 2
@@ -1868,15 +1892,15 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
# define pread rpl_pread
# endif
_GL_FUNCDECL_RPL (pread, ssize_t,
- (int fd, void *buf, size_t bufsize, off_t offset)
- _GL_ARG_NONNULL ((2)));
+ (int fd, void *buf, size_t bufsize, off_t offset),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (pread, ssize_t,
(int fd, void *buf, size_t bufsize, off_t offset));
# else
# if !@HAVE_PREAD@
_GL_FUNCDECL_SYS (pread, ssize_t,
- (int fd, void *buf, size_t bufsize, off_t offset)
- _GL_ARG_NONNULL ((2)));
+ (int fd, void *buf, size_t bufsize, off_t offset),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (pread, ssize_t,
(int fd, void *buf, size_t bufsize, off_t offset));
@@ -1905,15 +1929,15 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
# define pwrite rpl_pwrite
# endif
_GL_FUNCDECL_RPL (pwrite, ssize_t,
- (int fd, const void *buf, size_t bufsize, off_t offset)
- _GL_ARG_NONNULL ((2)));
+ (int fd, const void *buf, size_t bufsize, off_t offset),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (pwrite, ssize_t,
(int fd, const void *buf, size_t bufsize, off_t offset));
# else
# if !@HAVE_PWRITE@
_GL_FUNCDECL_SYS (pwrite, ssize_t,
- (int fd, const void *buf, size_t bufsize, off_t offset)
- _GL_ARG_NONNULL ((2)));
+ (int fd, const void *buf, size_t bufsize, off_t offset),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (pwrite, ssize_t,
(int fd, const void *buf, size_t bufsize, off_t offset));
@@ -1939,8 +1963,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
# undef read
# define read rpl_read
# endif
-_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
- _GL_ARG_NONNULL ((2)));
+
+_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count),
+ _GL_ARG_NONNULL ((2))
_GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1981,8 +2006,8 @@ _GL_CXXALIASWARN (read);
# endif
_GL_FUNCDECL_RPL (readlink, ssize_t,
(const char *restrict file,
- char *restrict buf, size_t bufsize)
- _GL_ARG_NONNULL ((1, 2)));
+ char *restrict buf, size_t bufsize),
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (readlink, ssize_t,
(const char *restrict file,
char *restrict buf, size_t bufsize));
@@ -1990,8 +2015,8 @@ _GL_CXXALIAS_RPL (readlink, ssize_t,
# if !@HAVE_READLINK@
_GL_FUNCDECL_SYS (readlink, ssize_t,
(const char *restrict file,
- char *restrict buf, size_t bufsize)
- _GL_ARG_NONNULL ((1, 2)));
+ char *restrict buf, size_t bufsize),
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (readlink, ssize_t,
(const char *restrict file,
@@ -2014,8 +2039,8 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
# endif
_GL_FUNCDECL_RPL (readlinkat, ssize_t,
(int fd, char const *restrict file,
- char *restrict buf, size_t len)
- _GL_ARG_NONNULL ((2, 3)));
+ char *restrict buf, size_t len),
+ _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (readlinkat, ssize_t,
(int fd, char const *restrict file,
char *restrict buf, size_t len));
@@ -2023,8 +2048,8 @@ _GL_CXXALIAS_RPL (readlinkat, ssize_t,
# if !@HAVE_READLINKAT@
_GL_FUNCDECL_SYS (readlinkat, ssize_t,
(int fd, char const *restrict file,
- char *restrict buf, size_t len)
- _GL_ARG_NONNULL ((2, 3)));
+ char *restrict buf, size_t len),
+ _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (readlinkat, ssize_t,
(int fd, char const *restrict file,
@@ -2048,7 +2073,7 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable
- "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define rmdir rpl_rmdir
# endif
-_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (rmdir, int, (char const *name), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2097,18 +2122,22 @@ _GL_CXXALIASWARN (rmdir);
# undef sethostname
# define sethostname rpl_sethostname
# endif
-_GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len));
+_GL_FUNCDECL_RPL (sethostname, int,
+ (const char *name, size_t len),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_RPL (sethostname, int,
+ (const char *name, size_t len));
# else
# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
-_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (sethostname, int,
+ (const char *name, size_t len),
+ _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
# endif
/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
and FreeBSD 6.4 the second parameter is int. On Solaris 11
2011-10, the first parameter is not const. */
-_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
+_GL_CXXALIAS_SYS_CAST (sethostname, int,
+ (const char *name, size_t len));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (sethostname);
@@ -2181,15 +2210,19 @@ _GL_CXXALIASWARN (swab);
# undef symlink
# define symlink rpl_symlink
# endif
-_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
- _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
+_GL_FUNCDECL_RPL (symlink, int,
+ (char const *contents, char const *file),
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_RPL (symlink, int,
+ (char const *contents, char const *file));
# else
# if !@HAVE_SYMLINK@
-_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
- _GL_ARG_NONNULL ((1, 2)));
+_GL_FUNCDECL_SYS (symlink, int,
+ (char const *contents, char const *file),
+ _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
# endif
-_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
+_GL_CXXALIAS_SYS (symlink, int,
+ (char const *contents, char const *file));
# endif
_GL_CXXALIASWARN (symlink);
#elif defined GNULIB_POSIXCHECK
@@ -2208,15 +2241,15 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - "
# define symlinkat rpl_symlinkat
# endif
_GL_FUNCDECL_RPL (symlinkat, int,
- (char const *contents, int fd, char const *file)
- _GL_ARG_NONNULL ((1, 3)));
+ (char const *contents, int fd, char const *file),
+ _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (symlinkat, int,
(char const *contents, int fd, char const *file));
# else
# if !@HAVE_SYMLINKAT@
_GL_FUNCDECL_SYS (symlinkat, int,
- (char const *contents, int fd, char const *file)
- _GL_ARG_NONNULL ((1, 3)));
+ (char const *contents, int fd, char const *file),
+ _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (symlinkat, int,
(char const *contents, int fd, char const *file));
@@ -2243,13 +2276,13 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable
- "
# undef truncate
# define truncate rpl_truncate
# endif
-_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length),
+ _GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
# else
# if !@HAVE_DECL_TRUNCATE@
-_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
- _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length),
+ _GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
# endif
@@ -2274,13 +2307,15 @@ _GL_WARN_ON_USE (truncate, "truncate is unportable - "
# define ttyname_r rpl_ttyname_r
# endif
_GL_FUNCDECL_RPL (ttyname_r, int,
- (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
+ (int fd, char *buf, size_t buflen),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (ttyname_r, int,
(int fd, char *buf, size_t buflen));
# else
# if !@HAVE_DECL_TTYNAME_R@
_GL_FUNCDECL_SYS (ttyname_r, int,
- (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
+ (int fd, char *buf, size_t buflen),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (ttyname_r, int,
(int fd, char *buf, size_t buflen));
@@ -2303,7 +2338,7 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
# undef unlink
# define unlink rpl_unlink
# endif
-_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (unlink, int, (char const *file), _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (unlink, int, (char const *file));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2344,12 +2379,12 @@ _GL_CXXALIASWARN (unlink);
# undef unlinkat
# define unlinkat rpl_unlinkat
# endif
-_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
+_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
# else
# if !@HAVE_UNLINKAT@
-_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
+_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
@@ -2403,17 +2438,21 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
# undef write
# define write rpl_write
# endif
-_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
- _GL_ARG_NONNULL ((2)));
-_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
+_GL_FUNCDECL_RPL (write, ssize_t,
+ (int fd, const void *buf, size_t count),
+ _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
+_GL_CXXALIAS_RPL (write, ssize_t,
+ (int fd, const void *buf, size_t count));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef write
# define write _write
# endif
-_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
+_GL_CXXALIAS_MDA (write, ssize_t,
+ (int fd, const void *buf, size_t count));
# else
-_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+_GL_CXXALIAS_SYS (write, ssize_t,
+ (int fd, const void *buf, size_t count));
# endif
_GL_CXXALIASWARN (write);
#elif @GNULIB_MDA_WRITE@
@@ -2425,9 +2464,11 @@ _GL_CXXALIASWARN (write);
# undef write
# define write _write
# endif
-_GL_CXXALIAS_MDA_CAST (write, ssize_t, (int fd, const void *buf, unsigned int
count));
+_GL_CXXALIAS_MDA_CAST (write, ssize_t,
+ (int fd, const void *buf, unsigned int count));
# else
-_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+_GL_CXXALIAS_SYS (write, ssize_t,
+ (int fd, const void *buf, size_t count));
# endif
_GL_CXXALIASWARN (write);
#endif
diff --git a/gnulib/lib/vasnprintf.c b/gnulib/lib/vasnprintf.c
index ac8dc8619e..8efb9ebee2 100644
--- a/gnulib/lib/vasnprintf.c
+++ b/gnulib/lib/vasnprintf.c
@@ -80,12 +80,13 @@
#endif
#include <locale.h> /* localeconv() */
+#include <stdint.h> /* PTRDIFF_MAX */
#include <stdio.h> /* snprintf(), sprintf() */
#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
#include <string.h> /* memcpy(), strlen() */
#include <wchar.h> /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb(),
mbszero() */
#include <errno.h> /* errno */
-#include <limits.h> /* CHAR_BIT, INT_WIDTH, LONG_WIDTH */
+#include <limits.h> /* CHAR_BIT, INT_MAX, INT_WIDTH, LONG_WIDTH */
#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP, LDBL_MANT_DIG */
#if HAVE_NL_LANGINFO
# include <langinfo.h>
@@ -231,7 +232,7 @@
#undef remainder
#define remainder rem
-#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) &&
!WIDE_CHAR_VERSION
+#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF ||
(PTRDIFF_MAX > INT_MAX)) && !WIDE_CHAR_VERSION
# if (HAVE_STRNLEN && !defined _AIX)
# define local_strnlen strnlen
# else
@@ -247,7 +248,7 @@ local_strnlen (const char *string, size_t maxlen)
# endif
#endif
-#if (((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 ||
USE_MSVC__SNPRINTF || NEED_WPRINTF_DIRECTIVE_LC) && WIDE_CHAR_VERSION) ||
((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF ||
NEED_PRINTF_DIRECTIVE_LS) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) &&
HAVE_WCHAR_T
+#if ((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 ||
USE_MSVC__SNPRINTF || (PTRDIFF_MAX > INT_MAX) || !DCHAR_IS_TCHAR ||
NEED_WPRINTF_DIRECTIVE_LC) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF ||
(PTRDIFF_MAX > INT_MAX) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF ||
NEED_PRINTF_DIRECTIVE_LS) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)
# if HAVE_WCSLEN
# define local_wcslen wcslen
# else
@@ -270,7 +271,7 @@ local_wcslen (const wchar_t *s)
# endif
#endif
-#if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) ||
!HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T &&
WIDE_CHAR_VERSION
+#if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) ||
!HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && WIDE_CHAR_VERSION
# if HAVE_WCSNLEN && HAVE_DECL_WCSNLEN
# define local_wcsnlen wcsnlen
# else
@@ -289,7 +290,7 @@ local_wcsnlen (const wchar_t *s, size_t maxlen)
# endif
#endif
-#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF ||
NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) ||
((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T)) &&
!WIDE_CHAR_VERSION
+#if ((!USE_SNPRINTF || (PTRDIFF_MAX > INT_MAX) || !HAVE_SNPRINTF_RETVAL_C99 ||
USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) ||
((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T)) &&
!WIDE_CHAR_VERSION
# if ENABLE_WCHAR_FALLBACK
static size_t
wctomb_fallback (char *s, wchar_t wc)
@@ -2148,10 +2149,9 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index,
FCHAR_T conversion,
break;
case 's':
-# if HAVE_WCHAR_T
if (type == TYPE_WIDE_STRING)
{
-# if WIDE_CHAR_VERSION
+# if WIDE_CHAR_VERSION
/* ISO C says about %ls in fwprintf:
"If the precision is not specified or is greater than the size
of the array, the array shall contain a null wide character."
@@ -2162,7 +2162,7 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index,
FCHAR_T conversion,
tmp_length = local_wcsnlen (arg, precision);
else
tmp_length = local_wcslen (arg);
-# else
+# else
/* ISO C says about %ls in fprintf:
"If a precision is specified, no more than that many bytes are
written (including shift sequences, if any), and the array
@@ -2173,10 +2173,9 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index,
FCHAR_T conversion,
So if there is a precision, we must not use wcslen. */
/* This case has already been handled separately in VASNPRINTF. */
abort ();
-# endif
+# endif
}
else
-# endif
{
# if WIDE_CHAR_VERSION
/* ISO C says about %s in fwprintf:
@@ -2460,6 +2459,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
has_width = 1;
}
@@ -2538,7 +2539,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
/* Use the entire string. */
arg_end = arg + u8_strlen (arg);
- /* The number of characters doesn't matter. */
+ /* The number of characters doesn't matter,
+ because !has_width and therefore width==0. */
characters = 0;
}
@@ -2579,7 +2581,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (converted != result + length)
{
ENSURE_ALLOCATION_ELSE (xsum (length,
converted_len),
- { free (converted); goto
out_of_memory; });
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted,
converted_len);
free (converted);
}
@@ -2640,7 +2642,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
/* Use the entire string. */
arg_end = arg + u16_strlen (arg);
- /* The number of characters doesn't matter. */
+ /* The number of characters doesn't matter,
+ because !has_width and therefore width==0. */
characters = 0;
}
@@ -2681,7 +2684,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (converted != result + length)
{
ENSURE_ALLOCATION_ELSE (xsum (length,
converted_len),
- { free (converted); goto
out_of_memory; });
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted,
converted_len);
free (converted);
}
@@ -2742,7 +2745,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
/* Use the entire string. */
arg_end = arg + u32_strlen (arg);
- /* The number of characters doesn't matter. */
+ /* The number of characters doesn't matter,
+ because !has_width and therefore width==0. */
characters = 0;
}
@@ -2783,7 +2787,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (converted != result + length)
{
ENSURE_ALLOCATION_ELSE (xsum (length,
converted_len),
- { free (converted); goto
out_of_memory; });
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted,
converted_len);
free (converted);
}
@@ -2806,7 +2810,190 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
#endif
-#if WIDE_CHAR_VERSION && (!DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC)
+#if !WIDE_CHAR_VERSION && (PTRDIFF_MAX > INT_MAX)
+ else if (dp->conversion == 's'
+ && a.arg[dp->arg_index].type != TYPE_WIDE_STRING)
+ {
+ /* %s in vasnprintf. See the specification of fprintf.
+ We handle it ourselves here, because the string may be
longer
+ than INT_MAX characters, whence snprintf or sprintf would
+ fail to process it. */
+ int flags = dp->flags;
+ int has_width;
+ size_t width;
+ int has_precision;
+ size_t precision;
+
+ has_width = 0;
+ width = 0;
+ if (dp->width_start != dp->width_end)
+ {
+ if (dp->width_arg_index != ARG_NONE)
+ {
+ int arg;
+
+ if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+ abort ();
+ arg = a.arg[dp->width_arg_index].a.a_int;
+ width = arg;
+ if (arg < 0)
+ {
+ /* "A negative field width is taken as a '-' flag
+ followed by a positive field width." */
+ flags |= FLAG_LEFT;
+ width = -width;
+ }
+ }
+ else
+ {
+ const FCHAR_T *digitp = dp->width_start;
+
+ do
+ width = xsum (xtimes (width, 10), *digitp++ - '0');
+ while (digitp != dp->width_end);
+ }
+ if (width > (size_t) INT_MAX)
+ goto overflow;
+ has_width = 1;
+ }
+
+ has_precision = 0;
+ precision = 6;
+ if (dp->precision_start != dp->precision_end)
+ {
+ if (dp->precision_arg_index != ARG_NONE)
+ {
+ int arg;
+
+ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+ abort ();
+ arg = a.arg[dp->precision_arg_index].a.a_int;
+ /* "A negative precision is taken as if the precision
+ were omitted." */
+ if (arg >= 0)
+ {
+ precision = arg;
+ has_precision = 1;
+ }
+ }
+ else
+ {
+ const FCHAR_T *digitp = dp->precision_start + 1;
+
+ precision = 0;
+ while (digitp != dp->precision_end)
+ precision = xsum (xtimes (precision, 10), *digitp++
- '0');
+ has_precision = 1;
+ }
+ }
+
+ {
+ const char *arg = a.arg[dp->arg_index].a.a_string;
+ size_t bytes;
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
+ size_t characters;
+# endif
+# if !DCHAR_IS_TCHAR
+ /* This code assumes that TCHAR_T is 'char'. */
+ static_assert (sizeof (TCHAR_T) == 1);
+ DCHAR_T *tmpdst;
+ size_t tmpdst_len;
+# endif
+ size_t w;
+
+ if (has_precision)
+ {
+ /* Use only at most PRECISION bytes, from the left. */
+ bytes = local_strnlen (arg, precision);
+ }
+ else
+ {
+ /* Use the entire string, and count the number of
+ bytes. */
+ bytes = strlen (arg);
+ }
+
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
+ if (has_width)
+ characters = mbsnlen (arg, bytes);
+ else
+ {
+ /* The number of characters doesn't matter,
+ because !has_width and therefore width==0. */
+ characters = 0;
+ }
+# endif
+
+# if !DCHAR_IS_TCHAR
+ /* Convert from TCHAR_T[] to DCHAR_T[]. */
+ tmpdst =
+ DCHAR_CONV_FROM_ENCODING (locale_charset (),
+ iconveh_question_mark,
+ arg, bytes,
+ NULL,
+ NULL, &tmpdst_len);
+ if (tmpdst == NULL)
+ goto fail_with_errno;
+# endif
+
+ if (has_width)
+ {
+# if ENABLE_UNISTDIO
+ /* Outside POSIX, it's preferable to compare the width
+ against the number of _characters_ of the converted
+ value. */
+# if DCHAR_IS_TCHAR
+ w = characters;
+# else
+ w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
+# endif
+# else
+ /* The width is compared against the number of _bytes_
+ of the converted value, says POSIX. */
+ w = bytes;
+# endif
+ }
+ else
+ /* w doesn't matter. */
+ w = 0;
+
+ {
+# if DCHAR_IS_TCHAR
+ size_t total = bytes + (w < width ? width - w : 0);
+ ENSURE_ALLOCATION (xsum (length, total));
+# else
+ size_t total = tmpdst_len + (w < width ? width - w : 0);
+ ENSURE_ALLOCATION_ELSE (xsum (length, total),
+ { free (tmpdst); goto out_of_memory; });
+# endif
+
+ if (w < width && !(flags & FLAG_LEFT))
+ {
+ size_t n = width - w;
+ DCHAR_SET (result + length, ' ', n);
+ length += n;
+ }
+
+# if DCHAR_IS_TCHAR
+ memcpy (result + length, arg, bytes);
+ length += bytes;
+# else
+ DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+ free (tmpdst);
+ length += tmpdst_len;
+# endif
+
+ if (w < width && (flags & FLAG_LEFT))
+ {
+ size_t n = width - w;
+ DCHAR_SET (result + length, ' ', n);
+ length += n;
+ }
+ }
+ }
+ }
+#endif
+#if WIDE_CHAR_VERSION && ((PTRDIFF_MAX > INT_MAX) || !DCHAR_IS_TCHAR ||
NEED_WPRINTF_DIRECTIVE_LC)
else if ((dp->conversion == 's'
&& a.arg[dp->arg_index].type == TYPE_WIDE_STRING)
|| (dp->conversion == 'c'
@@ -2847,6 +3034,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
}
{
@@ -2949,7 +3138,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
#endif
-#if (!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 ||
USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) &&
HAVE_WCHAR_T
+#if WIDE_CHAR_VERSION || !USE_SNPRINTF || (PTRDIFF_MAX > INT_MAX) ||
!HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS ||
ENABLE_WCHAR_FALLBACK
else if (dp->conversion == 's'
# if WIDE_CHAR_VERSION
&& a.arg[dp->arg_index].type != TYPE_WIDE_STRING
@@ -3002,6 +3191,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
has_width = 1;
}
@@ -3182,11 +3373,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
const wchar_t *arg_end;
+ size_t bytes;
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
size_t characters;
+# endif
# if !DCHAR_IS_TCHAR
/* This code assumes that TCHAR_T is 'char'. */
static_assert (sizeof (TCHAR_T) == 1);
- TCHAR_T *tmpsrc;
DCHAR_T *tmpdst;
size_t tmpdst_len;
# endif
@@ -3201,7 +3394,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
mbszero (&state);
# endif
arg_end = arg;
+ bytes = 0;
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
characters = 0;
+# endif
while (precision > 0)
{
char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
@@ -3217,7 +3413,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (precision < (unsigned int) count)
break;
arg_end++;
- characters += count;
+ bytes += count;
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
+ characters += mbsnlen (cbuf, count);
+# endif
precision -= count;
}
}
@@ -3234,7 +3433,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
mbszero (&state);
# endif
arg_end = arg;
+ bytes = 0;
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
characters = 0;
+# endif
for (;;)
{
char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
@@ -3248,7 +3450,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* Cannot convert. */
goto fail_with_EILSEQ;
arg_end++;
- characters += count;
+ bytes += count;
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
+ characters += mbsnlen (cbuf, count);
+# endif
}
}
# if DCHAR_IS_TCHAR
@@ -3256,56 +3461,64 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
/* Use the entire string. */
arg_end = arg + local_wcslen (arg);
- /* The number of bytes doesn't matter. */
+ /* The number of bytes and characters doesn't matter,
+ because !has_width and therefore width==0. */
+ bytes = 0;
+# if ENABLE_UNISTDIO
characters = 0;
+# endif
}
# endif
# if !DCHAR_IS_TCHAR
- /* Convert the string into a piece of temporary memory. */
- tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
- if (tmpsrc == NULL)
- goto out_of_memory;
{
- TCHAR_T *tmpptr = tmpsrc;
- size_t remaining;
+ TCHAR_T *tmpsrc;
+
+ /* Convert the string into a piece of temporary memory. */
+ tmpsrc = (TCHAR_T *) malloc (bytes * sizeof (TCHAR_T));
+ if (tmpsrc == NULL)
+ goto out_of_memory;
+ {
+ TCHAR_T *tmpptr = tmpsrc;
+ size_t remaining;
# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- mbstate_t state;
- mbszero (&state);
+ mbstate_t state;
+ mbszero (&state);
# endif
- for (remaining = characters; remaining > 0; )
- {
- char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
- int count;
+ for (remaining = bytes; remaining > 0; )
+ {
+ char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
+ int count;
- if (*arg == 0)
- abort ();
- count = local_wcrtomb (cbuf, *arg, &state);
- if (count <= 0)
- /* Inconsistency. */
- abort ();
- memcpy (tmpptr, cbuf, count);
- tmpptr += count;
- arg++;
- remaining -= count;
+ if (*arg == 0)
+ abort ();
+ count = local_wcrtomb (cbuf, *arg, &state);
+ if (count <= 0)
+ /* Inconsistency. */
+ abort ();
+ memcpy (tmpptr, cbuf, count);
+ tmpptr += count;
+ arg++;
+ remaining -= count;
+ }
+ if (!(arg == arg_end))
+ abort ();
+ }
+
+ /* Convert from TCHAR_T[] to DCHAR_T[]. */
+ tmpdst =
+ DCHAR_CONV_FROM_ENCODING (locale_charset (),
+ iconveh_question_mark,
+ tmpsrc, bytes,
+ NULL,
+ NULL, &tmpdst_len);
+ if (tmpdst == NULL)
+ {
+ free (tmpsrc);
+ goto fail_with_errno;
}
- if (!(arg == arg_end))
- abort ();
+ free (tmpsrc);
}
-
- /* Convert from TCHAR_T[] to DCHAR_T[]. */
- tmpdst =
- DCHAR_CONV_FROM_ENCODING (locale_charset (),
- iconveh_question_mark,
- tmpsrc, characters,
- NULL,
- NULL, &tmpdst_len);
- if (tmpdst == NULL)
- {
- free (tmpsrc);
- goto fail_with_errno;
- }
- free (tmpsrc);
# endif
if (has_width)
@@ -3314,11 +3527,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* Outside POSIX, it's preferable to compare the width
against the number of _characters_ of the converted
value. */
- w = DCHAR_MBSNLEN (result + length, characters);
+# if DCHAR_IS_TCHAR
+ w = characters;
+# else
+ w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
+# endif
# else
/* The width is compared against the number of _bytes_
of the converted value, says POSIX. */
- w = characters;
+ w = bytes;
# endif
}
else
@@ -3328,7 +3545,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (w < width && !(flags & FLAG_LEFT))
{
size_t n = width - w;
+# if DCHAR_IS_TCHAR
ENSURE_ALLOCATION (xsum (length, n));
+# else
+ ENSURE_ALLOCATION_ELSE (xsum (length, n),
+ { free (tmpdst); goto out_of_memory; });
+# endif
DCHAR_SET (result + length, ' ', n);
length += n;
}
@@ -3342,8 +3564,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
mbstate_t state;
mbszero (&state);
# endif
- ENSURE_ALLOCATION (xsum (length, characters));
- for (remaining = characters; remaining > 0; )
+ ENSURE_ALLOCATION (xsum (length, bytes));
+ for (remaining = bytes; remaining > 0; )
{
char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
int count;
@@ -3387,7 +3609,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
# else
ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
- { free (tmpdst); goto out_of_memory;
});
+ { free (tmpdst); goto out_of_memory; });
DCHAR_CPY (result + length, tmpdst, tmpdst_len);
free (tmpdst);
length += tmpdst_len;
@@ -3443,17 +3665,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
has_width = 1;
}
/* %lc in vasnprintf. See the specification of fprintf. */
{
wchar_t arg = (wchar_t) a.arg[dp->arg_index].a.a_wide_char;
+ size_t bytes;
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
size_t characters;
+# endif
# if !DCHAR_IS_TCHAR
/* This code assumes that TCHAR_T is 'char'. */
static_assert (sizeof (TCHAR_T) == 1);
- TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */
DCHAR_T *tmpdst;
size_t tmpdst_len;
# endif
@@ -3464,7 +3690,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
# endif
{
/* Count the number of bytes. */
- characters = 0;
char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
int count;
# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
@@ -3476,43 +3701,54 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (count < 0)
/* Cannot convert. */
goto fail_with_EILSEQ;
- characters = count;
+ bytes = count;
+# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
+ characters = mbsnlen (cbuf, count);
+# endif
}
# if DCHAR_IS_TCHAR
else
{
- /* The number of bytes doesn't matter. */
+ /* The number of bytes and characters doesn't matter,
+ because !has_width and therefore width==0. */
+ bytes = 0;
+# if ENABLE_UNISTDIO
characters = 0;
+# endif
}
# endif
# if !DCHAR_IS_TCHAR
- /* Convert the string into a piece of temporary memory. */
- if (characters > 0)
- {
- char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
- int count;
+ {
+ TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */
+
+ /* Convert the string into a piece of temporary memory. */
+ if (bytes > 0)
+ {
+ char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
+ int count;
# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
- mbstate_t state;
- mbszero (&state);
+ mbstate_t state;
+ mbszero (&state);
# endif
- count = local_wcrtomb (cbuf, arg, &state);
- if (count <= 0)
- /* Inconsistency. */
- abort ();
- memcpy (tmpsrc, cbuf, count);
- }
+ count = local_wcrtomb (cbuf, arg, &state);
+ if (count <= 0)
+ /* Inconsistency. */
+ abort ();
+ memcpy (tmpsrc, cbuf, count);
+ }
- /* Convert from TCHAR_T[] to DCHAR_T[]. */
- tmpdst =
- DCHAR_CONV_FROM_ENCODING (locale_charset (),
- iconveh_question_mark,
- tmpsrc, characters,
- NULL,
- NULL, &tmpdst_len);
- if (tmpdst == NULL)
- goto fail_with_errno;
+ /* Convert from TCHAR_T[] to DCHAR_T[]. */
+ tmpdst =
+ DCHAR_CONV_FROM_ENCODING (locale_charset (),
+ iconveh_question_mark,
+ tmpsrc, bytes,
+ NULL,
+ NULL, &tmpdst_len);
+ if (tmpdst == NULL)
+ goto fail_with_errno;
+ }
# endif
if (has_width)
@@ -3521,11 +3757,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* Outside POSIX, it's preferable to compare the width
against the number of _characters_ of the converted
value. */
- w = DCHAR_MBSNLEN (result + length, characters);
+# if DCHAR_IS_TCHAR
+ w = characters;
+# else
+ w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
+# endif
# else
/* The width is compared against the number of _bytes_
of the converted value, says POSIX. */
- w = characters;
+ w = bytes;
# endif
}
else
@@ -3535,7 +3775,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (w < width && !(flags & FLAG_LEFT))
{
size_t n = width - w;
+# if DCHAR_IS_TCHAR
ENSURE_ALLOCATION (xsum (length, n));
+# else
+ ENSURE_ALLOCATION_ELSE (xsum (length, n),
+ { free (tmpdst); goto out_of_memory; });
+# endif
DCHAR_SET (result + length, ' ', n);
length += n;
}
@@ -3544,8 +3789,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (has_width)
{
/* We know the number of bytes in advance. */
- ENSURE_ALLOCATION (xsum (length, characters));
- if (characters > 0)
+ ENSURE_ALLOCATION (xsum (length, bytes));
+ if (bytes > 0)
{
int count;
# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
@@ -3579,7 +3824,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
# else
ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
- { free (tmpdst); goto out_of_memory;
});
+ { free (tmpdst); goto out_of_memory; });
DCHAR_CPY (result + length, tmpdst, tmpdst_len);
free (tmpdst);
length += tmpdst_len;
@@ -3631,6 +3876,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
}
/* %c in vasnwprintf. See the specification of fwprintf. */
@@ -3645,24 +3892,26 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* Invalid or incomplete multibyte character. */
goto fail_with_EILSEQ;
- if (1 < width && !(flags & FLAG_LEFT))
- {
- size_t n = width - 1;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
+ {
+ size_t total = (1 < width ? width : 1);
+ ENSURE_ALLOCATION (xsum (length, total));
- ENSURE_ALLOCATION (xsum (length, 1));
- result[length++] = wc;
+ if (1 < width && !(flags & FLAG_LEFT))
+ {
+ size_t n = width - 1;
+ DCHAR_SET (result + length, ' ', n);
+ length += n;
+ }
- if (1 < width && (flags & FLAG_LEFT))
- {
- size_t n = width - 1;
- ENSURE_ALLOCATION (xsum (length, n));
- DCHAR_SET (result + length, ' ', n);
- length += n;
- }
+ result[length++] = wc;
+
+ if (1 < width && (flags & FLAG_LEFT))
+ {
+ size_t n = width - 1;
+ DCHAR_SET (result + length, ' ', n);
+ length += n;
+ }
+ }
}
}
#endif
@@ -3719,6 +3968,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
has_width = 1;
}
@@ -3970,7 +4221,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
size_t n = xsum (length, count);
- ENSURE_ALLOCATION (n);
+ ENSURE_ALLOCATION_ELSE (n,
+ { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
}
/* Append the result. */
@@ -4033,6 +4285,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
}
has_precision = 0;
@@ -4460,7 +4714,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
size_t n = xsum (length, count);
- ENSURE_ALLOCATION (n);
+ ENSURE_ALLOCATION_ELSE (n,
+ { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
}
/* Append the result. */
@@ -4538,6 +4793,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
}
has_precision = 0;
@@ -5643,7 +5900,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
size_t n = xsum (length, count);
- ENSURE_ALLOCATION (n);
+ ENSURE_ALLOCATION_ELSE (n,
+ { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
}
/* Append the result. */
@@ -5720,6 +5978,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+ if (width > (size_t) INT_MAX)
+ goto overflow;
+# define WIDTH_IS_CHECKED 1
# if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO ||
NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO ||
NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
has_width = 1;
# endif
@@ -5869,6 +6130,43 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (dp->width_start != dp->width_end)
{
size_t n = dp->width_end - dp->width_start;
+#if !WIDTH_IS_CHECKED
+ size_t width;
+ /* Reject an out-of-range width.
+ The underlying SNPRINTF already does this on some
+ platforms (glibc, musl, macOS, FreeBSD, NetBSD,
+ OpenBSD, Cygwin, Solaris, MSVC). However, on others
+ (AIX, mingw), it doesn't; thus this vasnprintf
+ invocation would succeed and produce a wrong result.
+ So, this is redundant on some platforms, but it's a
+ quick check anyway. */
+ if (dp->width_arg_index != ARG_NONE)
+ {
+ int arg;
+
+ if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+ abort ();
+ arg = a.arg[dp->width_arg_index].a.a_int;
+ width = arg;
+ if (arg < 0)
+ {
+ /* "A negative field width is taken as a '-'
flag
+ followed by a positive field width." */
+ width = -width;
+ }
+ }
+ else
+ {
+ const FCHAR_T *digitp = dp->width_start;
+
+ width = 0;
+ do
+ width = xsum (xtimes (width, 10), *digitp++ -
'0');
+ while (digitp != dp->width_end);
+ }
+ if (width > (size_t) INT_MAX)
+ goto overflow;
+#endif
/* The width specification is known to consist only
of standard ASCII characters. */
if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
@@ -6021,9 +6319,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#if HAVE_WINT_T
case TYPE_WIDE_CHAR:
#endif
- #if HAVE_WCHAR_T
case TYPE_WIDE_STRING:
- #endif
*fbp++ = 'l';
break;
case TYPE_LONGDOUBLE:
@@ -6395,14 +6691,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
SNPRINTF_BUF (arg);
}
break;
-#if HAVE_WCHAR_T
case TYPE_WIDE_STRING:
{
const wchar_t *arg =
a.arg[dp->arg_index].a.a_wide_string;
SNPRINTF_BUF (arg);
}
break;
-#endif
case TYPE_POINTER:
{
void *arg = a.arg[dp->arg_index].a.a_pointer;
@@ -6714,7 +7008,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
goto fail_with_errno;
# endif
ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
- { free (tmpdst); goto
out_of_memory; });
+ { free (tmpdst); goto out_of_memory; });
DCHAR_CPY (result + length, tmpdst, tmpdst_len);
free (tmpdst);
count = tmpdst_len;
@@ -6966,17 +7260,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
not have this limitation. */
return result;
-#if USE_SNPRINTF
overflow:
errno = EOVERFLOW;
goto fail_with_errno;
-#endif
out_of_memory:
errno = ENOMEM;
goto fail_with_errno;
-#if ENABLE_UNISTDIO || ((!USE_SNPRINTF || WIDE_CHAR_VERSION ||
!HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS ||
ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || ((NEED_PRINTF_DIRECTIVE_LC ||
ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T && !WIDE_CHAR_VERSION) ||
(NEED_WPRINTF_DIRECTIVE_C && WIDE_CHAR_VERSION)
+#if ENABLE_UNISTDIO || (WIDE_CHAR_VERSION || !USE_SNPRINTF || (PTRDIFF_MAX >
INT_MAX) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF ||
NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) ||
((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T &&
!WIDE_CHAR_VERSION) || (NEED_WPRINTF_DIRECTIVE_C && WIDE_CHAR_VERSION)
fail_with_EILSEQ:
errno = EILSEQ;
goto fail_with_errno;
diff --git a/gnulib/lib/vasprintf.c b/gnulib/lib/vasprintf.c
index e52aaca586..757d1c740a 100644
--- a/gnulib/lib/vasprintf.c
+++ b/gnulib/lib/vasprintf.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <limits.h>
+#include <stdint.h>
#include <stdlib.h>
#include "vasnprintf.h"
@@ -37,12 +38,21 @@ vasprintf (char **resultp, const char *format, va_list args)
if (result == NULL)
return -1;
+#if PTRDIFF_MAX > INT_MAX
if (length > INT_MAX)
{
free (result);
- errno = EOVERFLOW;
+ errno = (length > PTRDIFF_MAX ? ENOMEM : EOVERFLOW);
return -1;
}
+#else
+ if (length > PTRDIFF_MAX)
+ {
+ free (result);
+ errno = ENOMEM;
+ return -1;
+ }
+#endif
*resultp = result;
/* Return the number of resulting bytes, excluding the trailing NUL. */
diff --git a/gnulib/lib/wchar.in.h b/gnulib/lib/wchar.in.h
index a33a10f747..c08cf7299e 100644
--- a/gnulib/lib/wchar.in.h
+++ b/gnulib/lib/wchar.in.h
@@ -141,7 +141,7 @@
*/
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
-# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4
+# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
@@ -269,11 +269,11 @@ _GL_EXTERN_C void free (void *);
# undef btowc
# define btowc rpl_btowc
# endif
-_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_RPL (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
# else
# if !@HAVE_BTOWC@
-_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_SYS (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
# endif
/* Need to cast, because on mingw, the return type is 'unsigned short'. */
_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
@@ -297,12 +297,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - "
# undef wctob
# define wctob rpl_wctob
# endif
-_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_RPL (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
# else
# if !defined wctob && !@HAVE_DECL_WCTOB@
/* wctob is provided by gnulib, or wctob exists but is not declared. */
-_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_SYS (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
# endif
@@ -623,7 +623,7 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
(wchar_t *restrict dest,
const char **restrict srcp, size_t len,
- mbstate_t *restrict ps)
+ mbstate_t *restrict ps),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
(wchar_t *restrict dest,
@@ -634,7 +634,7 @@ _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
(wchar_t *restrict dest,
const char **restrict srcp, size_t len,
- mbstate_t *restrict ps)
+ mbstate_t *restrict ps),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
@@ -664,7 +664,7 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
(wchar_t *restrict dest,
const char **restrict srcp, size_t srclen, size_t len,
- mbstate_t *restrict ps)
+ mbstate_t *restrict ps),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
(wchar_t *restrict dest,
@@ -675,7 +675,7 @@ _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
(wchar_t *restrict dest,
const char **restrict srcp, size_t srclen, size_t len,
- mbstate_t *restrict ps)
+ mbstate_t *restrict ps),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
@@ -736,7 +736,7 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
_GL_FUNCDECL_RPL (wcsrtombs, size_t,
(char *restrict dest, const wchar_t **restrict srcp,
size_t len,
- mbstate_t *restrict ps)
+ mbstate_t *restrict ps),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (wcsrtombs, size_t,
(char *restrict dest, const wchar_t **restrict srcp,
@@ -747,7 +747,7 @@ _GL_CXXALIAS_RPL (wcsrtombs, size_t,
_GL_FUNCDECL_SYS (wcsrtombs, size_t,
(char *restrict dest, const wchar_t **restrict srcp,
size_t len,
- mbstate_t *restrict ps)
+ mbstate_t *restrict ps),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (wcsrtombs, size_t,
@@ -778,7 +778,7 @@ _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
(char *restrict dest,
const wchar_t **restrict srcp, size_t srclen,
size_t len,
- mbstate_t *restrict ps)
+ mbstate_t *restrict ps),
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
(char *restrict dest,
@@ -791,7 +791,7 @@ _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
(char *restrict dest,
const wchar_t **restrict srcp, size_t srclen,
size_t len,
- mbstate_t *restrict ps)
+ mbstate_t *restrict ps),
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
@@ -819,12 +819,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
# undef wcwidth
# define wcwidth rpl_wcwidth
# endif
-_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
# else
# if !@HAVE_DECL_WCWIDTH@
/* wcwidth exists but is not declared. */
-_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
# endif
@@ -843,7 +843,7 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
/* Search N wide characters of S for C. */
#if @GNULIB_WMEMCHR@
# if !@HAVE_WMEMCHR@
-_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
+_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n),
_GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -879,14 +879,14 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
# define wmemcmp rpl_wmemcmp
# endif
_GL_FUNCDECL_RPL (wmemcmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n)
+ (const wchar_t *s1, const wchar_t *s2, size_t n),
_GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wmemcmp, int,
(const wchar_t *s1, const wchar_t *s2, size_t n));
# else
# if !@HAVE_WMEMCMP@
_GL_FUNCDECL_SYS (wmemcmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n)
+ (const wchar_t *s1, const wchar_t *s2, size_t n),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wmemcmp, int,
@@ -1004,7 +1004,7 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
/* Return the number of wide characters in S. */
#if @GNULIB_WCSLEN@
# if !@HAVE_WCSLEN@
-_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
+_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s), _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
# if __GLIBC__ >= 2
@@ -1025,7 +1025,7 @@ _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
namespace, not in the global namespace. So, force a declaration in
the global namespace. */
# if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus)
-_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
+_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
@@ -1175,12 +1175,12 @@ _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
# undef wcscmp
# define wcscmp rpl_wcscmp
# endif
-_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
+_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2),
_GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
# else
# if !@HAVE_WCSCMP@
-_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
+_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
@@ -1205,14 +1205,14 @@ _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
# define wcsncmp rpl_wcsncmp
# endif
_GL_FUNCDECL_RPL (wcsncmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n)
+ (const wchar_t *s1, const wchar_t *s2, size_t n),
_GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wcsncmp, int,
(const wchar_t *s1, const wchar_t *s2, size_t n));
# else
# if !@HAVE_WCSNCMP@
_GL_FUNCDECL_SYS (wcsncmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n)
+ (const wchar_t *s1, const wchar_t *s2, size_t n),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcsncmp, int,
@@ -1236,7 +1236,7 @@ _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
namespace, not in the global namespace. So, force a declaration in
the global namespace. */
# if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus)
-_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
+_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
@@ -1257,7 +1257,7 @@ _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
the global namespace. */
# if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus)
_GL_FUNCDECL_SYS (wcsncasecmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n)
+ (const wchar_t *s1, const wchar_t *s2, size_t n),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcsncasecmp, int,
@@ -1328,12 +1328,12 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t
*s));
# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >=
11
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
- (const wchar_t *s)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (const wchar_t *s),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
- (const wchar_t *s)
+ (const wchar_t *s),
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
# endif
@@ -1345,12 +1345,12 @@ _GL_CXXALIASWARN (wcsdup);
/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
- (const wchar_t *s)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (const wchar_t *s),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
- (const wchar_t *s)
+ (const wchar_t *s),
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
# endif
@@ -1373,12 +1373,12 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t
*s));
# else
# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
- (const wchar_t *s)
- _GL_ATTRIBUTE_NOTHROW
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+ (const wchar_t *s),
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
+ _GL_ATTRIBUTE_NOTHROW;
# else
_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
- (const wchar_t *s)
+ (const wchar_t *s),
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
# if @HAVE_DECL_WCSDUP@
@@ -1395,7 +1395,7 @@ _GL_CXXALIASWARN (wcsdup);
/* Find the first occurrence of WC in WCS. */
#if @GNULIB_WCSCHR@
# if !@HAVE_WCSCHR@
-_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
+_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc),
_GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -1425,7 +1425,7 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
/* Find the last occurrence of WC in WCS. */
#if @GNULIB_WCSRCHR@
# if !@HAVE_WCSRCHR@
-_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
+_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc),
_GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -1456,7 +1456,7 @@ _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
of wide characters not in REJECT. */
#if @GNULIB_WCSCSPN@
# if !@HAVE_WCSCSPN@
-_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
+_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t
*reject));
@@ -1476,7 +1476,7 @@ _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
of wide characters in ACCEPT. */
#if @GNULIB_WCSSPN@
# if !@HAVE_WCSSPN@
-_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
+_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
@@ -1496,7 +1496,7 @@ _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
#if @GNULIB_WCSPBRK@
# if !@HAVE_WCSPBRK@
_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
- (const wchar_t *wcs, const wchar_t *accept)
+ (const wchar_t *wcs, const wchar_t *accept),
_GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -1534,7 +1534,7 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
# endif
_GL_FUNCDECL_RPL (wcsstr, wchar_t *,
(const wchar_t *restrict haystack,
- const wchar_t *restrict needle)
+ const wchar_t *restrict needle),
_GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wcsstr, wchar_t *,
(const wchar_t *restrict haystack,
@@ -1543,7 +1543,7 @@ _GL_CXXALIAS_RPL (wcsstr, wchar_t *,
# if !@HAVE_WCSSTR@
_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
(const wchar_t *restrict haystack,
- const wchar_t *restrict needle)
+ const wchar_t *restrict needle),
_GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
@@ -1620,12 +1620,12 @@ _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
# undef wcswidth
# define wcswidth rpl_wcswidth
# endif
-_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
+_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n),
_GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
# else
# if !@HAVE_WCSWIDTH@
-_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
+_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n),
_GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
@@ -1653,7 +1653,7 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
_GL_FUNCDECL_RPL (wcsftime, size_t,
(wchar_t *restrict __buf, size_t __bufsize,
const wchar_t *restrict __fmt,
- const struct tm *restrict __tp)
+ const struct tm *restrict __tp),
_GL_ARG_NONNULL ((1, 3, 4)));
_GL_CXXALIAS_RPL (wcsftime, size_t,
(wchar_t *restrict __buf, size_t __bufsize,
@@ -1664,7 +1664,7 @@ _GL_CXXALIAS_RPL (wcsftime, size_t,
_GL_FUNCDECL_SYS (wcsftime, size_t,
(wchar_t *restrict __buf, size_t __bufsize,
const wchar_t *restrict __fmt,
- const struct tm *restrict __tp)
+ const struct tm *restrict __tp),
_GL_ARG_NONNULL ((1, 3, 4)));
# endif
_GL_CXXALIAS_SYS (wcsftime, size_t,
diff --git a/gnulib/lib/wctype.in.h b/gnulib/lib/wctype.in.h
index 851c4f4eb2..efa77594d5 100644
--- a/gnulib/lib/wctype.in.h
+++ b/gnulib/lib/wctype.in.h
@@ -659,12 +659,12 @@ typedef void *rpl_wctype_t;
# undef wctype
# define wctype rpl_wctype
# endif
-_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name)
+_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name));
# else
# if !@HAVE_WCTYPE_T@
-_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)
+_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
@@ -741,12 +741,12 @@ typedef void *rpl_wctrans_t;
# undef wctrans
# define wctrans rpl_wctrans
# endif
-_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name)
+_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name),
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name));
# else
# if !@HAVE_WCTRANS_T@
-_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)
+_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name),
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
diff --git a/gnulib/lib/windows-mutex.c b/gnulib/lib/windows-mutex.c
index b112e13b6b..2ac73a0728 100644
--- a/gnulib/lib/windows-mutex.c
+++ b/gnulib/lib/windows-mutex.c
@@ -23,10 +23,12 @@
#include "windows-mutex.h"
#include <errno.h>
+#include <stdlib.h>
void
glwthread_mutex_init (glwthread_mutex_t *mutex)
{
+ mutex->owner = 0;
InitializeCriticalSection (&mutex->lock);
mutex->guard.done = 1;
}
@@ -49,7 +51,13 @@ glwthread_mutex_lock (glwthread_mutex_t *mutex)
Sleep (0);
}
}
+ /* If this thread already owns the mutex, POSIX pthread_mutex_lock() is
+ required to deadlock here. But let's not do that on purpose. */
EnterCriticalSection (&mutex->lock);
+ {
+ DWORD self = GetCurrentThreadId ();
+ mutex->owner = self;
+ }
return 0;
}
@@ -72,6 +80,21 @@ glwthread_mutex_trylock (glwthread_mutex_t *mutex)
}
if (!TryEnterCriticalSection (&mutex->lock))
return EBUSY;
+ {
+ DWORD self = GetCurrentThreadId ();
+ /* TryEnterCriticalSection succeeded. This means that the mutex was either
+ previously unlocked (and thus mutex->owner == 0) or previously locked by
+ this thread (and thus mutex->owner == self). Since the mutex is meant
to
+ be plain, we need to fail in the latter case. */
+ if (mutex->owner == self)
+ {
+ LeaveCriticalSection (&mutex->lock);
+ return EBUSY;
+ }
+ if (mutex->owner != 0)
+ abort ();
+ mutex->owner = self;
+ }
return 0;
}
@@ -80,6 +103,7 @@ glwthread_mutex_unlock (glwthread_mutex_t *mutex)
{
if (!mutex->guard.done)
return EINVAL;
+ mutex->owner = 0;
LeaveCriticalSection (&mutex->lock);
return 0;
}
diff --git a/gnulib/lib/windows-mutex.h b/gnulib/lib/windows-mutex.h
index 88de4bdcad..cb676c1b90 100644
--- a/gnulib/lib/windows-mutex.h
+++ b/gnulib/lib/windows-mutex.h
@@ -28,6 +28,7 @@
typedef struct
{
glwthread_initguard_t guard; /* protects the initialization */
+ DWORD owner;
CRITICAL_SECTION lock;
}
glwthread_mutex_t;
diff --git a/gnulib/lib/xsize.h b/gnulib/lib/xsize.h
index 619c0edc2b..5ae86006d9 100644
--- a/gnulib/lib/xsize.h
+++ b/gnulib/lib/xsize.h
@@ -26,7 +26,7 @@
/* Get size_t. */
#include <stddef.h>
-/* Get SIZE_MAX. */
+/* Get INT_MAX, SIZE_MAX. */
#include <limits.h>
#if HAVE_STDINT_H
# include <stdint.h>
@@ -61,7 +61,8 @@ extern "C" {
void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
*/
-/* Convert an arbitrary value >= 0 to type size_t. */
+/* Convert an arbitrary N >= 0 to type size_t.
+ N should not have side effects. */
#define xcast_size_t(N) \
((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
@@ -69,8 +70,15 @@ extern "C" {
XSIZE_INLINE size_t ATTRIBUTE_PURE
xsum (size_t size1, size_t size2)
{
- size_t sum = size1 + size2;
- return (sum >= size1 ? sum : SIZE_MAX);
+ if (INT_MAX < SIZE_MAX)
+ {
+ /* Optimize for the common case where size_t arithmetic wraps
+ around without undefined behavior. */
+ size_t sum = size1 + size2;
+ return size1 <= sum ? sum : SIZE_MAX;
+ }
+
+ return size1 <= SIZE_MAX - size2 ? size1 + size2 : SIZE_MAX;
}
/* Sum of three sizes, with overflow check. */
@@ -98,6 +106,8 @@ xmax (size_t size1, size_t size2)
/* Multiplication of a count with an element size, with overflow check.
The count must be >= 0 and the element size must be > 0.
+ Arguments should not have side effects.
+ The element size's type should be no wider than size_t.
This is a macro, not a function, so that it works correctly even
when N is of a wider type and N > SIZE_MAX. */
#define xtimes(N, ELSIZE) \
diff --git a/gnulib/m4/c32rtomb.m4 b/gnulib/m4/c32rtomb.m4
new file mode 100644
index 0000000000..cf7ff69dae
--- /dev/null
+++ b/gnulib/m4/c32rtomb.m4
@@ -0,0 +1,186 @@
+# c32rtomb.m4
+# serial 8
+dnl Copyright (C) 2020-2024 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_C32RTOMB],
+[
+ AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
+ AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
+
+ AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB])
+ if test $gl_cv_func_c32rtomb = no; then
+ HAVE_C32RTOMB=0
+ else
+ dnl When we override mbrtoc32, redefining the meaning of the char32_t
+ dnl values, we need to override c32rtomb as well, for consistency.
+ if test $HAVE_WORKING_MBRTOC32 = 0; then
+ REPLACE_C32RTOMB=1
+ fi
+ AC_CACHE_CHECK([whether c32rtomb return value is correct],
+ [gl_cv_func_c32rtomb_retval],
+ [
+ dnl Initial guess, used when cross-compiling.
+changequote(,)dnl
+ case "$host_os" in
+ # Guess no on AIX.
+ aix*) gl_cv_func_c32rtomb_retval="guessing no" ;;
+ # Guess yes otherwise.
+ *) gl_cv_func_c32rtomb_retval="guessing yes" ;;
+ esac
+changequote([,])dnl
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <stddef.h>
+#ifdef __HAIKU__
+ #include <stdint.h>
+#endif
+#include <uchar.h>
+int main ()
+{
+ int result = 0;
+ if (c32rtomb (NULL, 0, NULL) != 1)
+ result |= 1;
+ return result;
+}]])],
+ [gl_cv_func_c32rtomb_retval=yes],
+ [gl_cv_func_c32rtomb_retval=no],
+ [:])
+ ])
+ case "$gl_cv_func_c32rtomb_retval" in
+ *yes) ;;
+ *) AC_DEFINE([C32RTOMB_RETVAL_BUG], [1],
+ [Define if the c32rtomb function has an incorrect return value.])
+ REPLACE_C32RTOMB=1 ;;
+ esac
+ if test $HAVE_WORKING_C32RTOMB = 0; then
+ REPLACE_C32RTOMB=1
+ fi
+ fi
+])
+
+AC_DEFUN([gl_CHECK_FUNC_C32RTOMB],
+[
+ dnl Cf. gl_CHECK_FUNCS_ANDROID
+ AC_CHECK_DECL([c32rtomb], , ,
+ [[#ifdef __HAIKU__
+ #include <stdint.h>
+ #endif
+ #include <uchar.h>
+ ]])
+ if test $ac_cv_have_decl_c32rtomb = yes; then
+ dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a
+ dnl static inline function on Haiku 2020.
+ AC_CACHE_CHECK([for c32rtomb], [gl_cv_func_c32rtomb],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdlib.h>
+ #ifdef __HAIKU__
+ #include <stdint.h>
+ #endif
+ #include <uchar.h>
+ ]],
+ [[char buf[8];
+ return c32rtomb (buf, 0, NULL) == 0;
+ ]])
+ ],
+ [gl_cv_func_c32rtomb=yes],
+ [gl_cv_func_c32rtomb=no])
+ ])
+ else
+ gl_cv_func_c32rtomb=no
+ fi
+])
+
+dnl Test whether c32rtomb works not worse than wcrtomb.
+dnl Result is HAVE_WORKING_C32RTOMB.
+
+AC_DEFUN([gl_C32RTOMB_SANITYCHECK],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([gl_TYPE_CHAR32_T])
+ AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB])
+ AC_REQUIRE([gt_LOCALE_ZH_CN])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_c32rtomb =
no; then
+ HAVE_WORKING_C32RTOMB=0
+ else
+ AC_CACHE_CHECK([whether c32rtomb works as well as wcrtomb],
+ [gl_cv_func_c32rtomb_sanitycheck],
+ [
+ dnl Initial guess, used when cross-compiling or when no suitable locale
+ dnl is present.
+changequote(,)dnl
+ case "$host_os" in
+ # Guess no on Solaris derivatives.
+ solaris*)
+ if test -f /etc/release && grep 'Oracle Solaris' /etc/release
>/dev/null; then
+ gl_cv_func_c32rtomb_sanitycheck="guessing yes"
+ else
+ gl_cv_func_c32rtomb_sanitycheck="guessing no"
+ fi
+ ;;
+ # Guess yes otherwise.
+ *)
+ gl_cv_func_c32rtomb_sanitycheck="guessing yes"
+ ;;
+ esac
+changequote([,])dnl
+ if test $LOCALE_ZH_CN != none; then
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#ifdef __HAIKU__
+ #include <stdint.h>
+#endif
+#include <uchar.h>
+int main ()
+{
+ int result = 0;
+ /* This fails on Solaris 11 OmniOS:
+ c32rtomb returns (size_t)-1.
+ wcrtomb returns 4 (correct). */
+ if (strcmp ("$LOCALE_ZH_CN", "none") != 0
+ && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
+ {
+ mbstate_t state;
+ wchar_t wc = (wchar_t) 0xBADFACE;
+ char buf[16];
+ memset (&state, '\0', sizeof (mbstate_t));
+ if (mbrtowc (&wc, "\201\060\211\070", 4, &state) == 4
+ && wcrtomb (buf, wc, NULL) == 4
+ && memcmp (buf, "\201\060\211\070", 4) == 0)
+ {
+ char32_t c32 = (wchar_t) 0xBADFACE;
+ memset (&state, '\0', sizeof (mbstate_t));
+ if (mbrtoc32 (&c32, "\201\060\211\070", 4, &state) == 4
+ && c32rtomb (buf, c32, NULL) != 4)
+ result |= 1;
+ }
+ }
+ return result;
+}]])],
+ [gl_cv_func_c32rtomb_sanitycheck=yes],
+ [gl_cv_func_c32rtomb_sanitycheck=no],
+ [:])
+ fi
+ ])
+ case "$gl_cv_func_c32rtomb_sanitycheck" in
+ *yes)
+ HAVE_WORKING_C32RTOMB=1
+ AC_DEFINE([HAVE_WORKING_C32RTOMB], [1],
+ [Define if the c32rtomb function basically works.])
+ ;;
+ *) HAVE_WORKING_C32RTOMB=0 ;;
+ esac
+ fi
+ AC_SUBST([HAVE_WORKING_C32RTOMB])
+])
diff --git a/gnulib/m4/calloc.m4 b/gnulib/m4/calloc.m4
index 550cf5cc90..c69ce414a0 100644
--- a/gnulib/m4/calloc.m4
+++ b/gnulib/m4/calloc.m4
@@ -1,5 +1,5 @@
# calloc.m4
-# serial 31
+# serial 34
dnl Copyright (C) 2004-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -58,6 +58,11 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_CALLOC_POSIX])
+
+ dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
+ dnl gets defined already before this macro gets invoked. This helps
+ dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise.
+
REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX"
if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then
_AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1])
diff --git a/gnulib/m4/errno_h.m4 b/gnulib/m4/errno_h.m4
index b6050e5d8e..18bfd7b1c1 100644
--- a/gnulib/m4/errno_h.m4
+++ b/gnulib/m4/errno_h.m4
@@ -1,5 +1,5 @@
# errno_h.m4
-# serial 14
+# serial 17
dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,11 @@ AC_PREREQ([2.61])
AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
[
AC_REQUIRE([AC_PROG_CC])
+
+ dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
+ dnl gets defined already before this macro gets invoked. This persuades
+ dnl AIX 7.3 errno.h to assign ENOTEMPTY a value different than EEXIST.
+
AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
AC_EGREP_CPP([booboo],[
#include <errno.h>
diff --git a/gnulib/m4/extensions-aix.m4 b/gnulib/m4/extensions-aix.m4
new file mode 100644
index 0000000000..990a7ac3ef
--- /dev/null
+++ b/gnulib/m4/extensions-aix.m4
@@ -0,0 +1,25 @@
+# extensions-aix.m4
+# serial 1
+dnl Copyright (C) 2024 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# On AIX, most extensions are already enabled through the _ALL_SOURCE macro,
+# defined by gl_USE_SYSTEM_EXTENSIONS. gl_USE_AIX_EXTENSIONS additionally
+# activates more GNU and Linux-like behaviours, affecting
+# - the time_t type,
+# - errno values in <errno.h>: ENOTEMPTY
+# - functions in <stdlib.h>: malloc calloc realloc valloc
+#
<https://www.ibm.com/docs/en/aix/7.3?topic=m-malloc-free-realloc-calloc-mallopt-mallinfo-mallinfo-heap-alloca-valloc-posix-memalign-subroutine>
+# - functions in <string.h>: strerror_r (returns 'char *', like glibc)
+# - functions in <dirent.h>: scandir, alphasort, readdir_r
+# - functions in <netdb.h>: gethostbyname_r gethostbyaddr_r
+# - declarations in <unistd.h>: sbrk
+# and a couple of secondary <sys/*> header files.
+
+AC_DEFUN_ONCE([gl_USE_AIX_EXTENSIONS],
+[
+ AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
+ [Define so that AIX headers are more compatible with GNU/Linux.])
+])
diff --git a/gnulib/m4/float_h.m4 b/gnulib/m4/float_h.m4
index c95d417161..12c0eb6749 100644
--- a/gnulib/m4/float_h.m4
+++ b/gnulib/m4/float_h.m4
@@ -1,5 +1,5 @@
# float_h.m4
-# serial 14
+# serial 15
dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -54,6 +54,31 @@ changequote([,])dnl
;;
esac
+ dnl Test for completeness w.r.t. ISO C 23.
+ REPLACE_FLOAT_SNAN=0
+ AC_CACHE_CHECK([whether float.h conforms to ISO C23],
+ [gl_cv_header_float_h_isoc23],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <float.h>
+ int x[] = { FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG };
+ float maxf = FLT_NORM_MAX;
+ double maxd = DBL_NORM_MAX;
+ long double maxl = LDBL_NORM_MAX;
+ ]],
+ [[float sf = FLT_SNAN;
+ double sd = DBL_SNAN;
+ long double sl = LDBL_SNAN;
+ return (sf != 0) + (sd != 0) + (sl != 0);
+ ]])],
+ [gl_cv_header_float_h_isoc23=yes],
+ [gl_cv_header_float_h_isoc23=no])
+ ])
+ if test $gl_cv_header_float_h_isoc23 != yes; then
+ GL_GENERATE_FLOAT_H=true
+ REPLACE_FLOAT_SNAN=1
+ fi
+
dnl Test against glibc-2.7 Linux/SPARC64 bug.
REPLACE_ITOLD=0
AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works],
diff --git a/gnulib/m4/gnulib-common.m4 b/gnulib/m4/gnulib-common.m4
index b34b4534bf..b1b3758db8 100644
--- a/gnulib/m4/gnulib-common.m4
+++ b/gnulib/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
# gnulib-common.m4
-# serial 95
+# serial 101
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -133,6 +133,23 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_HAVE___HAS_C_ATTRIBUTE 0
#endif
+/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
+ syntax, in function declarations. There are two problems here.
+ (Last tested with gcc/g++ 14 and clang/clang++ 18.)
+
+ 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration
+ in any order.
+ =========================== foo.c = foo.cc ===========================
+ __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int);
+ [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int);
+ ======================================================================
+ This gives a syntax error
+ - in C mode with gcc
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796>, and
+ - in C++ mode with clang++ version < 16, and
+ - in C++ mode, inside extern "C" {}, still in newer clang++ versions
+ <https://github.com/llvm/llvm-project/issues/101990>.
+ */
/* Define if, in a function declaration, the attributes in bracket syntax
[[...]] must come before the attributes in __attribute__((...)) syntax.
If this is defined, it is best to avoid the bracket syntax, so that the
@@ -147,6 +164,176 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_BRACKET_BEFORE_ATTRIBUTE 1
# endif
#endif
+/*
+ 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration
+ - without 'extern', in C as well as in C++,
+ - with 'extern', in C,
+ - with 'extern "C"', in C++
+ in the same position. That is, we don't want to be forced to use a
+ macro which arranges for the attribute to come before 'extern' in
+ one case and after 'extern' in the other case, because such a macro
+ would make the source code of .h files pretty ugly.
+ =========================== foo.c = foo.cc ===========================
+ #ifdef __cplusplus
+ # define CC "C"
+ #else
+ # define CC
+ #endif
+
+ #define ND [[__nodiscard__]]
+ #define WUR __attribute__((__warn_unused_result__))
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ // gcc clang g++ clang++
+
+ ND int foo (int);
+ int ND foo (int); // warn error warn error
+ int foo ND (int);
+ int foo (int) ND; // warn error warn error
+
+ WUR int foo (int);
+ int WUR foo (int);
+ int fo1 WUR (int); // error error error error
+ int foo (int) WUR;
+
+ #ifdef __cplusplus
+ }
+ #endif
+
+ // gcc clang g++ clang++
+
+ ND extern CC int foo (int); // error error
+ extern CC ND int foo (int); // error error
+ extern CC int ND foo (int); // warn error warn error
+ extern CC int foo ND (int);
+ extern CC int foo (int) ND; // warn error warn error
+
+ WUR extern CC int foo (int); // warn
+ extern CC WUR int foo (int);
+ extern CC int WUR foo (int);
+ extern CC int foo WUR (int); // error error error error
+ extern CC int foo (int) WUR;
+
+ ND EXTERN_C_FUNC int foo (int); // error error
+ EXTERN_C_FUNC ND int foo (int);
+ EXTERN_C_FUNC int ND foo (int); // warn error warn error
+ EXTERN_C_FUNC int foo ND (int);
+ EXTERN_C_FUNC int foo (int) ND; // warn error warn error
+
+ WUR EXTERN_C_FUNC int foo (int); // warn
+ EXTERN_C_FUNC WUR int foo (int);
+ EXTERN_C_FUNC int WUR foo (int);
+ EXTERN_C_FUNC int fo2 WUR (int); // error error error error
+ EXTERN_C_FUNC int foo (int) WUR;
+ ======================================================================
+ So, if we insist on using the 'extern' keyword ('extern CC' idiom):
+ * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
+ in both C and C++, there is one available position:
+ - between the function name and the parameter list.
+ * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
+ in both C and C++, there are several available positions:
+ - before the return type,
+ - between return type and function name,
+ - at the end of the declaration.
+ * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
+ __attribute__((...)) syntax in C++, there is no available position:
+ it would need to come before 'extern' in C but after 'extern "C"'
+ in C++.
+ * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
+ to bracket syntax [[...]] in C++, there is one available position:
+ - before the return type.
+ Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally
+ omits the 'extern' keyword:
+ * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
+ in both C and C++, there are two available positions:
+ - before the return type,
+ - between the function name and the parameter list.
+ * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
+ in both C and C++, there are several available positions:
+ - before the return type,
+ - between return type and function name,
+ - at the end of the declaration.
+ * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
+ __attribute__((...)) syntax in C++, there is one available position:
+ - before the return type.
+ * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
+ to bracket syntax [[...]] in C++, there is one available position:
+ - before the return type.
+ The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and
+ put the attributes before the return type. This works regardless
+ to what the _GL_ATTRIBUTE_* macros expand.
+ */
+
+/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
+ syntax, in static/inline function definitions.
+
+ There are similar constraints as for function declarations. However, here,
+ we cannot omit the storage-class specifier. Therefore, the following rule
+ applies:
+ * The macros
+ _GL_ATTRIBUTE_CONST
+ _GL_ATTRIBUTE_DEPRECATED
+ _GL_ATTRIBUTE_MAYBE_UNUSED
+ _GL_ATTRIBUTE_NODISCARD
+ _GL_ATTRIBUTE_PURE
+ _GL_ATTRIBUTE_REPRODUCIBLE
+ _GL_ATTRIBUTE_UNSEQUENCED
+ which may expand to bracket syntax [[...]], must come first, before the
+ storage-class specifier.
+ * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...))
syntax,
+ are better placed between the storage-class specifier and the return
+ type.
+ */
+
+/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
+ syntax, in variable declarations.
+
+ At which position can they be placed?
+ (Last tested with gcc/g++ 14 and clang/clang++ 18.)
+
+ =========================== foo.c = foo.cc ===========================
+ #ifdef __cplusplus
+ # define CC "C"
+ #else
+ # define CC
+ #endif
+
+ #define BD [[__deprecated__]]
+ #define AD __attribute__ ((__deprecated__))
+
+ // gcc clang g++ clang++
+
+ BD extern CC int var; // error error
+ extern CC BD int var; // error error
+ extern CC int BD var; // warn error warn error
+ extern CC int var BD;
+
+ AD extern CC int var; // warn
+ extern CC AD int var;
+ extern CC int AD var;
+ extern CC int var AD;
+
+ BD extern CC int z[]; // error error
+ extern CC BD int z[]; // error error
+ extern CC int BD z[]; // warn error warn error
+ extern CC int z1 BD [];
+ extern CC int z[] BD; // warn error error
+
+ AD extern CC int z[]; // warn
+ extern CC AD int z[];
+ extern CC int AD z[];
+ extern CC int z2 AD []; // error error error error
+ extern CC int z[] AD;
+ ======================================================================
+
+ * For non-array variables, the only good position is after the variable
name,
+ that is, at the end of the declaration.
+ * For array variables, you will need to distinguish C and C++:
+ - In C, before the 'extern' keyword.
+ - In C++, between the 'extern "C"' and the variable's type.
+ */
]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead.
[
/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the
function
@@ -488,7 +675,7 @@ AC_DEFUN([gl_COMMON_BODY], [
other attributes. */
#ifndef _GL_ATTRIBUTE_NOTHROW
# if defined __cplusplus
-# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4
+# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
# if __cplusplus >= 201103L
# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
# else
diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4
index 653d791aa1..63e07661eb 100644
--- a/gnulib/m4/gnulib-comp.m4
+++ b/gnulib/m4/gnulib-comp.m4
@@ -79,6 +79,10 @@ AC_DEFUN([gl_EARLY],
# Code from module error-h:
# Code from module exitfail:
# Code from module extensions:
+ # This is actually already done in the pre-early phase.
+ # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ # Code from module extensions-aix:
+ AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
# Code from module extern-inline:
# Code from module fcntl:
# Code from module fcntl-h:
@@ -147,6 +151,7 @@ AC_DEFUN([gl_EARLY],
# Code from module multiarch:
# Code from module nl_langinfo:
# Code from module nocrash:
+ # Code from module once:
# Code from module open:
# Code from module pathmax:
# Code from module pthread-h:
@@ -277,84 +282,98 @@ AC_DEFUN([gl_INIT],
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isalnum])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isalpha])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isblank])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32iscntrl])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isdigit])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isgraph])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32islower])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isprint])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32ispunct])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isspace])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isupper])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32isxdigit])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32tolower])
AC_REQUIRE([gl_UCHAR_H])
dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
dnl determined. It describes how mbrtoc32 is implemented.
AC_REQUIRE([gl_MBSTATE_T_BROKEN])
AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
gl_UCHAR_MODULE_INDICATOR([c32width])
gl_FUNC_CALLOC_GNU
if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then
@@ -740,6 +759,7 @@ AC_DEFUN([gl_INIT],
gl_gnulib_enabled_f691f076f650964c9f5598c3ee487616=false
gl_gnulib_enabled_676220fa4366efa9bdbfccf11a857c07=false
gl_gnulib_enabled_nl_langinfo=false
+ gl_gnulib_enabled_once=false
gl_gnulib_enabled_open=false
gl_gnulib_enabled_pathmax=false
gl_gnulib_enabled_94ea50e7ff7c2508f8a5894b17b1211c=false
@@ -831,6 +851,7 @@ AC_DEFUN([gl_INIT],
gl_FUNC_CLOSE
gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1])
gl_UNISTD_MODULE_INDICATOR([close])
+ gl_MODULE_INDICATOR([close])
gl_gnulib_enabled_close=true
if test $REPLACE_CLOSE = 1; then
func_gl_gnulib_m4code_43fe87a341d9b4b93c47c3ad819a5239
@@ -933,8 +954,11 @@ AC_DEFUN([gl_INIT],
gl_FLOAT_H
gl_CONDITIONAL_HEADER([float.h])
AC_PROG_MKDIR_P
- gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1])
+ gl_CONDITIONAL([GL_COND_OBJ_FLOAT],
+ [test $REPLACE_FLOAT_LDBL = 1 || test $REPLACE_FLOAT_SNAN
= 1])
gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1])
+ dnl Prerequisites of lib/float.c.
+ AC_REQUIRE([gl_BIGENDIAN])
gl_gnulib_enabled_float=true
fi
}
@@ -964,6 +988,7 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_FSTAT
])
gl_SYS_STAT_MODULE_INDICATOR([fstat])
+ gl_MODULE_INDICATOR([fstat])
gl_gnulib_enabled_fstat=true
if test $REPLACE_FSTAT = 1; then
func_gl_gnulib_m4code_676220fa4366efa9bdbfccf11a857c07
@@ -1096,6 +1121,7 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_LOCALECONV
])
gl_LOCALE_MODULE_INDICATOR([localeconv])
+ gl_MODULE_INDICATOR([localeconv])
gl_gnulib_enabled_localeconv=true
func_gl_gnulib_m4code_locale
fi
@@ -1106,16 +1132,11 @@ AC_DEFUN([gl_INIT],
gl_LOCK
gl_MODULE_INDICATOR([lock])
gl_gnulib_enabled_lock=true
- if test $gl_threads_api = posix; then
- func_gl_gnulib_m4code_e0dc424e76447be3f4b8566d84038f5a
- fi
+ func_gl_gnulib_m4code_once
func_gl_gnulib_m4code_threadlib
if test $gl_threads_api = windows; then
func_gl_gnulib_m4code_503a4cb75d69c787103d0aa2ab7d8440
fi
- if test $gl_threads_api = windows; then
- func_gl_gnulib_m4code_68a4501daeca58988392c7e60b4917ab
- fi
if test $gl_threads_api = windows; then
func_gl_gnulib_m4code_f0efff84a70f4afba30902bb8ffe9354
fi
@@ -1133,6 +1154,7 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_LSTAT
])
gl_SYS_STAT_MODULE_INDICATOR([lstat])
+ gl_MODULE_INDICATOR([lstat])
gl_gnulib_enabled_lstat=true
if test $REPLACE_LSTAT = 1; then
func_gl_gnulib_m4code_stat
@@ -1257,6 +1279,20 @@ AC_DEFUN([gl_INIT],
fi
fi
}
+ func_gl_gnulib_m4code_once ()
+ {
+ if $gl_gnulib_enabled_once; then :; else
+ gl_ONCE
+ gl_gnulib_enabled_once=true
+ if test $gl_threads_api = posix; then
+ func_gl_gnulib_m4code_e0dc424e76447be3f4b8566d84038f5a
+ fi
+ func_gl_gnulib_m4code_threadlib
+ if test $gl_threads_api = windows; then
+ func_gl_gnulib_m4code_68a4501daeca58988392c7e60b4917ab
+ fi
+ fi
+ }
func_gl_gnulib_m4code_open ()
{
if $gl_gnulib_enabled_open; then :; else
@@ -1363,6 +1399,7 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_STAT
])
gl_SYS_STAT_MODULE_INDICATOR([stat])
+ gl_MODULE_INDICATOR([stat])
gl_gnulib_enabled_stat=true
if test $REPLACE_STAT = 1; then
func_gl_gnulib_m4code_filename
@@ -1771,6 +1808,7 @@ AC_DEFUN([gl_INIT],
AM_CONDITIONAL([gl_GNULIB_ENABLED_f691f076f650964c9f5598c3ee487616],
[$gl_gnulib_enabled_f691f076f650964c9f5598c3ee487616])
AM_CONDITIONAL([gl_GNULIB_ENABLED_676220fa4366efa9bdbfccf11a857c07],
[$gl_gnulib_enabled_676220fa4366efa9bdbfccf11a857c07])
AM_CONDITIONAL([gl_GNULIB_ENABLED_nl_langinfo],
[$gl_gnulib_enabled_nl_langinfo])
+ AM_CONDITIONAL([gl_GNULIB_ENABLED_once], [$gl_gnulib_enabled_once])
AM_CONDITIONAL([gl_GNULIB_ENABLED_open], [$gl_gnulib_enabled_open])
AM_CONDITIONAL([gl_GNULIB_ENABLED_pathmax], [$gl_gnulib_enabled_pathmax])
AM_CONDITIONAL([gl_GNULIB_ENABLED_94ea50e7ff7c2508f8a5894b17b1211c],
[$gl_gnulib_enabled_94ea50e7ff7c2508f8a5894b17b1211c])
@@ -2043,6 +2081,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/gettext.h
lib/glthread/lock.c
lib/glthread/lock.h
+ lib/glthread/once.c
+ lib/glthread/once.h
lib/glthread/threadlib.c
lib/hard-locale.c
lib/hard-locale.h
@@ -2253,6 +2293,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/btowc.m4
m4/builtin-expect.m4
m4/c-bool.m4
+ m4/c32rtomb.m4
m4/calloc.m4
m4/clock_time.m4
m4/close.m4
@@ -2264,6 +2305,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/error.m4
m4/error_h.m4
m4/exponentd.m4
+ m4/extensions-aix.m4
m4/extensions.m4
m4/extern-inline.m4
m4/fcntl-o.m4
@@ -2331,6 +2373,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/nocrash.m4
m4/off64_t.m4
m4/off_t.m4
+ m4/once.m4
m4/open-cloexec.m4
m4/open-slash.m4
m4/open.m4
@@ -2387,7 +2430,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/visibility.m4
m4/warn-on-use.m4
m4/wchar_h.m4
- m4/wchar_t.m4
m4/wcrtomb.m4
m4/wctype.m4
m4/wctype_h.m4
diff --git a/gnulib/m4/largefile.m4 b/gnulib/m4/largefile.m4
index 2f824089b0..2881348359 100644
--- a/gnulib/m4/largefile.m4
+++ b/gnulib/m4/largefile.m4
@@ -1,5 +1,5 @@
# largefile.m4
-# serial 1
+# serial 2
dnl Copyright 1992-1996, 1998-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -88,7 +88,7 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize(
# If you change this macro you may also need to change
# _AC_SYS_YEAR2038_OPTIONS.
AC_DEFUN([_AC_SYS_YEAR2038_PROBE],
-[AC_CACHE_CHECK([for $CPPFLAGS option for timestamps after 2038],
+[AC_CACHE_CHECK([for $CC option to support timestamps after 2038],
[ac_cv_sys_year2038_opts],
[ac_save_CPPFLAGS="$CPPFLAGS"
ac_opt_found=no
@@ -234,7 +234,7 @@ m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize(
# If you change this macro you may also need to change
# _AC_SYS_LARGEFILE_OPTIONS.
AC_DEFUN([_AC_SYS_LARGEFILE_PROBE],
-[AC_CACHE_CHECK([for $CPPFLAGS option for large files],
+[AC_CACHE_CHECK([for $CC option to support large files],
[ac_cv_sys_largefile_opts],
[ac_save_CPPFLAGS=$CPPFLAGS
ac_opt_found=no
diff --git a/gnulib/m4/malloc.m4 b/gnulib/m4/malloc.m4
index 41a46937ea..ee6df5c3fb 100644
--- a/gnulib/m4/malloc.m4
+++ b/gnulib/m4/malloc.m4
@@ -1,5 +1,5 @@
# malloc.m4
-# serial 31
+# serial 34
dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -45,6 +45,11 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
+
+ dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
+ dnl gets defined already before this macro gets invoked. This helps
+ dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise.
+
REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX"
if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then
_AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1])
diff --git a/gnulib/m4/math_h.m4 b/gnulib/m4/math_h.m4
index 4b26c9e9dc..7e69629c3d 100644
--- a/gnulib/m4/math_h.m4
+++ b/gnulib/m4/math_h.m4
@@ -1,5 +1,5 @@
# math_h.m4
-# serial 138
+# serial 140
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -49,7 +49,7 @@ AC_DEFUN_ONCE([gl_MATH_H],
ilogb ilogbf ilogbl
ldexpf ldexpl
log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
- logb logbf logbl
+ logb logbf logbl logp1 log1pf logp1l
modf modff modfl powf
remainder remainderf remainderl
rint rintf rintl round roundf roundl
@@ -153,6 +153,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
@@ -253,6 +256,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL])
HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF])
HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL])
+ HAVE_LOGP1=1; AC_SUBST([HAVE_LOGP1])
+ HAVE_LOGP1F=1; AC_SUBST([HAVE_LOGP1F])
+ HAVE_LOGP1L=1; AC_SUBST([HAVE_LOGP1L])
HAVE_MODFF=1; AC_SUBST([HAVE_MODFF])
HAVE_MODFL=1; AC_SUBST([HAVE_MODFL])
HAVE_POWF=1; AC_SUBST([HAVE_POWF])
diff --git a/gnulib/m4/mbrtoc32.m4 b/gnulib/m4/mbrtoc32.m4
index 1f1d91cd72..8118ff8f29 100644
--- a/gnulib/m4/mbrtoc32.m4
+++ b/gnulib/m4/mbrtoc32.m4
@@ -1,5 +1,5 @@
# mbrtoc32.m4
-# serial 19
+# serial 20
dnl Copyright (C) 2014-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -230,7 +230,7 @@ AC_DEFUN([gl_MBRTOC32_SANITYCHECK],
AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
AC_REQUIRE([gt_LOCALE_FR])
AC_REQUIRE([gt_LOCALE_ZH_CN])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_REQUIRE([AC_CANONICAL_HOST])
if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_mbrtoc32 =
no; then
HAVE_WORKING_MBRTOC32=0
else
@@ -320,5 +320,6 @@ int main ()
# Prerequisites of lib/mbrtoc32.c and lib/lc-charset-dispatch.c.
AC_DEFUN([gl_PREREQ_MBRTOC32], [
+ AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
:
])
diff --git a/gnulib/m4/mbrtowc.m4 b/gnulib/m4/mbrtowc.m4
index 62c4fdb348..4ea8184049 100644
--- a/gnulib/m4/mbrtowc.m4
+++ b/gnulib/m4/mbrtowc.m4
@@ -1,5 +1,5 @@
# mbrtowc.m4
-# serial 44 -*- coding: utf-8 -*-
+# serial 44
dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
diff --git a/gnulib/m4/memchr.m4 b/gnulib/m4/memchr.m4
index 346a288210..31ff2dacff 100644
--- a/gnulib/m4/memchr.m4
+++ b/gnulib/m4/memchr.m4
@@ -1,5 +1,5 @@
# memchr.m4
-# serial 19
+# serial 20
dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -49,7 +49,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
if (fd >= 0)
# endif
{
- int pagesize = getpagesize ();
+ long int pagesize = sysconf (_SC_PAGESIZE);
char *two_pages =
(char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
flags, fd, 0);
diff --git a/gnulib/m4/once.m4 b/gnulib/m4/once.m4
new file mode 100644
index 0000000000..6b0d32394d
--- /dev/null
+++ b/gnulib/m4/once.m4
@@ -0,0 +1,13 @@
+# once.m4
+# serial 1
+dnl Copyright (C) 2024 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gl_ONCE],
+[
+ AC_REQUIRE([gl_THREADLIB])
+])
diff --git a/gnulib/m4/printf.m4 b/gnulib/m4/printf.m4
index 220f37cb5e..a6daa1a62c 100644
--- a/gnulib/m4/printf.m4
+++ b/gnulib/m4/printf.m4
@@ -1,5 +1,5 @@
# printf.m4
-# serial 92
+# serial 95
dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -616,6 +616,7 @@ static double zero = 0.0;
int main ()
{
int result = 0;
+ /* This fails on FreeBSD 5.2.1, Solaris 11.4. */
if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
|| (strcmp (buf, "0x1.922p+1 33") != 0
&& strcmp (buf, "0x3.244p+0 33") != 0
@@ -627,27 +628,29 @@ int main ()
&& strcmp (buf, "-0X3.244P+0 33") != 0
&& strcmp (buf, "-0X6.488P-1 33") != 0
&& strcmp (buf, "-0XC.91P-2 33") != 0))
- result |= 2;
- /* This catches a FreeBSD 13.0 bug: it doesn't round. */
+ result |= 1;
+ /* This catches a Mac OS X 10.5, FreeBSD 6.4, NetBSD 10.0 bug:
+ it doesn't round. */
if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
|| (strcmp (buf, "0x1.83p+0 33") != 0
&& strcmp (buf, "0x3.05p-1 33") != 0
&& strcmp (buf, "0x6.0ap-2 33") != 0
&& strcmp (buf, "0xc.14p-3 33") != 0))
- result |= 4;
- /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */
+ result |= 2;
+ /* This catches a macOS 14 (Darwin 23), FreeBSD 14.0, OpenBSD 7.5, AIX 7.3,
+ Solaris 11.4 bug: it doesn't round. */
if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
|| (strcmp (buf, "0x2p+0 33") != 0
&& strcmp (buf, "0x3p-1 33") != 0
&& strcmp (buf, "0x6p-2 33") != 0
&& strcmp (buf, "0xcp-3 33") != 0))
result |= 4;
- /* This catches a FreeBSD 6.1 bug. See
+ /* This catches a Mac OS X 10.5, FreeBSD 6.4 bug. See
<https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
|| buf[0] == '0')
result |= 8;
- /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */
+ /* This catches a Mac OS X 10.3.9 (Darwin 7.9), FreeBSD 6.4 bug. */
if (sprintf (buf, "%.1a", 1.999) < 0
|| (strcmp (buf, "0x1.0p+1") != 0
&& strcmp (buf, "0x2.0p+0") != 0
@@ -655,7 +658,8 @@ int main ()
&& strcmp (buf, "0x8.0p-2") != 0))
result |= 16;
/* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
- glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */
+ glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>
+ and a FreeBSD 6.4, NetBSD 10.0 bug. */
if (sprintf (buf, "%.1La", 1.999L) < 0
|| (strcmp (buf, "0x1.0p+1") != 0
&& strcmp (buf, "0x2.0p+0") != 0
@@ -893,8 +897,12 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
[AC_LANG_SOURCE([[
#include <signal.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
+#if defined _WIN32 && !defined __CYGWIN__
+# include <stdlib.h>
+#else
+# include <unistd.h>
+#endif
#ifdef _MSC_VER
#include <crtdbg.h>
#include <inttypes.h>
@@ -1713,6 +1721,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
#include <signal.h>
#include <stdio.h>
#include <string.h>
+#if defined _WIN32 && !defined __CYGWIN__
+# include <stdlib.h>
+#else
+# include <unistd.h>
+#endif
#if HAVE_SNPRINTF
# define my_snprintf snprintf
#else
diff --git a/gnulib/m4/realloc.m4 b/gnulib/m4/realloc.m4
index eb90d5885c..cc91102836 100644
--- a/gnulib/m4/realloc.m4
+++ b/gnulib/m4/realloc.m4
@@ -1,5 +1,5 @@
# realloc.m4
-# serial 29
+# serial 32
dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -45,6 +45,11 @@ AC_DEFUN([gl_FUNC_REALLOC_GNU],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
+
+ dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
+ dnl gets defined already before this macro gets invoked. This helps
+ dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise.
+
if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then
_AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1])
fi
diff --git a/gnulib/m4/std-gnu11.m4 b/gnulib/m4/std-gnu11.m4
index 37324c158e..e8d5de7a1e 100644
--- a/gnulib/m4/std-gnu11.m4
+++ b/gnulib/m4/std-gnu11.m4
@@ -1,8 +1,11 @@
# std-gnu11.m4
-# serial 1
+# serial 2
# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*-
+# The std-gnu23 module, which defines _AC_C_C23_OPTIONS, supersedes us.
+m4_ifndef([_AC_C_C23_OPTIONS], [
+
# This implementation is taken from GNU Autoconf lib/autoconf/c.m4
# commit 017d5ddd82854911f0119691d91ea8a1438824d6
# dated Sun Apr 3 13:57:17 2016 -0700
@@ -38,7 +41,7 @@ m4_version_prereq([2.70], [], [
# COMPILER ... is a space separated list of C compilers to search for.
# This just gives the user an opportunity to specify an alternative
# search list for the C compiler.
-AC_DEFUN_ONCE([AC_PROG_CC],
+AC_DEFUN([AC_PROG_CC],
[AC_LANG_PUSH(C)dnl
AC_ARG_VAR([CC], [C compiler command])dnl
AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
@@ -830,3 +833,4 @@ dnl with extended modes being tried first.
])# m4_version_prereq
+])# !_AC_C_C23_OPTIONS
diff --git a/gnulib/m4/stddef_h.m4 b/gnulib/m4/stddef_h.m4
index 998fe12fa8..c7f75b37fa 100644
--- a/gnulib/m4/stddef_h.m4
+++ b/gnulib/m4/stddef_h.m4
@@ -1,5 +1,5 @@
# stddef_h.m4
-# serial 16
+# serial 17
dnl Copyright (C) 2009-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -10,7 +10,6 @@ dnl A placeholder for <stddef.h>, for platforms that have
issues.
AC_DEFUN_ONCE([gl_STDDEF_H],
[
AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
dnl Persuade OpenBSD <stddef.h> to declare max_align_t.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -52,11 +51,6 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
GL_GENERATE_STDDEF_H=true
fi
- if test $gt_cv_c_wchar_t = no; then
- HAVE_WCHAR_T=0
- GL_GENERATE_STDDEF_H=true
- fi
-
AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
[gl_cv_decl_null_works],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
@@ -148,5 +142,4 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS],
STDDEF_NOT_IDEMPOTENT=0; AC_SUBST([STDDEF_NOT_IDEMPOTENT])
REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T])
- HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
])
diff --git a/gnulib/m4/stdio_h.m4 b/gnulib/m4/stdio_h.m4
index 8eb5816ad7..ec52ae92ff 100644
--- a/gnulib/m4/stdio_h.m4
+++ b/gnulib/m4/stdio_h.m4
@@ -1,5 +1,5 @@
# stdio_h.m4
-# serial 63
+# serial 75
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -133,6 +133,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
[
m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH])
@@ -153,12 +154,14 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_ZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN])
@@ -172,20 +175,29 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNZPRINTF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSZPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VZPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ZPRINTF])
dnl Support Microsoft deprecated alias function names by default.
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1])
diff --git a/gnulib/m4/stdlib_h.m4 b/gnulib/m4/stdlib_h.m4
index bb5a646041..332669f946 100644
--- a/gnulib/m4/stdlib_h.m4
+++ b/gnulib/m4/stdlib_h.m4
@@ -1,5 +1,5 @@
# stdlib_h.m4
-# serial 78
+# serial 79
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -146,6 +146,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STACK_TRACE])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL])
@@ -261,4 +262,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL])
REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])
+ CAN_PRINT_STACK_TRACE=0; AC_SUBST([CAN_PRINT_STACK_TRACE])
])
diff --git a/gnulib/m4/strcasestr.m4 b/gnulib/m4/strcasestr.m4
index d254871677..811e680ff5 100644
--- a/gnulib/m4/strcasestr.m4
+++ b/gnulib/m4/strcasestr.m4
@@ -1,5 +1,5 @@
# strcasestr.m4
-# serial 28
+# serial 29
dnl Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -98,7 +98,7 @@ static void quit (int sig) { _exit (sig + 128); }
char *haystack = (char *) malloc (2 * m + 2);
char *needle = (char *) malloc (m + 2);
/* Failure to compile this test due to missing alarm is okay,
- since all such platforms (mingw) also lack strcasestr. */
+ since all such platforms (mingw, MSVC) also lack strcasestr. */
signal (SIGALRM, quit);
alarm (5);
/* Check for quadratic performance. */
diff --git a/gnulib/m4/strnlen.m4 b/gnulib/m4/strnlen.m4
index b4d2778524..83a75c0c32 100644
--- a/gnulib/m4/strnlen.m4
+++ b/gnulib/m4/strnlen.m4
@@ -1,11 +1,60 @@
# strnlen.m4
-# serial 14
+# serial 15
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 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.
+m4_version_prereq([2.73], [], [
+# Replace AC_FUNC_STRNLEN from Autoconf 2.72 and earlier,
+# which does not check for Android strnlen bugs.
+
+AC_DEFUN([AC_FUNC_STRNLEN],
+[AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])dnl
+AC_CACHE_CHECK([for working strnlen], [ac_cv_func_strnlen_working],
+[AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [AC_INCLUDES_DEFAULT
+ [/* Use pstrnlen to test; 'volatile' prevents the compiler
+ from optimizing the strnlen calls away. */
+ size_t (*volatile pstrnlen) (char const *, size_t) = strnlen;
+ char const s[] = "foobar";
+ int s_len = sizeof s - 1;
+ ]],
+ [[
+ /* AIX 4.3 is buggy: strnlen (S, 1) == 3. */
+ int i;
+ for (i = 0; i < s_len + 1; ++i)
+ {
+ int expected = i <= s_len ? i : s_len;
+ if (pstrnlen (s, i) != expected)
+ return 1;
+ }
+
+ /* Android 5.0 (API 21) strnlen ("", SIZE_MAX) incorrectly crashes. */
+ if (pstrnlen ("", -1) != 0)
+ return 1;]])],
+ [ac_cv_func_strnlen_working=yes],
+ [ac_cv_func_strnlen_working=no],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [[#if defined _AIX && !defined _AIX51
+ #error "AIX pre 5.1 is buggy"
+ #endif
+ #ifdef __ANDROID__
+ #include <android/api-level.h>
+ #if __ANDROID_API__ < 22
+ #error "Android API < 22 is buggy"
+ #endif
+ #endif
+ ]])],
+ [ac_cv_func_strnlen_working=yes],
+ [ac_cv_func_strnlen_working=no])])])
+test $ac_cv_func_strnlen_working = no && AC_LIBOBJ([strnlen])
+])# AC_FUNC_STRNLEN
+])
+
AC_DEFUN([gl_FUNC_STRNLEN],
[
AC_REQUIRE([gl_STRING_H_DEFAULTS])
diff --git a/gnulib/m4/strstr.m4 b/gnulib/m4/strstr.m4
index 957ed2e307..d19559aa25 100644
--- a/gnulib/m4/strstr.m4
+++ b/gnulib/m4/strstr.m4
@@ -1,5 +1,5 @@
# strstr.m4
-# serial 24
+# serial 25
dnl Copyright (C) 2008-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -95,7 +95,7 @@ static void quit (int sig) { _exit (sig + 128); }
char *haystack = (char *) malloc (2 * m + 2);
char *needle = (char *) malloc (m + 2);
/* Failure to compile this test due to missing alarm is okay,
- since all such platforms (mingw) also have quadratic strstr. */
+ since all such platforms (mingw, MSVC) also have quadratic strstr. */
signal (SIGALRM, quit);
alarm (5);
/* Check for quadratic performance. */
diff --git a/gnulib/m4/time_h.m4 b/gnulib/m4/time_h.m4
index d2f3c9701c..4ca7305792 100644
--- a/gnulib/m4/time_h.m4
+++ b/gnulib/m4/time_h.m4
@@ -1,5 +1,5 @@
# time_h.m4
-# serial 25
+# serial 26
dnl Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation,
Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -145,6 +145,7 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZNAME])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET])
dnl Support Microsoft deprecated alias function names by default.
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1])
diff --git a/gnulib/m4/vasnprintf.m4 b/gnulib/m4/vasnprintf.m4
index 1ea2055ea8..a02f4e1e1d 100644
--- a/gnulib/m4/vasnprintf.m4
+++ b/gnulib/m4/vasnprintf.m4
@@ -1,5 +1,5 @@
# vasnprintf.m4
-# serial 52
+# serial 54
dnl Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,8 +7,40 @@ dnl with or without modifications, as long as this notice is
preserved.
AC_DEFUN([gl_FUNC_VASNPRINTF],
[
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CHECK_FUNCS_ONCE([vasnprintf])
- if test $ac_cv_func_vasnprintf = no; then
+ if test $ac_cv_func_vasnprintf = yes; then
+ dnl On Cygwin, in directives with a huge width, the width is ignored, and
+ dnl the function returns a wrong result.
+ AC_CACHE_CHECK([whether vasnprintf works],
+ [gl_cv_func_vasnprintf_works],
+ [AC_RUN_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#include <stdio.h>
+ ]],
+ [[size_t len;
+ char *res = vasnprintf (NULL, &len, "x%03000000000dy\n", -17);
+ /* On Cygwin 3.4.6, res is "x-17y\n" and len == 6: wrong. */
+ return (res != NULL && len < 10);
+ ]])
+ ],
+ [gl_cv_func_vasnprintf_works=yes],
+ [gl_cv_func_vasnprintf_works=no],
+ [case "$host_os" in
+ # Guess no on Cygwin.
+ cygwin*) gl_cv_func_vasnprintf_works="guessing no";;
+ # If we don't know, obey --enable-cross-guesses.
+ *) gl_cv_func_vasnprintf_works="$gl_cross_guess_normal";;
+ esac
+ ])
+ ])
+ fi
+ if test $ac_cv_func_vasnprintf != yes \
+ || case "$gl_cv_func_vasnprintf_works" in
+ *yes) false;;
+ *) true;;
+ esac
+ then
gl_REPLACE_VASNPRINTF
fi
])
@@ -42,7 +74,6 @@ AC_DEFUN([gl_FUNC_VASNWPRINTF],
# Prerequisites of lib/printf-args.h, lib/printf-args.c.
AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
[
- AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
])
@@ -51,7 +82,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
[
AC_REQUIRE([gl_FEATURES_H])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
AC_REQUIRE([AC_TYPE_SIZE_T])
AC_CHECK_TYPE([ptrdiff_t], ,
@@ -185,7 +215,6 @@ int main()
AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF],
[
AC_REQUIRE([AC_FUNC_ALLOCA])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
AC_CHECK_FUNCS([wcslen])
dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization
diff --git a/gnulib/m4/wchar_t.m4 b/gnulib/m4/wchar_t.m4
deleted file mode 100644
index 968832cb29..0000000000
--- a/gnulib/m4/wchar_t.m4
+++ /dev/null
@@ -1,25 +0,0 @@
-# wchar_t.m4
-# serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2002-2003, 2008-2024 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-dnl Test whether <stddef.h> has the 'wchar_t' type.
-dnl Prerequisite: AC_PROG_CC
-
-AC_DEFUN([gt_TYPE_WCHAR_T],
-[
- AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <stddef.h>
- wchar_t foo = (wchar_t)'\0';]],
- [[]])],
- [gt_cv_c_wchar_t=yes],
- [gt_cv_c_wchar_t=no])])
- if test $gt_cv_c_wchar_t = yes; then
- AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
- fi
-])
diff --git a/gnulib/m4/wcwidth.m4 b/gnulib/m4/wcwidth.m4
index 1bf79ca167..f2fa198022 100644
--- a/gnulib/m4/wcwidth.m4
+++ b/gnulib/m4/wcwidth.m4
@@ -1,5 +1,5 @@
# wcwidth.m4
-# serial 37
+# serial 38
dnl Copyright (C) 2006-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,6 @@ AC_DEFUN([gl_FUNC_WCWIDTH],
dnl Persuade glibc <wchar.h> to declare wcwidth().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
AC_CHECK_HEADERS_ONCE([wchar.h])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Run gnulib-tool --add-import at top level,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/maintain/regenerate_C_options_info.pl, tp/maintain/regenerate_commands_perl_info.pl, tp/maintain/regenerate_documentlanguages-iana.pl, tp/maintain/regenerate_documentlanguages-loc.pl, tp/maintain/regenerate_perl_options_info.pl, tp/maintain/setup_accent_tables.pl, tp/maintain/setup_converters_code_tables.pl: add the information that a generated file is automatically generated if missing. Use the basename to name the script generating the code files such that the file content is the sa [...]
- Next by Date:
branch master updated: Run gnulib-tool --add-import in tp/Texinfo/XS
- Previous by thread:
branch master updated: * tp/maintain/regenerate_C_options_info.pl, tp/maintain/regenerate_commands_perl_info.pl, tp/maintain/regenerate_documentlanguages-iana.pl, tp/maintain/regenerate_documentlanguages-loc.pl, tp/maintain/regenerate_perl_options_info.pl, tp/maintain/setup_accent_tables.pl, tp/maintain/setup_converters_code_tables.pl: add the information that a generated file is automatically generated if missing. Use the basename to name the script generating the code files such that the file content is the sa [...]
- Next by thread:
branch master updated: Run gnulib-tool --add-import in tp/Texinfo/XS
- Index(es):