Bruno Haible [Fri, 26 Jul 2024 11:04:09 +0000 (13:04 +0200)]
sys_un: Avoid compilation error in C++ <string.h> on glibc systems.
* m4/sys_un_h.m4 (gl_SYS_UN_H): Require AC_CANONICAL_HOST. Set
GL_GENERATE_SYS_UN_H to true on glibc systems. Invoke
gl_CHECK_NEXT_HEADERS. Initialize HAVE_SYS_UN_H.
* lib/sys_un.in.h: Use include_next and a split double-inclusion guard.
In C++ mode, include <stddef.h> and <string.h> first.
* modules/sys_un (Depends-on): Add include_next.
(Makefile.am): Substitute INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER,
PRAGMA_COLUMNS, NEXT_SYS_UN_H, HAVE_SYS_UN_H. Arrange to remove 'sys'
directory at "make mostlyclean".
Paul Eggert [Fri, 26 Jul 2024 00:24:20 +0000 (17:24 -0700)]
xstrtol: remove the base-checking changes
* lib/xstrtol.c (__xstrtol): Stop worrying about hypothetical
implementations that are causing more confusion than the code is
worth. Instead, go back more to old way of doing things.
None of this matters for practical applications.
* lib/xstrtol.h: Document that behavior is undefined
if the base is negative, 1, or greater than 36.
* modules/xstrtol (Depends-on): Remove nullptr; no longer needed.
Bruno Haible [Thu, 25 Jul 2024 20:05:18 +0000 (22:05 +0200)]
xstrtol, xstrtoll tests: Test behaviour for an invalid base.
Reported by Alejandro Colomar <alx@kernel.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00249.html>.
* modules/xstrtol-tests (Files): Add tests/macros.h.
* modules/xstrtoll-tests (Files): Likewise.
* tests/test-xstrtol.c: Include macros.h.
(main): If no arguments are given on the command line, perform
miscellaneous tests.
* tests/test-xstrtol.sh: Also invoke test-xstrtol without arguments.
* tests/test-xstrtoll.sh: Also invoke test-xstrtoll without arguments.
* modules/select (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_select.in.h (select): Don't define to
select_used_without_requesting_gnulib_module_select if the gnulib module
'select' is in use under the same configure.ac.
* modules/shutdown (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (shutdown): Don't define to
shutdown_used_without_requesting_gnulib_module_shutdown if the gnulib
module 'shutdown' is in use under the same configure.ac.
* modules/setsockopt (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (setsockopt): Don't define to
setsockopt_used_without_requesting_gnulib_module_setsockopt if the
gnulib module 'setsockopt' is in use under the same configure.ac.
* modules/sendto (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (sendto): Don't define to
sendto_used_without_requesting_gnulib_module_sendto if the gnulib module
'sendto' is in use under the same configure.ac.
* modules/recvfrom (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (recvfrom): Don't define to
recvfrom_used_without_requesting_gnulib_module_recvfrom if the gnulib
module 'recvfrom' is in use under the same configure.ac.
* modules/send (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (send): Don't define to
send_used_without_requesting_gnulib_module_send if the gnulib module
'send' is in use under the same configure.ac.
* modules/recv (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (recv): Don't define to
recv_used_without_requesting_gnulib_module_recv if the gnulib module
'recv' is in use under the same configure.ac.
* modules/listen (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (listen): Don't define to
listen_used_without_requesting_gnulib_module_listen if the gnulib module
'listen' is in use under the same configure.ac.
* modules/getsockopt (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (getsockopt): Don't define to
getsockopt_used_without_requesting_gnulib_module_getsockopt if the
gnulib module 'getsockopt' is in use under the same configure.ac.
* modules/getsockname (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (getsockname): Don't define to
getsockname_used_without_requesting_gnulib_module_getsockname if the
gnulib module 'getsockname' is in use under the same configure.ac.
* modules/getpeername (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (getpeername): Don't define to
getpeername_used_without_requesting_gnulib_module_getpeername if the
gnulib module 'getpeername' is in use under the same configure.ac.
* modules/bind (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (bind): Don't define to
bind_used_without_requesting_gnulib_module_bind if the gnulib module
'bind' is in use under the same configure.ac.
* modules/accept (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (accept): Don't define to
accept_used_without_requesting_gnulib_module_accept if the gnulib module
'accept' is in use under the same configure.ac.
* modules/connect (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (connect): Don't define to
socket_used_without_requesting_gnulib_module_connect if the gnulib
module 'connect' is in use under the same configure.ac. Fix typo.
* modules/socket (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_socket.in.h (socket): Don't define to
socket_used_without_requesting_gnulib_module_socket if the gnulib module
'socket' is in use under the same configure.ac.
* modules/lstat (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_stat.in.h (lstat): Don't define to
lstat_used_without_requesting_gnulib_module_lstat if the gnulib module
'lstat' is in use under the same configure.ac.
* modules/fstatat (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_stat.in.h (fstatat): Don't define to
fstatat_used_without_requesting_gnulib_module_fstatat if the gnulib
module 'fstatat' is in use under the same configure.ac.
* modules/fstat (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_stat.in.h (fstat): Don't define to
fstat_used_without_requesting_gnulib_module_fstat if the gnulib module
'fstat' is in use under the same configure.ac.
* modules/stat (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_stat.in.h (stat): Don't define to
stat_used_without_requesting_gnulib_module_stat if the gnulib module
'stat' is in use under the same configure.ac.
* modules/ioctl (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/sys_ioctl.in.h (ioctl): Don't define to
ioctl_used_without_requesting_gnulib_module_ioctl if the gnulib module
'ioctl' is in use under the same configure.ac.
* modules/localeconv (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/locale.in.h (localeconv): Don't define to
localeconv_used_without_requesting_gnulib_module_localeconv if the
gnulib module 'localeconv' is in use under the same configure.ac.
* modules/gethostname (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/unistd.in.h (gethostname): Don't define to
gethostname_used_without_requesting_gnulib_module_gethostname if the
gnulib module 'gethostname' is in use under the same configure.ac.
Reported by Frédéric at <https://savannah.gnu.org/bugs/?65958>.
* modules/close (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/unistd.in.h (close): Don't define to
close_used_without_requesting_gnulib_module_close if the gnulib module
'close' is in use under the same configure.ac.
sys_socket tests: Improve checks for socklen_t and sa_family_t.
* modules/sys_socket-tests (Depends-on): Add intprops.
* tests/test-sys_socket.c: Check that socklen_t is at least 32 bits
wide. Check that sa_family_t is unsigned.
Bruno Haible [Tue, 23 Jul 2024 10:40:58 +0000 (12:40 +0200)]
strtold: Revisit underflow behaviour.
* doc/posix-functions/strtold.texi: Mention broken mingw 5.0. Mention
that gradual underflow does not count as an error on MSVC.
* tests/test-strtold.h (test_function): Add a gradual underflow test.
Check the sign in case of flush-to-zero underflow.
Bruno Haible [Tue, 23 Jul 2024 10:40:37 +0000 (12:40 +0200)]
strtod: Revisit underflow behaviour.
* doc/posix-functions/strtod.texi: Mention the macOS bug. Mention that
gradual underflow does not count as an error on Cygwin 2.9 and MSVC.
* m4/strtod.m4 (gl_FUNC_STRTOD): Update comment.
* tests/test-strtod.h (test_function): Add a gradual underflow test.
Check the sign in case of flush-to-zero underflow.
Bruno Haible [Tue, 23 Jul 2024 10:40:33 +0000 (12:40 +0200)]
strtof: Revisit underflow behaviour.
* doc/posix-functions/strtof.texi: Mention the macOS bug. Mention the
mingw overflow bug. Mention the underflow bugs on Cygwin 2.9 and mingw.
Mention that gradual underflow does not count as an error on Cygwin 2.9,
mingw, MSVC.
* m4/strtof.m4 (gl_FUNC_STRTOF): Test against the mingw overflow bug.
* tests/test-strtof.h (test_function): Add a gradual underflow test.
Check the sign in case of flush-to-zero underflow.
Bruno Haible [Tue, 23 Jul 2024 10:40:19 +0000 (12:40 +0200)]
strtof, strtod, strtold: Fix underflow behaviour of system function.
* m4/strtof.m4 (gl_FUNC_STRTOF): Test for strtof's behaviour upon
underflow. Conditionally define STRTOF_HAS_UNDERFLOW_BUG,
STRTOF_HAS_GRADUAL_UNDERFLOW_PROBLEM.
* m4/strtod.m4 (gl_FUNC_STRTOD): Test for strtod's behaviour upon
underflow. Conditionally define STRTOD_HAS_UNDERFLOW_BUG,
STRTOD_HAS_GRADUAL_UNDERFLOW_PROBLEM.
* m4/strtold.m4 (gl_FUNC_STRTOLD): Test for strtold's behaviour upon
gradual underflow. Conditionally define
STRTOLD_HAS_GRADUAL_UNDERFLOW_PROBLEM.
* lib/strtod.c (HAVE_UNDERLYING_STRTOD): Test STRTOF_HAS_UNDERFLOW_BUG,
STRTOD_HAS_UNDERFLOW_BUG.
(HAS_GRADUAL_UNDERFLOW_PROBLEM): New macro.
(SET_ERRNO_UPON_GRADUAL_UNDERFLOW): New macro.
(STRTOD): Use it.
sys_socket tests: Improve tests for macro definitions.
* modules/sys_socket-tests (Depends-on): Add assert-h.
* tests/test-sys_socket.c (a): Remove variable.
(main): Test that each supported address family is defined to a distinct
value. Test that each constant passed as the second argument of
'shutdown' is defined to a distinct value.
Bruno Haible [Sun, 21 Jul 2024 12:02:58 +0000 (14:02 +0200)]
bootstrap: Avoid failure when gnulib-tool removed gettext.m4.
* top/bootstrap-funclib.sh (autogen): When gnulib-tool has removed
gettext.m4 but the package needs gettext.m4, repeat the autopoint and
gnulib-tool invocations.
* build-aux/bootstrap: Regenerated.
Paul Eggert [Fri, 19 Jul 2024 17:39:58 +0000 (10:39 -0700)]
xstrtol: be more robust against odd failures
* lib/xstrtol.c (__xstrtol): Don’t update *endptr if strtol doesn’t.
Also, if the underlying strtol gives an unusual error number and
sets *endpnr = nptr, assume that’s an error not a missing number.
Problems reported by Alejandro Colomar in:
https://lists.gnu.org/r/bug-gnulib/2024-07/msg00175.html
https://lists.gnu.org/r/bug-gnulib/2024-07/msg00176.html
* modules/xstrtol (Depends-on): Add nullptr.
Bruno Haible [Fri, 19 Jul 2024 17:21:05 +0000 (19:21 +0200)]
doc: Mention <math.h> function that were added in ISO C23.
* doc/posix-functions/acospi.texi: New file.
* doc/posix-functions/acospif.texi: New file.
* doc/posix-functions/acospil.texi: New file.
* doc/posix-functions/asinpi.texi: New file.
* doc/posix-functions/asinpif.texi: New file.
* doc/posix-functions/asinpil.texi: New file.
* doc/posix-functions/atanpi.texi: New file.
* doc/posix-functions/atanpif.texi: New file.
* doc/posix-functions/atanpil.texi: New file.
* doc/posix-functions/atan2pi.texi: New file.
* doc/posix-functions/atan2pif.texi: New file.
* doc/posix-functions/atan2pil.texi: New file.
* doc/posix-functions/compoundn.texi: New file.
* doc/posix-functions/compoundnf.texi: New file.
* doc/posix-functions/compoundnl.texi: New file.
* doc/posix-functions/cospi.texi: New file.
* doc/posix-functions/cospif.texi: New file.
* doc/posix-functions/cospil.texi: New file.
* doc/posix-functions/exp10.texi: Moved here from doc/glibc-functions/.
* doc/posix-functions/exp10f.texi: Moved here from doc/glibc-functions/.
* doc/posix-functions/exp10l.texi: Moved here from doc/glibc-functions/.
* doc/posix-functions/exp10m1.texi: New file.
* doc/posix-functions/exp10m1f.texi: New file.
* doc/posix-functions/exp10m1l.texi: New file.
* doc/posix-functions/exp2m1.texi: New file.
* doc/posix-functions/exp2m1f.texi: New file.
* doc/posix-functions/exp2m1l.texi: New file.
* doc/posix-functions/log10p1.texi: New file.
* doc/posix-functions/log10p1f.texi: New file.
* doc/posix-functions/log10p1l.texi: New file.
* doc/posix-functions/log2p1.texi: New file.
* doc/posix-functions/log2p1f.texi: New file.
* doc/posix-functions/log2p1l.texi: New file.
* doc/posix-functions/logp1.texi: New file.
* doc/posix-functions/logp1f.texi: New file.
* doc/posix-functions/logp1l.texi: New file.
* doc/posix-functions/pown.texi: New file.
* doc/posix-functions/pownf.texi: New file.
* doc/posix-functions/pownl.texi: New file.
* doc/posix-functions/powr.texi: New file.
* doc/posix-functions/powrf.texi: New file.
* doc/posix-functions/powrl.texi: New file.
* doc/posix-functions/rootn.texi: New file.
* doc/posix-functions/rootnf.texi: New file.
* doc/posix-functions/rootnl.texi: New file.
* doc/posix-functions/rsqrt.texi: New file.
* doc/posix-functions/rsqrtf.texi: New file.
* doc/posix-functions/rsqrtl.texi: New file.
* doc/posix-functions/sinpi.texi: New file.
* doc/posix-functions/sinpif.texi: New file.
* doc/posix-functions/sinpil.texi: New file.
* doc/posix-functions/tanpi.texi: New file.
* doc/posix-functions/tanpif.texi: New file.
* doc/posix-functions/tanpil.texi: New file.
* doc/gnulib.texi (Function Substitutes): Include them.
(Glibc math.h): Don't include glibc-functions/exp10*.texi.
Paul Eggert [Fri, 19 Jul 2024 00:28:36 +0000 (17:28 -0700)]
xstrtol: document and stray less from strtol
This patch alters xstrtol behavior slightly, in areas are not
likely to affect any real callers, by making xstrtol behave more
like the system strtol. In particular, it lets xstrtol support
bases other than those required by POSIX, if the underlying
implementation does; this removes the need for an ‘assert’.
It also uses ‘restrict’ like the underlying strtol does.
The patch also documents xstrtol in xstrtol.h.
Problems reported by AlejandroColomar in:
https://lists.gnu.org/r/bug-gnulib/2024-07/msg00159.html
* lib/xstrtol.c: Do not include stdio.h or assure.h.
(__xstrtol): Use same parameter names as POSIX, to make it
easier for outsiders to follow. Assume C99 decls after statement.
Do not require the base to be 0, or 2-36, as the underlying
implementation is allowed to support other bases.
Do not assume isspace preserves errno.
* lib/xstrtol.h (_DECLARE_XSTRTOL): Declare pointers to be
‘restrict’, for compatibility with C.
* m4/xstrtol.m4 (gl_XSTRTOL): Require AC_C_RESTRICT.
* modules/xstrtol (Depends-on): Remove ‘assure’.
* modules/stack-trace (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/stdlib.in.h (print_stack_trace): Don't define if module
'stack-trace' is not present.
* tests/macros.h (print_stack_trace): Define as a fallback if module
'stack-trace' is not present.
Bruno Haible [Thu, 18 Jul 2024 02:58:39 +0000 (04:58 +0200)]
stack-trace: Use libasan as an alternative to libbacktrace.
* m4/stack-trace.m4 (gl_STACK_TRACE_EARLY): As a second choice, use
libasan.
* lib/stack-trace-impl.h (print_stack_trace_to) [HAVE_LIBASAN]:
Implement using libasan.
* lib/stack-trace.c (print_stack_trace): Test also HAVE_LIBASAN.
* lib/abort-debug.c (rpl_abort): Likewise.
Bruno Haible [Thu, 18 Jul 2024 02:04:23 +0000 (04:04 +0200)]
stack-trace: New module.
* lib/stdlib.in.h (print_stack_trace): Make part of the stack-trace
module.
* lib/stack-trace-impl.h: New file, based on lib/abort-debug.c.
* lib/stack-trace.c: New file, based on lib/abort-debug.c.
* lib/abort-debug.c: Include stack-trace-impl.h. Remove definitions
moved to stack-trace-impl.h.
(print_stack_trace): Remove function.
* m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STACK_TRACE.
(gl_STDLIB_H_DEFAULTS): Initialize CAN_PRINT_STACK_TRACE.
* m4/stack-trace.m4: New file, based on m4/abort-debug.m4.
* m4/abort-debug.m4 (gl_ABORT_DEBUG_EARLY): Remove macro.
(gl_ABORT_DEBUG): Require gl_STDLIB_H_DEFAULTS, gl_STACK_TRACE_EARLY.
Set REPLACE_ABORT here.
* modules/stdlib (Makefile.am): Substitute GNULIB_STACK_TRACE,
CAN_PRINT_STACK_TRACE.
* modules/stack-trace: New file.
* modules/abort-debug (Depends-on): Add stack-trace. Remove execinfo.
(configure.ac-early): Remove section.
* DEPENDENCIES: Update.
Paul Eggert [Mon, 15 Jul 2024 21:14:55 +0000 (14:14 -0700)]
strnlen: port to Android 5.0 (API 21)
This is needed for GNU Emacs, which attempts to port to these
old Android versions.
* m4/strnlen.m4 (AC_FUNC_STRNLEN): Replace if Autoconf 2.72 or
earlier, with code that detects the Android problem with strnlen.
This version works around some further bugs in the test, notably,
misplaced 'volatile' and need for volatile in the AIX 4.3 bug
check too.
Bruno Haible [Mon, 15 Jul 2024 12:48:41 +0000 (14:48 +0200)]
qcopy-acl: Fix copying of ACLs on CentOS 7 (regression 2023-01-12).
* lib/qcopy-acl.c: Include <string.h>, <linux/xattr.h>.
(XATTR_NAME_NFSV4_ACL, XATTR_NAME_POSIX_ACL_ACCESS,
XATTR_NAME_POSIX_ACL_DEFAULT): New macros, from file-has-acl.c.
(is_attr_permissions): Test for these names explicitly.
* m4/acl.m4 (gl_QCOPY_ACL): New macro.
* modules/qcopy-acl (Files): Add m4/acl.m4.
(configure.ac): Invoke gl_QCOPY_ACL.
Bruno Haible [Sun, 14 Jul 2024 16:38:16 +0000 (18:38 +0200)]
strtold: Work around major mingw bugs.
* lib/strtod.c (HAVE_UNDERLYING_STRTOD) [USE_LONG_DOUBLE]: Set to 0 on
mingw versions before 10.0.
* doc/posix-functions/strtold.texi: Mention the mingw bugs.
Bruno Haible [Sat, 13 Jul 2024 15:32:07 +0000 (17:32 +0200)]
doc: Revamp list of dependencies.
* DEPENDENCIES: Clarify that GNU make is only needed on OpenBSD and
Solaris. Mark GNU tar as optional, not recommended. Add note about
Solaris 10. Add a second section "Dependencies for building the imported
code". Document the needed locales.
Bruno Haible [Sat, 13 Jul 2024 15:26:37 +0000 (17:26 +0200)]
tests: Don't depend on the exact locale name.
* tests/test-c-ctype.c: Include <stdlib.h>.
(main): Test the return value of setlocale(). Try not only de_DE, but
also de_DE.ISO-8859-1.
* tests/test-vasnprintf-posix3.c (main): Try not only fa_IR.UTF-8, but
also fa_IR.
* tests/test-vasnwprintf-posix3.c (main): Likewise.