]> Savannah Git Hosting - gnulib.git/log
gnulib.git
8 months agoAdd ChangeLog entry for last commit.
Paul Eggert [Thu, 15 Aug 2024 04:01:18 +0000 (06:01 +0200)]
Add ChangeLog entry for last commit.

8 months agoverror: allow library name-spacing of verror
Paul Eggert [Thu, 15 Aug 2024 03:04:42 +0000 (20:04 -0700)]
verror: allow library name-spacing of verror

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00085.html
* lib/error.c (verror, verror_at_line) [!_LIBC]: #undef only if
the corresponding GNULIB_defined_... macros are defined.
* lib/error.in.h (verror, verror_with_line):
Don't define as macros if they are already defined, or if
_GL_NO_INLINE_ERROR is defined.  This may lose some niceties with GCC
warnings, but the code’s valid.

8 months agoerror: merge from glibc and with verror
Paul Eggert [Thu, 15 Aug 2024 01:03:54 +0000 (18:03 -0700)]
error: merge from glibc and with verror

* lib/error.c: Merge changes since 2018 from glibc.
----- The following changes are taken from glibc:
(__error_internal, __error_at_line_internal): New functions,
with most of the old error and error_at_line_internal but
with va_list and with a new trailing mode_args,
for wide character mode.
(error_tail): Add trailing arg.
(error_tail, __error_internal, __error_at_line_internal):
Redo _LIBC implementation with respect to cancelation.
[_LIBC]: Include <libc-lock.h>, not <bits/libc-lock.h>.
----- The following changes are specific to Gnulib:
(__error_internal, __error_at_line_internal, error_tail) [!_LIBC]:
Use macros to define away the new trailing arg, and to name
the internal functions to verror and verror_at_line.
(verror, verror_at_line) [!_LIBC]: Undef so that we omit
the __gl_error_call business when defining these functions.
* lib/error.in.h: Include stdarg.h.
(verror, verror_at_line): New decls and macros.
* m4/error_h.m4 ([gl_ERROR_H]): Always compile error.c if
the verror module is also present.
* modules/verror (Files, lib_SOURCES):
Remove lib/verror.h, lib/verror.c.
(Depends-on): Remove stdio, xvasprintf.
(configure.ac-early): Define gl_HAVE_MODULE_VERROR so that
the error module compiles error.c.  Not sure if this is the
standard way to do this, but it seems to work.
* modules/verror (Include), tests/test-verror.c:
Include error.h, not verror.h.

8 months agoerror: it’s cold
Paul Eggert [Wed, 14 Aug 2024 21:06:05 +0000 (14:06 -0700)]
error: it’s cold

This mimics what glibc is doing nowadays.
* lib/error.in.h (error, error_at_line):
* lib/verror.h (verror, verror_at_line):
Declare with _GL_ATTRIBUTE_CODE.

8 months agopthread-rwlock-extra-tests: Exclude this test from packages by default.
Bruno Haible [Wed, 14 Aug 2024 14:43:34 +0000 (16:43 +0200)]
pthread-rwlock-extra-tests: Exclude this test from packages by default.

* tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Add comment.
* modules/pthread-rwlock-extra-tests (Status): Mark as longrunning-test.

8 months agotests: Fix link errors (regression 2024-08-12).
Bruno Haible [Wed, 14 Aug 2024 14:14:27 +0000 (16:14 +0200)]
tests: Fix link errors (regression 2024-08-12).

* modules/chown-tests (Makefile.am): Link test-chown with LIBINTL.
* modules/lchown-tests (Makefile.am): Link test-lchown with LIBINTL.
* modules/stat-time-tests (Makefile.am): Link test-stat-time with
LIBINTL.

8 months agombrtoc16: Fix compilation error on Haiku.
Bruno Haible [Tue, 13 Aug 2024 06:38:22 +0000 (08:38 +0200)]
mbrtoc16: Fix compilation error on Haiku.

* lib/uchar.in.h (mbrtoc16): Fix typo.

8 months agotermios tests: Check for struct winsize.
Collin Funk [Tue, 13 Aug 2024 03:11:19 +0000 (20:11 -0700)]
termios tests: Check for struct winsize.

* tests/test-termios.c (t2): Make sure inclusion of termios.h allows use
of struct winsize.

8 months agotermios: Define struct winsize on all platforms.
Collin Funk [Tue, 13 Aug 2024 03:09:01 +0000 (20:09 -0700)]
termios: Define struct winsize on all platforms.

* doc/posix-headers/termios.texi (termios.h): Mention struct winsize is
defined in <sys/ioctl.h> on glibc.
* lib/termios.in.h (struct winsize): Define or include.
* m4/termios_h.m4 (gl_TERMIOS_H): Check for a definition of struct
winsize.
* modules/termios (Makefile.am): Replace AC_SUBST variables.

8 months agoerrno tests: Avoid test failure on Haiku.
Bruno Haible [Mon, 12 Aug 2024 15:15:10 +0000 (17:15 +0200)]
errno tests: Avoid test failure on Haiku.

* doc/posix-headers/errno.texi: Mention the Haiku problem.
* tests/test-errno.c: On Haiku, don't check that the error numbers are
positive.

8 months agoerrno: Ensure ESOCKTNOSUPPORT gets defined.
Bruno Haible [Mon, 12 Aug 2024 15:11:35 +0000 (17:11 +0200)]
errno: Ensure ESOCKTNOSUPPORT gets defined.

* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Test also whether ESOCKTNOSUPPORT
is defined.
* lib/errno.in.h (ESOCKTNOSUPPORT, GNULIB_defined_ESOCKTNOSUPPORT): New
macros.
* lib/strerror-override.h (strerror_override): Declare also if
GNULIB_defined_ESOCKTNOSUPPORT is defined.
* lib/strerror-override.c (strerror_override): Handle ESOCKTNOSUPPORT.
* lib/strerrorname_np.c (strerrorname_np): Move ESOCKTNOSUPPORT code to
the POSIX section.
* doc/posix-headers/errno.texi: Document the Haiku problem.

8 months agofdutimensat, utimensat tests: Fix test failures on Cygwin.
Bruno Haible [Mon, 12 Aug 2024 14:15:50 +0000 (16:15 +0200)]
fdutimensat, utimensat tests: Fix test failures on Cygwin.

* tests/nap.h: Include concat-filename.h, xgetcwd.h.
(nap_file): New variable.
(nap_get_stat, clear_temp_file): Use nap_file, not TEMPFILE.
(nap): Initialize nap_file.
* modules/chown-tests (Depends-on): Add xconcat-filename, xgetcwd.
* modules/fchownat-tests (Depends-on): Likewise.
* modules/fdutimensat-tests (Depends-on): Likewise.
* modules/futimens-tests (Depends-on): Likewise.
* modules/lchown-tests (Depends-on): Likewise.
* modules/stat-time-tests (Depends-on): Likewise.
* modules/utime-tests (Depends-on): Likewise.
* modules/utimens-tests (Depends-on): Likewise.
* modules/utimensat-tests (Depends-on): Likewise.

8 months agopthread-rwlock: Attempt harder to avoid test failure on macOS.
Bruno Haible [Mon, 12 Aug 2024 12:56:46 +0000 (14:56 +0200)]
pthread-rwlock: Attempt harder to avoid test failure on macOS.

* tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Bump the
minimum interval to 200 ms on macOS.

8 months agopthread-rwlock: Attempt harder to avoid test failure on macOS.
Bruno Haible [Mon, 12 Aug 2024 12:18:02 +0000 (14:18 +0200)]
pthread-rwlock: Attempt harder to avoid test failure on macOS.

* tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Bump the
minimum interval to 100 ms on macOS.

8 months agopthread-rwlock: Attempt harder to avoid test failure on macOS.
Bruno Haible [Mon, 12 Aug 2024 11:15:42 +0000 (13:15 +0200)]
pthread-rwlock: Attempt harder to avoid test failure on macOS.

* tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Bump the
minimum interval to 50 ms on macOS.

8 months agopthread-rwlock tests: Move the waitqueue test into a separate module.
Bruno Haible [Mon, 12 Aug 2024 09:24:40 +0000 (11:24 +0200)]
pthread-rwlock tests: Move the waitqueue test into a separate module.

* modules/pthread-rwlock-extra-tests: New file.
* modules/pthread-rwlock-tests: Revert 2024-08-07 changes.
(Depends-on): Add pthread-rwlock-extra-tests.

8 months agopthread-rwlock: Attempt to avoid test failure on some more machines.
Bruno Haible [Mon, 12 Aug 2024 09:15:37 +0000 (11:15 +0200)]
pthread-rwlock: Attempt to avoid test failure on some more machines.

* tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Bump the
minimum interval to 20 ms on macOS.

8 months agohtonl: Fix link errors on Windows.
Collin Funk [Sun, 11 Aug 2024 20:53:48 +0000 (13:53 -0700)]
htonl: Fix link errors on Windows.

Reported by Bruno Haible in:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00066.html>.

* lib/arpa_inet.in.h (htons, htonl, ntohs, ntohl): Only define when not
declared by the system.
* m4/arpa_inet_h.m4 (gl_ARPA_INET_H_DEFAULTS): Set default behavior for
htonl functions.
* m4/htonl.m4 (gl_FUNC_HTONL): Check if -lws2_32 is required. Only check
for declarations on POSIX systems.
* modules/arpa_inet (Makefile.am): Substitute new Makefile variables.
* modules/htonl (Files): Add m4/sys_socket_h.m4.
(Depends-on): Remove endian condition.
(Link): Add $(HOTNL_LIB).
* modules/htonl-tests: Link to @HTONL_LIB@.

8 months agodoc: Update regarding Windows <winsock2.h> functions.
Bruno Haible [Sun, 11 Aug 2024 19:01:38 +0000 (21:01 +0200)]
doc: Update regarding Windows <winsock2.h> functions.

* doc/posix-functions/accept.texi: Mention that it's declared elsewhere
on native Windows.
* doc/posix-functions/bind.texi: Likewise.
* doc/posix-functions/connect.texi: Likewise.
* doc/posix-functions/getpeername.texi: Likewise.
* doc/posix-functions/getsockname.texi: Likewise.
* doc/posix-functions/getsockopt.texi: Likewise.
* doc/posix-functions/listen.texi: Likewise.
* doc/posix-functions/recv.texi: Likewise.
* doc/posix-functions/recvfrom.texi: Likewise.
* doc/posix-functions/select.texi: Likewise.
* doc/posix-functions/send.texi: Likewise.
* doc/posix-functions/sendto.texi: Likewise.
* doc/posix-functions/setsockopt.texi: Likewise.
* doc/posix-functions/shutdown.texi: Likewise.
* doc/posix-functions/socket.texi: Likewise.
* doc/pastposix-functions/gethostbyaddr.texi: Don't say that the
function is missing on native Windows.
* doc/pastposix-functions/gethostbyname.texi: Likewise.
* doc/posix-functions/getprotobyname.texi: Likewise.
* doc/posix-functions/getprotobynumber.texi: Likewise.
* doc/posix-functions/getservbyname.texi: Likewise.
* doc/posix-functions/getservbyport.texi: Likewise.
* doc/posix-functions/htonl.texi: Likewise.
* doc/posix-functions/htons.texi: Likewise.
* doc/posix-functions/inet_addr.texi: Likewise.
* doc/posix-functions/inet_ntoa.texi: Likewise.
* doc/posix-functions/ntohl.texi: Likewise.
* doc/posix-functions/ntohs.texi: Likewise.
* doc/posix-functions/gethostname.texi: Update.

8 months agotest-fdutimensat: fix newly-added test
Paul Eggert [Sun, 11 Aug 2024 04:47:07 +0000 (21:47 -0700)]
test-fdutimensat: fix newly-added test

Problem reported by Bruno Haible and Collin Funk in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00061.html
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00064.html
* tests/test-utimens.h (test_utimens): Fix typo in new test,
which causes the test to break on file systems that are not noatime.

8 months agohtonl: Add tests.
Collin Funk [Sun, 11 Aug 2024 00:16:45 +0000 (17:16 -0700)]
htonl: Add tests.

* modules/htonl-tests: New file.
* tests/test-htonl.c: New file.

8 months agohtonl: New module.
Collin Funk [Sun, 11 Aug 2024 00:15:07 +0000 (17:15 -0700)]
htonl: New module.

* modules/htonl: New file.
* lib/arpa_inet.c: New file.
* m4/htonl.m4: New file.
* modules/arpa_inet (Files): Add lib/arpa_inet.c.
(Depends-on): Add extern-inline.
* lib/arpa_inet.in.h (htons, htonl, ntohs, ntohl): New declarations.
* m4/arpa_inet_h.m4 (gl_ARPA_INET_H_DEFAULTS): Define REPLACE_HTONL.
* doc/posix-functions/htons.texi (htons): Mention the module.
* doc/posix-functions/htonl.texi (htonl): Likewise.
* doc/posix-functions/ntohs.texi (ntohs): Likewise.
* doc/posix-functions/ntohl.texi (ntohl): Likewise.

8 months agoMake sure gperf-generated files are the same in VPATH builds.
Bruno Haible [Sat, 10 Aug 2024 10:48:55 +0000 (12:48 +0200)]
Make sure gperf-generated files are the same in VPATH builds.

Reported by Patrice Dumas <pertusus@free.fr> in
<https://lists.gnu.org/archive/html/bug-texinfo/2024-08/msg00030.html>.

* modules/iconv_open (Makefile.am): Eliminate directory names from the
generated iconv_open-aix.h, iconv_open-hpux.h, iconv_open-irix.h,
iconv_open-osf.h, iconv_open-solaris.h, iconv_open-zos.h.
* modules/unicase/locale-language (Makefile.am): Eliminate directory
names from the generated unicase/locale-languages.h.
* modules/unicase/special-casing (Makefile.am): Eliminate directory
names from the generated unicase/special-casing-table.h.
* modules/unictype/bidiclass-byname (Makefile.am): Eliminate directory
names from the generated unictype/bidi_byname.h.
* modules/unictype/category-byname (Makefile.am): Eliminate directory
names from the generated unictype/categ_byname.h.
* modules/unictype/combining-class-byname (Makefile.am): Eliminate
directory names from the generated unictype/combiningclass_byname.h.
* modules/unictype/incb-byname (Makefile.am): Eliminate directory names
from the generated unictype/incb_byname.h.
* modules/unictype/joininggroup-byname (Makefile.am): Eliminate
directory names from the generated unictype/joininggroup_byname.h.
* modules/unictype/joiningtype-byname (Makefile.am): Eliminate directory
names from the generated unictype/joiningtype_byname.h.
* modules/unictype/property-byname (Makefile.am): Eliminate directory
names from the generated unictype/pr_byname.h.
* modules/unictype/scripts (Makefile.am): Eliminate directory names from
the generated unictype/scripts_byname.h.
* modules/uninorm/composition (Makefile.am): Eliminate directory names
from the generated uninorm/composition-table.h.

8 months agofull-read, etc.: prefer signed types
Paul Eggert [Fri, 9 Aug 2024 21:33:31 +0000 (14:33 -0700)]
full-read, etc.: prefer signed types

* lib/full-read.h, lib/full-write.h, lib/safe-read.h, lib/safe-write.h:
Include idx.h.
* lib/full-write.c (full_read, full_write):
Now accept and returns idx_t.
* lib/safe-read.c (bufptr): New type, since apps are not
supposed to #define keywords like ‘const’.
(safe_read, safe_write): Now accept idx_t and return ptrdiff_t.
* lib/safe-read.h (SAFE_READ_ERROR):
* lib/safe-write.h (SAFE_WRITE_ERROR):
Now ptrdiff_t, not size_t.
* modules/full-read, modules/full-write, modules/safe-read:
* modules/safe-write (Depends-on): Add idx.

8 months agosig2str: Align with POSIX:2024.
Bruno Haible [Fri, 9 Aug 2024 20:18:16 +0000 (22:18 +0200)]
sig2str: Align with POSIX:2024.

* lib/signal.in.h (SIG2STR_MAX): New macro.
(sig2str, str2sig): New declarations.
* lib/sig2str.h: Don't include intprops.h.
(SIG2STR_MAX): Remove macro.
(sig2str, str2sig): Remove declarations.
* lib/sig2str.c: Include <signal.h> as the specification header.
* m4/signal_h.m4 (gl_SIGNAL_H): Test whether sig2str, str2sig are
declared.
(gl_SIGNAL_H_REQUIRE_DEFAULTS): Initialize GNULIB_SIG2STR.
(gl_SIGNAL_H_DEFAULTS): Initialize HAVE_SIG2STR, HAVE_STR2SIG.
* m4/sig2str.m4 (gl_FUNC_SIG2STR): Require gl_SIGNAL_H_DEFAULTS. Check
also for str2sig. Set HAVE_SIG2STR, HAVE_STR2SIG.
* modules/signal-h (Makefile.am): Substitute GNULIB_SIG2STR,
HAVE_SIG2STR, HAVE_STR2SIG.
* modules/sig2str (Depends-on): Add signal-h. Remove intprops.
(configure.ac): Test HAVE_SIG2STR, HAVE_STR2SIG. Invoke
gl_SIGNAL_MODULE_INDICATOR.
(Include): Add <signal.h>.
* doc/posix-functions/sig2str.texi: Mention as implemented through the
sig2str module.
* doc/posix-functions/str2sig.texi: Likewise.

8 months agotest-utime: port to noatime file systems
Paul Eggert [Fri, 9 Aug 2024 21:03:44 +0000 (14:03 -0700)]
test-utime: port to noatime file systems

Problem encountered on Ubuntu 24.04 zfs mounted noatime.
* tests/test-fdutimensat.c (main):
* tests/test-futimens.h (test_futimens):
* tests/test-lutimens.h (test_lutimens):
* tests/test-utime.c (test_utime):
* tests/test-utimens-common.h (checkable_atime): New function.
* tests/test-utimens.h (test_utimens):
* tests/test-utimensat.c (main):
Do not check atime on file systems mounted noatime.

8 months agopthread-rwlock: Attempt to avoid test failure on some machines.
Bruno Haible [Fri, 9 Aug 2024 09:59:10 +0000 (11:59 +0200)]
pthread-rwlock: Attempt to avoid test failure on some machines.

Reported by Pádraig Brady <P@draigBrady.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00050.html>.

* tests/test-pthread-rwlock-waitqueue.c (STEP_INTERVAL): Bump the
minimum interval to 10 ms.
* m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Likewise.

8 months agoFix recent ChangeLog entry.
Bruno Haible [Fri, 9 Aug 2024 02:40:51 +0000 (04:40 +0200)]
Fix recent ChangeLog entry.

Reported by Collin Funk.

8 months agodoc: Update for other functions added in POSIX:2024.
Bruno Haible [Fri, 9 Aug 2024 00:09:03 +0000 (02:09 +0200)]
doc: Update for other functions added in POSIX:2024.

* doc/posix-functions/be16toh.texi: New file.
* doc/posix-functions/be32toh.texi: New file.
* doc/posix-functions/be64toh.texi: New file.
* doc/posix-functions/dcgettext_l.texi: New file.
* doc/posix-functions/dcngettext_l.texi: New file.
* doc/posix-functions/dgettext_l.texi: New file.
* doc/posix-functions/dngettext_l.texi: New file.
* doc/posix-functions/getlocalename_l.texi: New file.
* doc/posix-functions/gettext_l.texi: New file.
* doc/posix-functions/htobe16.texi: New file.
* doc/posix-functions/htobe32.texi: New file.
* doc/posix-functions/htobe64.texi: New file.
* doc/posix-functions/htole16.texi: New file.
* doc/posix-functions/htole32.texi: New file.
* doc/posix-functions/htole64.texi: New file.
* doc/posix-functions/le16toh.texi: New file.
* doc/posix-functions/le32toh.texi: New file.
* doc/posix-functions/le64toh.texi: New file.
* doc/posix-functions/ngettext_l.texi: New file.
* doc/posix-functions/posix_close.texi: New file.
* doc/posix-functions/posix_devctl.texi: New file.
* doc/posix-functions/posix_getdents.texi: New file.
* doc/posix-functions/posix_spawn_file_actions_addchdir.texi: New file.
* doc/posix-functions/posix_spawn_file_actions_addfchdir.texi: New file.
* doc/posix-functions/sig2str.texi: New file.
* doc/posix-functions/str2sig.texi: New file.
* doc/posix-functions/tcgetwinsize.texi: New file.
* doc/posix-functions/tcsetwinsize.texi: New file.
* doc/posix-functions/wcslcat.texi: New file.
* doc/posix-functions/wcslcpy.texi: New file.
* doc/gnulib.texi (Functions in <devctl.h>, Functions in <endian.h>):
New sections.
(Functions in <dirent.h>, Functions in <libintl.h>,
Functions in <locale.h>, Functions in <signal.h>,
Functions in <spawn.h>, Functions in <termios.h>,
Functions in <unistd.h>, Functions in <wchar.h>): Include the other new
files.
* doc/posix-functions/strlcat.texi: Update.
* doc/posix-functions/strlcpy.texi: Update.

8 months agodoc: Update for ISO C functions added in POSIX:2024.
Bruno Haible [Thu, 8 Aug 2024 22:15:16 +0000 (00:15 +0200)]
doc: Update for ISO C functions added in POSIX:2024.

* doc/posix-headers/CMPLX*.texi: New files.
* doc/posix-headers/at_quick_exit.texi: New file.
* doc/posix-headers/atomic_*.texi: New files.
* doc/posix-headers/kill_dependency.texi: New file.
* doc/posix-headers/*.texi: Update.
* doc/gnulib.texi (Functions in <stdatomic.h>): New section.
(Functions in <complex.h>, Functions in <stdlib.h>): Include the other
new files.

8 months agodoc: Update for ISO C header files added in POSIX:2024.
Bruno Haible [Thu, 8 Aug 2024 20:38:38 +0000 (22:38 +0200)]
doc: Update for ISO C header files added in POSIX:2024.

* doc/posix-headers/*.texi: Update.

8 months agodoc: Update for header files added in POSIX:2024.
Bruno Haible [Thu, 8 Aug 2024 14:46:38 +0000 (16:46 +0200)]
doc: Update for header files added in POSIX:2024.

* doc/posix-headers/devctl.texi: New file.
* doc/posix-headers/endian.texi: Renamed from
doc/glibc-headers/endian.texi. Update.
* doc/posix-headers/libintl.texi: Renamed from
doc/glibc-headers/libintl.texi. Update.
* doc/gnulib.texi (Header File Substitutes,
Glibc Header File Substitutes): Update.

8 months agodoc: Update for Cygwin 3.5.3.
Bruno Haible [Thu, 8 Aug 2024 14:15:20 +0000 (16:15 +0200)]
doc: Update for Cygwin 3.5.3.

* doc/posix-headers/*.texi: Update.
* doc/posix-functions/*.texi: Likewise.
* doc/glibc-functions/*.texi: Likewise.

8 months agomath: Fix INFINITY and NAN on mingw.
Bruno Haible [Thu, 8 Aug 2024 01:21:34 +0000 (03:21 +0200)]
math: Fix INFINITY and NAN on mingw.

* doc/posix-headers/math.texi: Mention this mingw bug.
* lib/math.in.h (INFINITY, NAN): Replace also on mingw.

8 months agodoc: Update for OpenBSD 7.5.
Bruno Haible [Wed, 7 Aug 2024 23:46:08 +0000 (01:46 +0200)]
doc: Update for OpenBSD 7.5.

* doc/posix-headers/*.texi: Update.
* doc/glibc-headers/*.texi: Likewise.
* doc/posix-functions/*.texi: Likewise.
* doc/pastposix-functions/*.texi: Likewise.
* doc/glibc-functions/*.texi: Likewise.

8 months agoAvoid compiler warnings in some configure tests.
Bruno Haible [Wed, 7 Aug 2024 22:54:03 +0000 (00:54 +0200)]
Avoid compiler warnings in some configure tests.

* m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Allocate more room for local
array 'name'.
* m4/pthread_mutex_timedlock.m4 (gl_FUNC_PTHREAD_MUTEX_TIMEDLOCK): Don't
pass a NULL pointer to pthread_mutex_timedlock.

8 months agopthread-rwlock tests: Strengthen tests.
Bruno Haible [Wed, 7 Aug 2024 17:53:41 +0000 (19:53 +0200)]
pthread-rwlock tests: Strengthen tests.

* tests/test-pthread-rwlock-waitqueue.c: New file.
* modules/pthread-rwlock-tests (Files): Add it.
(Depends-on): Add extensions, nanosleep, stdbool.
(Makefile.am): Arrange to test test-pthread-rwlock-waitqueue.

8 months agopthread-rwlock: Fix default wait queue behaviour on glibc/Linux.
Bruno Haible [Wed, 7 Aug 2024 17:53:37 +0000 (19:53 +0200)]
pthread-rwlock: Fix default wait queue behaviour on glibc/Linux.

* lib/pthread.in.h: If REPLACE_PTHREAD_RWLOCK_INIT is 1 but
REPLACE_PTHREAD_RWLOCK_DESTROY is 0, override
PTHREAD_RWLOCK_INITIALIZER.
* lib/pthread-rwlock.c
(pthread_rwlockattr_init) [PTHREAD_RWLOCK_BAD_WAITQUEUE]: New function.
(pthread_rwlock_init) [PTHREAD_RWLOCK_BAD_WAITQUEUE]: New function.
* m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Check for reasonable
pthread_rwlock wait queue handling. Set REPLACE_PTHREAD_RWLOCK_INIT and
REPLACE_PTHREAD_RWLOCKATTR_INIT and define PTHREAD_RWLOCK_BAD_WAITQUEUE
if not.
* modules/pthread-rwlock (configure.ac): Update
GL_COND_OBJ_PTHREAD_RWLOCK condition.
* doc/posix-functions/pthread_rwlock_rdlock.texi: Mark the glibc problem
as fixed.
* doc/posix-functions/pthread_rwlock_tryrdlock.texi: Likewise.
* doc/posix-functions/pthread_rwlock_timedrdlock.texi: Likewise.

8 months agoerrno-tests: port to GNU/Hurd
Paul Eggert [Wed, 7 Aug 2024 14:23:51 +0000 (07:23 -0700)]
errno-tests: port to GNU/Hurd

Test for errno distinctness dynamically rather than statically,
since the static test blows up the compiler on Hurd.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-08/msg00039.html
Also, test that errno values can all be used in #if,
and improve diagnostics.
* tests/test-errno.c: Include stdio.h, stdlib.h, string.h.
(USABLE_IN_IF): New macro.  Use it to check errno values in #if.
(ERRTAB): New macro.
(struct nameval): New type.
(errtab): New global variable.
(errtab_cmp): New function.
(main): Test for errno distinctness dynamically not statically.
Diagnose lack of distinctness better.

8 months agofchmodat: Fix cross-compilation guess.
Bruno Haible [Wed, 7 Aug 2024 10:21:05 +0000 (12:21 +0200)]
fchmodat: Fix cross-compilation guess.

* m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Tolerate Linux version number
in $host_os.

8 months agowindows-mutex, windows-timedmutex: Fix mistake in last commit.
Bruno Haible [Tue, 6 Aug 2024 15:04:48 +0000 (17:04 +0200)]
windows-mutex, windows-timedmutex: Fix mistake in last commit.

* lib/windows-mutex.c (glwthread_mutex_init): Initialize the 'owner'
field.
* lib/windows-timedmutex.c (glwthread_timedmutex_init): Likewise.

8 months agodoc: Mention a macOS bug.
Bruno Haible [Tue, 6 Aug 2024 14:03:41 +0000 (16:03 +0200)]
doc: Mention a macOS bug.

* doc/posix-functions/pthread_rwlock_trywrlock.texi: Mention a macOS
bug.

8 months agomtx tests: Strengthen tests.
Bruno Haible [Tue, 6 Aug 2024 13:45:02 +0000 (15:45 +0200)]
mtx tests: Strengthen tests.

* tests/test-mtx-type.c: New file.
* modules/mtx-tests (Files): Add it.
(Makefile.am): Arrange to test test-mtx-type.

8 months agopthread-mutex tests: Strengthen tests.
Bruno Haible [Tue, 6 Aug 2024 13:43:16 +0000 (15:43 +0200)]
pthread-mutex tests: Strengthen tests.

* tests/test-pthread-mutex-type.c: New file.
* modules/pthread-mutex-tests (Files): Add it.
(Makefile.am): Arrange to test test-pthread-mutex-type.
* doc/posix-functions/pthread_mutex_lock.texi: Mention FreeBSD and
NetBSD problem.
* doc/posix-functions/pthread_mutex_trylock.texi: Likewise.

8 months agowindows-timedrecmutex: Add tests.
Bruno Haible [Tue, 6 Aug 2024 13:20:23 +0000 (15:20 +0200)]
windows-timedrecmutex: Add tests.

* tests/test-windows-timedrecmutex-type.c: New file.
* modules/windows-timedrecmutex-tests: New file.

8 months agowindows-recmutex: Add tests.
Bruno Haible [Tue, 6 Aug 2024 13:19:31 +0000 (15:19 +0200)]
windows-recmutex: Add tests.

* tests/test-windows-recmutex-type.c: New file.
* modules/windows-recmutex-tests: New file.

8 months agowindows-timedmutex: Add tests.
Bruno Haible [Tue, 6 Aug 2024 13:18:18 +0000 (15:18 +0200)]
windows-timedmutex: Add tests.

* tests/test-windows-timedmutex-type.c: New file.
* modules/windows-timedmutex-tests: New file.

8 months agowindows-mutex: Add tests.
Bruno Haible [Tue, 6 Aug 2024 13:17:03 +0000 (15:17 +0200)]
windows-mutex: Add tests.

* tests/test-windows-mutex-type.c: New file.
* modules/windows-mutex-tests: New file.

8 months agowindows-mutex, windows-timedmutex: Follow pthread_mutex_trylock spec.
Bruno Haible [Tue, 6 Aug 2024 13:14:25 +0000 (15:14 +0200)]
windows-mutex, windows-timedmutex: Follow pthread_mutex_trylock spec.

* lib/windows-mutex.h (glwthread_mutex_t): Add 'owner' field.
* lib/windows-mutex.c: Include <stdlib.h>.
(glwthread_mutex_lock): Set the 'owner' field after entering the
critical section.
(glwthread_mutex_trylock): Detect whether the lock was previously locked
by this thread. Set the 'owner' field after entering the critical
section.
(glwthread_mutex_unlock): Clear the 'owner' field before leaving the
critical section.
* lib/windows-timedmutex.h (glwthread_timedmutex_t): Add 'owner' field.
* lib/windows-timedmutex.c: (glwthread_timedmutex_lock): Set the 'owner'
field after entering the critical section.
(glwthread_timedmutex_trylock): Detect whether the lock was previously
locked by this thread. Set the 'owner' field after entering the critical
section.
(glwthread_timedmutex_unlock): Clear the 'owner' field before leaving
the critical section.

9 months agoImprove a comment.
Bruno Haible [Mon, 5 Aug 2024 23:53:10 +0000 (01:53 +0200)]
Improve a comment.

With info from Sam James <sam@gentoo.org>.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Reference the gcc bug that is
the reason for _GL_BRACKET_BEFORE_ATTRIBUTE.

9 months agomath: Fix HUGE_VAL and HUGE_VALL on AIX.
Bruno Haible [Mon, 5 Aug 2024 23:05:05 +0000 (01:05 +0200)]
math: Fix HUGE_VAL and HUGE_VALL on AIX.

* lib/math.in.h (HUGE_VAL, HUGE_VALL): Override on AIX.
* doc/posix-headers/math.texi: Mention this AIX problem.

9 months agoxstrtol, xstrtoll tests: Fix test failures.
Bruno Haible [Mon, 5 Aug 2024 19:31:28 +0000 (21:31 +0200)]
xstrtol, xstrtoll tests: Fix test failures.

* tests/test-xstrtol.c (is_GNULIB_strtol): New macro.
(main): Use it in the expected test results.
* tests/test-xstrtoll.c (is_GNULIB_strtol): New macro.

9 months agognulib-tool.py: Fix testdirs created with --without-tests.
Bruno Haible [Mon, 5 Aug 2024 18:24:44 +0000 (20:24 +0200)]
gnulib-tool.py: Fix testdirs created with --without-tests.

* pygnulib/GLTestDir.py (GLTestDir.execute): Don't assume that 'gltests'
is the last subdirectory with a configure.ac.

9 months agoFix compilation error in C++ mode with clang >= 16 (regr. 2024-07-29).
Bruno Haible [Mon, 5 Aug 2024 14:27:13 +0000 (16:27 +0200)]
Fix compilation error in C++ mode with clang >= 16 (regr. 2024-07-29).

* m4/gnulib-common.m4 (gl_COMMON_BODY): Define
_GL_BRACKET_BEFORE_ATTRIBUTE with clang++ 16 or newer.

9 months agodfa-tests: Detect test-dfa-match-aux error.
Bernhard Voelker [Sun, 4 Aug 2024 16:14:32 +0000 (18:14 +0200)]
dfa-tests: Detect test-dfa-match-aux error.

* tests/test-dfa-invalid-merge.sh: Set fail=1 if test-dfa-match-aux fails.
Remove redundant 'returns_ 0'.

9 months agotest-framework-sh: Improve returns_ example.
Bernhard Voelker [Sun, 4 Aug 2024 16:12:16 +0000 (18:12 +0200)]
test-framework-sh: Improve returns_ example.

In the shell test framework, an error is either flagged by setting
the shell variable fail=1, or by invoking the fail_ function with an
error diagnostic.

* tests/init.sh (returns_): Change example code in the comment to
use '|| fail=1' properly.

9 months agoonce: Add missing .m4 file.
Bruno Haible [Mon, 5 Aug 2024 06:03:53 +0000 (08:03 +0200)]
once: Add missing .m4 file.

Reported by Collin Funk.

* m4/once.m4: New file.

9 months agomtx-tests: Reduce dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:56:17 +0000 (23:56 +0200)]
mtx-tests: Reduce dependencies.

* tests/test-mtx.c: Don't include glthread/lock.h.
* modules/mtx-tests (Depends-on): Remove lock.

9 months agothread: Reduce dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:56:13 +0000 (23:56 +0200)]
thread: Reduce dependencies.

* lib/glthread/thread.c: Don't include glthread/lock.h.
* modules/thread (Depends-on): Remove lock.

9 months agouchar-c23: Reduce dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:56:10 +0000 (23:56 +0200)]
uchar-c23: Reduce dependencies.

* lib/lc-charset-unicode.c: Include glthread/once.h instead of
glthread/lock.h.
* modules/uchar-c23 (Depends-on): Add once. Remove lock.

9 months agostrsignal: Reduce dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:56:07 +0000 (23:56 +0200)]
strsignal: Reduce dependencies.

* lib/strsignal.c: Include glthread/once.h instead of glthread/lock.h.
* modules/strsignal (Depends-on): Add once. Remove lock.

9 months agoimmutable: Clarify dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:55:53 +0000 (23:55 +0200)]
immutable: Clarify dependencies.

* lib/immutable.c: Include glthread/once.h instead of glthread/lock.h.
* modules/immutable (Depends-on): Add once.

9 months agofstrcmp: Reduce dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:55:50 +0000 (23:55 +0200)]
fstrcmp: Reduce dependencies.

* lib/fstrcmp.c: Include glthread/once.h instead of glthread/lock.h.
* modules/fstrcmp (Depends-on): Add once. Remove lock.

9 months agolock-tests: Clarify dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:55:47 +0000 (23:55 +0200)]
lock-tests: Clarify dependencies.

* tests/test-lock.c: Include glthread/once.h.
* modules/lock-tests (Depends-on): Add once.

9 months agofatal-signal: Clarify dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:55:45 +0000 (23:55 +0200)]
fatal-signal: Clarify dependencies.

* lib/fatal-signal.c: Include glthread/once.h.
* modules/fatal-signal (Depends-on): Add once.

9 months agoclean-temp-simple: Clarify dependencies.
Bruno Haible [Sun, 4 Aug 2024 21:55:42 +0000 (23:55 +0200)]
clean-temp-simple: Clarify dependencies.

* lib/clean-temp-simple.c: Include glthread/once.h.
* modules/clean-temp-simple (Depends-on): Add once.

9 months agoonce-tests: New module, extracted from lock-tests.
Bruno Haible [Sun, 4 Aug 2024 21:55:40 +0000 (23:55 +0200)]
once-tests: New module, extracted from lock-tests.

* modules/once-tests: New file.
* modules/lock-tests (Files): Remove tests/test-once.c.
(Makefile.am): Don't build and test test-once1 and test-once2.

9 months agoonce: New module, extracted from lock.
Bruno Haible [Sun, 4 Aug 2024 21:55:37 +0000 (23:55 +0200)]
once: New module, extracted from lock.

* lib/glthread/once.h: New file, extracted from lib/glthread/lock.h.
* lib/glthread/once.c: New file, extracted from lib/glthread/lock.c.
* lib/glthread/lock.h: Include glthread/once.h. Don't include
windows-once.h.
(c11_threads_in_use, glthread_in_use, gl_once_t, gl_once_define,
glthread_once): Remove.
(glthread_once_singlethreaded, glthread_once_multithreaded): Remove
declarations.
* lib/glthread/lock.c (fresh_once, glthread_once_singlethreaded,
glthread_once_multithreaded): Remove.
* modules/once: New file.
* modules/lock (Depends-on): Add once. Remove pthread-once,
windows-once.
* tests/test-once.c: Include glthread/once.h instead of glthread/lock.h.
* doc/multithread.texi (Gnulib multithreading): Mention the module
'once'.

9 months agognulib-tool.py: Small refactoring.
Bruno Haible [Sat, 3 Aug 2024 15:04:55 +0000 (17:04 +0200)]
gnulib-tool.py: Small refactoring.

Suggested by Collin Funk.

* pygnulib/GLModuleSystem.py (GLModule.getDependenciesRecursively):
Return a set of GLModule.
* pygnulib/main.py (main): Convert the result to a string here.

9 months agognulib-tool.py: Correct type hint and doc string.
Collin Funk [Sat, 3 Aug 2024 03:52:28 +0000 (20:52 -0700)]
gnulib-tool.py: Correct type hint and doc string.

* pygnulib/GLModuleSystem.py (GLModule.getDependentsRecursively): Adjust
type hint and doc string to correctly state a set of GLModule's is
returned.

9 months agoAllow use of --avoid=extensions-aix.
Bruno Haible [Fri, 2 Aug 2024 08:57:47 +0000 (10:57 +0200)]
Allow use of --avoid=extensions-aix.

* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Don't require gl_USE_AIX_EXTENSIONS
explicitly.
* m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Likewise.
* m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Likewise.
* m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Likewise.
* m4/scandir.m4 (gl_FUNC_SCANDIR): Likewise.

9 months agomath: Fix INFINITY and NAN on FreeBSD and AIX.
Bruno Haible [Thu, 1 Aug 2024 14:41:23 +0000 (16:41 +0200)]
math: Fix INFINITY and NAN on FreeBSD and AIX.

* doc/posix-headers/math.texi: Mention some FreeBSD and AIX bugs.
* lib/math.in.h (INFINITY): New macro.
(NAN): Replace also on FreeBSD < 8 and AIX. Use __builtin_nanf where
available.
(HUGE_VALF): Replace also on FreeBSD < 6. Use __builtin_inff where
available.
(HUGE_VAL): Replace also on FreeBSD < 6. Use __builtin_inf where
available.
(HUGE_VALL): Replace also on FreeBSD < 6. Use __builtin_infl where
available.
* tests/test-math.c: Check that INFINITY, NAN, HUGE_VALF, HUGE_VAL,
HUGE_VALL are constant expressions.
(main): Check the type of INFINITY and NAN.

9 months agoEnsure consistent effects of _LINUX_SOURCE_COMPAT.
Bruno Haible [Thu, 1 Aug 2024 11:52:30 +0000 (13:52 +0200)]
Ensure consistent effects of _LINUX_SOURCE_COMPAT.

* modules/extensions (configure.ac-early): New section.
* m4/extensions-aix.m4: New file.
* modules/extensions-aix: New file.
* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Require gl_USE_AIX_EXTENSIONS,
instead of defining _LINUX_SOURCE_COMPAT at this stage.
* m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Likewise.
* m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Likewise.
* m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Likewise.
* m4/scandir.m4 (gl_FUNC_SCANDIR): Likewise.
* modules/errno (Depends-on): Add extensions-aix.
* modules/malloc-gnu (Depends-on): Likewise.
* modules/calloc-gnu (Depends-on): Likewise.
* modules/realloc-gnu (Depends-on): Likewise.
* modules/scandir (Depends-on): Likewise.

9 months agostrerror_r: Fix for AIX (regression yesterday).
Bruno Haible [Thu, 1 Aug 2024 11:24:10 +0000 (13:24 +0200)]
strerror_r: Fix for AIX (regression yesterday).

* lib/strerror_r.c: Ignore the value of STRERROR_R_CHAR_P on AIX.
* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Don't define
_LINUX_SOURCE_COMPAT, since it provides no advantage for strerror_r.

9 months agoerrno: make EEXIST != ENOTEMPTY on AIX
Paul Eggert [Thu, 1 Aug 2024 00:10:56 +0000 (17:10 -0700)]
errno: make EEXIST != ENOTEMPTY on AIX

Also, improve errno tests.
* m4/calloc.m4 (gl_FUNC_CALLOC_GNU):
* m4/malloc.m4 (gl_FUNC_MALLOC_GNU):
* m4/realloc.m4 (gl_FUNC_REALLOC_GNU):
* m4/scandir.m4 (gl_FUNC_SCANDIR):
Define _LINUX_SOURCE_COMPAT, as this can sometimes help on AIX.
* m4/errno_h.m4 (gl_HEADER_ERRNO_H):
Define _LINUX_SOURCE_COMPAT, to make EEXIST != ENOTEMPTY.
* m4/strerror_r.m4 (gl_FUNC_STRERROR_R):
Define _LINUX_SOURCE_COMPAT, in case someone else does.
* modules/errno-tests (Depends-on): Add assert-h, c99.
* tests/test-errno.c (e1, ..., e131): Remove, replacing with ...
(CHECK_POSIX_ERRNOS, POSITIVE_INTEGER_CONSTANT_EXPRESSION)
(INDEXED_BY_ERRNO, ERRNO_COUNT): These new macros.
Check that all errno values are positive integer constant expressions.
Check that they are all distinct, except perhaps for
EWOULDBLOCK == EAGAIN and ENOTSUP == EOPNOTSUPP.
Also check ESOCKTNOSUPPORT, added in POSIX.1-2024.
Also, check that errno values are distinct except when POSIX says
they needn’t be distinct, since POSIX.1-2024 gives license to
GNU/Linux’s non-distinct values.

9 months agofloat: Update to mostly guarantee ISO C 23 compliance.
Bruno Haible [Wed, 31 Jul 2024 22:46:49 +0000 (00:46 +0200)]
float: Update to mostly guarantee ISO C 23 compliance.

* doc/posix-headers/float.texi: Mention the various portability
problems.
* lib/float.in.h (FLT_HAS_SUBNORM, FLT_DECIMAL_DIG, FLT_TRUE_MIN,
DBL_HAS_SUBNORM, DBL_DECIMAL_DIG, DBL_TRUE_MIN, LDBL_HAS_SUBNORM,
LDBL_DECIMAL_DIG, LDBL_TRUE_MIN): New macros.
(gl_LDBL_TRUE_MIN): New declaration.
(FLT_IS_IEC_60559, FLT_NORM_MAX, FLT_SNAN, GNULIB_defined_FLT_SNAN,
DBL_IS_IEC_60559, DBL_NORM_MAX, DBL_SNAN, GNULIB_defined_DBL_SNAN,
LDBL_IS_IEC_60559, LDBL_NORM_MAX, LDBL_SNAN, GNULIB_defined_LDBL_SNAN):
New macros.
(gl_FLT_SNAN_t, gl_DBL_SNAN_t, gl_LDBL_SNAN_t): New types.
(gl_FLT_SNAN, gl_DBL_SNAN, gl_LDBL_SNAN): New declarations.
* lib/float.c (gl_LDBL_TRUE_MIN): New variable.
(gl_FLT_SNAN, gl_DBL_SNAN, gl_LDBL_SNAN): New variables.
* m4/float_h.m4 (gl_FLOAT_H): Add check whether float.h conforms to
ISO C23. Set REPLACE_FLOAT_SNAN.
* modules/float (configure.ac): Test also REPLACE_FLOAT_SNAN. Require
gl_BIGENDIAN.
* tests/test-float.c: Also check FLT_EVAL_METHOD, FLT_HAS_SUBNORM,
FLT_DECIMAL_DIG, FLT_IS_IEC_60559, FLT_TRUE_MIN, FLT_NORM_MAX,
DBL_HAS_SUBNORM, DBL_DECIMAL_DIG, DBL_IS_IEC_60559, DBL_TRUE_MIN,
DBL_NORM_MAX, LDBL_HAS_SUBNORM, LDBL_DECIMAL_DIG, LDBL_IS_IEC_60559.
Conditionally check LDBL_TRUE_MIN, LDBL_NORM_MAX.
Include isnanf-nolibm.h, isnand-nolibm.h, isnanl-nolibm.h.
(test_float): Check the values of FLT_HAS_SUBNORM, FLT_DECIMAL_DIG,
FLT_TRUE_MIN, FLT_IS_IEC_60559, FLT_NORM_MAX, FLT_SNAN.
(test_double): Check the values of DBL_HAS_SUBNORM, DBL_DECIMAL_DIG,
DBL_TRUE_MIN, DBL_IS_IEC_60559, DBL_NORM_MAX, DBL_SNAN.
(test_long_double): Check the values of LDBL_HAS_SUBNORM,
LDBL_DECIMAL_DIG, LDBL_TRUE_MIN, LDBL_IS_IEC_60559, LDBL_NORM_MAX,
LDBL_SNAN.
* modules/float-tests (Depends-on): Add isnanf-nolibm, isnand-nolibm,
isnanl-nolibm.

9 months agoattribute: Improve documentation.
Bruno Haible [Tue, 30 Jul 2024 20:01:27 +0000 (22:01 +0200)]
attribute: Improve documentation.

* lib/attribute.h: Clarify where to place the various attributes.

9 months agoReenable use of attributes in bracket syntax [[...]] (regr. yesterday).
Bruno Haible [Tue, 30 Jul 2024 17:22:40 +0000 (19:22 +0200)]
Reenable use of attributes in bracket syntax [[...]] (regr. yesterday).

* m4/gnulib-common.m4 (gl_COMMON_BODY): Add more comments. Don't define
_GL_BRACKET_USABLE.
* lib/c++defs.h (_GL_EXTERN_C_FUNC): New macro.
(_GL_FUNCDECL_RPL, _GL_FUNCDECL_RPL_1, _GL_FUNCDECL_SYS): Expect the
attributes in an optional 4th argument. Expand them before the return
type.
* lib/arpa_inet.in.h: Update all _GL_FUNCDECL_RPL and _GL_FUNCDECL_SYS
invocations.
* lib/dirent.in.h: Likewise.
* lib/error.in.h: Likewise.
* lib/fcntl.in.h: Likewise.
* lib/fnmatch.in.h: Likewise.
* lib/glob.in.h: Likewise.
* lib/iconv.in.h: Likewise.
* lib/inttypes.in.h: Likewise.
* lib/locale.in.h: Likewise.
* lib/malloc.in.h: Likewise.
* lib/math.in.h: Likewise.
* lib/monetary.in.h: Likewise.
* lib/netdb.in.h: Likewise.
* lib/pthread.in.h: Likewise.
* lib/search.in.h: Likewise.
* lib/signal.in.h: Likewise.
* lib/spawn.in.h: Likewise.
* lib/stdio.in.h: Likewise.
* lib/stdlib.in.h: Likewise.
* lib/string.in.h: Likewise.
* lib/sys_random.in.h: Likewise.
* lib/sys_resource.in.h: Likewise.
* lib/sys_socket.in.h: Likewise.
* lib/sys_stat.in.h: Likewise.
* lib/sys_time.in.h: Likewise.
* lib/threads.in.h: Likewise.
* lib/time.in.h: Likewise.
* lib/uchar.in.h: Likewise.
* lib/unistd.in.h: Likewise.
* lib/utime.in.h: Likewise.
* lib/wchar.in.h: Likewise.
* lib/wctype.in.h: Likewise.
* lib/c-vasprintf.h (c_aszprintf, c_vaszprintf, c_asprintf,
c_vasprintf): Move _GL_ATTRIBUTE_NODISCARD back to the beginning of the
declaration.

9 months agovaszprintf-posix tests: Fix a gcc warning.
Bruno Haible [Tue, 30 Jul 2024 01:14:00 +0000 (03:14 +0200)]
vaszprintf-posix tests: Fix a gcc warning.

* tests/test-vaszprintf-posix.c (test_function): Remove an unused
variable.

9 months agoUse attribute [[nodiscard]] wherever glibc uses __wur.
Bruno Haible [Tue, 30 Jul 2024 00:46:41 +0000 (02:46 +0200)]
Use attribute [[nodiscard]] wherever glibc uses __wur.

* lib/malloc.in.h (memalign): Mark with _GL_ATTRIBUTE_NODISCARD.
* lib/stdio.in.h (fdopen, fgets, fopen, fread, freopen, fscanf, ftell,
ftello, getdelim, getline, popen, scanf, tmpfile, vfscanf, vscanf):
Likewise.
* lib/stdlib.in.h (aligned_alloc, atoll, calloc, canonicalize_file_name,
getsubopt, malloc, mkdtemp, mkostemp, mkostemps, mkstemp, mkstemps,
posix_memalign, posix_openpt, ptsname, realloc, reallocarray, realpath,
rpmatch, secure_getenv): Likewise.
* lib/sys_random.in.h (getrandom): Likewise.
* lib/sys_stat.in.h (fchmodat): Likewise.
* lib/unistd.in.h (chown, dup, faccessat, fchdir, fchownat, ftruncate,
getcwd, getdomainname, getentropy, getgroups, lchown, link, linkat,
pipe, pipe2, pread, pwrite, read, readlink, readlinkat, sethostname,
symlink, symlinkat, truncate, ttyname_r, write): Likewise.

9 months agoAvoid g++ "warning: attributes are not permitted in this position".
Bruno Haible [Tue, 30 Jul 2024 00:02:43 +0000 (02:02 +0200)]
Avoid g++ "warning: attributes are not permitted in this position".

* m4/gnulib-common.m4 (gl_COMMON_BODY): Add more comments. Define
_GL_BRACKET_USABLE. Use it for _GL_ATTRIBUTE_DEPRECATED,
_GL_ATTRIBUTE_MAYBE_UNUSED, _GL_ATTRIBUTE_NODISCARD,
_GL_ATTRIBUTE_REPRODUCIBLE, _GL_ATTRIBUTE_UNSEQUENCED.
* lib/stdio.in.h (aszprintf, vaszprintf, asprintf, vasprintf): Move
_GL_ATTRIBUTE_NODISCARD to the same position as the other attributes.
* lib/c-vasprintf.h (c_aszprintf, c_vaszprintf, c_asprintf,
c_vasprintf): Likewise.

9 months agoAn update for clang >= 16.
Bruno Haible [Mon, 29 Jul 2024 20:20:32 +0000 (22:20 +0200)]
An update for clang >= 16.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Don't define
_GL_BRACKET_BEFORE_ATTRIBUTE with clang++ 16 or newer.

9 months agoFix misspelling of __clang_major__.
Bruno Haible [Mon, 29 Jul 2024 19:59:44 +0000 (21:59 +0200)]
Fix misspelling of __clang_major__.

* lib/cdefs.h (__THROW, __THROWNL, __NTH, __NTHNL): Fix misspelled macro
name.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Likewise.
* lib/malloc.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
* lib/stddef.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
* lib/stdio.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
* lib/stdlib.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
* lib/string.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
* lib/sys_stat.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.
* lib/wchar.in.h (_GL_ATTRIBUTE_NOTHROW): Likewise.

9 months agochdir: Fix mistake in GNULIB_POSIXCHECK.
Bruno Haible [Mon, 29 Jul 2024 18:21:06 +0000 (20:21 +0200)]
chdir: Fix mistake in GNULIB_POSIXCHECK.

* lib/unistd.in.h: Don't attach the chdir warning to the 'chown'
function.

9 months agoatoll: Fix module dependencies.
Bruno Haible [Mon, 29 Jul 2024 18:17:06 +0000 (20:17 +0200)]
atoll: Fix module dependencies.

* modules/atoll (Depends-on): Add stdlib.

9 months agovasprintf, c-vasprintf: Remind users to consider the return value.
Bruno Haible [Mon, 29 Jul 2024 15:31:13 +0000 (17:31 +0200)]
vasprintf, c-vasprintf: Remind users to consider the return value.

* lib/stdio.in.h (aszprintf, vaszprintf, asprintf, vasprintf): Mark with
_GL_ATTRIBUTE_NODISCARD.
* lib/c-vasprintf.h (c_aszprintf, c_vaszprintf, c_asprintf,
c_vasprintf): Likewise.

9 months agoxstrtol, xstrtoll tests: Avoid test failure after 2024-07-25 change.
Bruno Haible [Mon, 29 Jul 2024 14:46:02 +0000 (16:46 +0200)]
xstrtol, xstrtoll tests: Avoid test failure after 2024-07-25 change.

* tests/test-xstrtol.c (main): Update expected test results.

9 months agoxstrtol, xstrtoll tests: Avoid test failure after 2024-07-25 change.
Bruno Haible [Mon, 29 Jul 2024 12:54:18 +0000 (14:54 +0200)]
xstrtol, xstrtoll tests: Avoid test failure after 2024-07-25 change.

* tests/test-xstrtol.c (main): Update expected test results.

9 months agologp1l: Add tests.
Bruno Haible [Mon, 29 Jul 2024 11:42:05 +0000 (13:42 +0200)]
logp1l: Add tests.

* tests/test-logp1l.c: New file, based on tests/test-log1pl.c.
* modules/logp1l-tests: New file.

9 months agologp1l: New module.
Bruno Haible [Mon, 29 Jul 2024 11:38:46 +0000 (13:38 +0200)]
logp1l: New module.

* lib/math.in.h (logp1l): New declaration.
* lib/logp1l.c: New file.
* m4/logp1l.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether logp1l is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1L.
(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1L.
* modules/math (Makefile.am): Substitute GNULIB_LOGP1L, HAVE_LOGP1L.
* modules/logp1l: New file.
* doc/posix-functions/logp1l.texi: Mention the new module.

9 months agologp1f: Add tests.
Bruno Haible [Mon, 29 Jul 2024 11:19:33 +0000 (13:19 +0200)]
logp1f: Add tests.

* tests/test-logp1f.c: New file, based on tests/test-log1pf.c.
* modules/logp1f-tests: New file.

9 months agologp1f: New module.
Bruno Haible [Mon, 29 Jul 2024 11:15:23 +0000 (13:15 +0200)]
logp1f: New module.

* lib/math.in.h (logp1f): New declaration.
* lib/logp1f.c: New file.
* m4/logp1f.m4: New file.
* m4/log1p.m4 (gl_FUNC_LOG1P): Define through AC_DEFUN_ONCE.
* m4/isnand.m4 (gl_FUNC_ISNAND): Define through AC_DEFUN_ONCE.
* m4/math_h.m4 (gl_MATH_H): Test whether logp1f is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1F.
(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1F.
* modules/math (Makefile.am): Substitute GNULIB_LOGP1F, HAVE_LOGP1F.
* modules/logp1f: New file.
* doc/posix-functions/logp1f.texi: Mention the new module.

9 months agologp1: Add tests.
Bruno Haible [Mon, 29 Jul 2024 01:56:28 +0000 (03:56 +0200)]
logp1: Add tests.

* tests/test-logp1.c: New file, based on tests/test-log1p.c.
* modules/logp1-tests: New file.

9 months agologp1: New module.
Bruno Haible [Mon, 29 Jul 2024 01:24:51 +0000 (03:24 +0200)]
logp1: New module.

* lib/math.in.h (logp1): New declaration.
* lib/logp1.c: New file.
* m4/logp1.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether logp1 is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1.
(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1.
* modules/math (Makefile.am): Substitute GNULIB_LOGP1, HAVE_LOGP1.
* modules/logp1: New file.
* doc/posix-functions/logp1.texi: Mention the new module.

9 months agoMore updates regarding the 'Useable-in-testdir' sections.
Bruno Haible [Mon, 29 Jul 2024 01:35:23 +0000 (03:35 +0200)]
More updates regarding the 'Useable-in-testdir' sections.

* gnulib-tool.sh (sed_extract_prog, sed_extract_field_header): Recognize
the 'Useable-in-testdir' sections.
* modules/TEMPLATE-EXTENDED: Add a 'Useable-in-testdir' section.
* doc/gnulib.texi (Module description): Move new text.

9 months agodoc: Document the 'Useable-in-testdir' field in module descriptions.
Collin Funk [Mon, 29 Jul 2024 01:20:06 +0000 (18:20 -0700)]
doc: Document the 'Useable-in-testdir' field in module descriptions.

* doc/gnulib.texi (Module description): Add the 'Usable-in-testdir'
field.

9 months agognulib-tool.py: New options --extract-[recursive-]dependents.
Bruno Haible [Sun, 28 Jul 2024 23:26:51 +0000 (01:26 +0200)]
gnulib-tool.py: New options --extract-[recursive-]dependents.

* pygnulib/GLInfo.py (GLInfo.usage): Document --extract-dependents and
--extract-recursive-dependents options.
* pygnulib/GLModuleSystem.py (GLModule.getDependenciesRecursively): Move
method.
(getDependents, getDependentsRecursively): New methods.
* pygnulib/main.py (main): Add support for --extract-dependents and
--extract-recursive-dependents.

9 months agognulib-tool.py: Avoid adding specific modules to a testdir.
Bruno Haible [Sun, 28 Jul 2024 21:52:04 +0000 (23:52 +0200)]
gnulib-tool.py: Avoid adding specific modules to a testdir.

Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00292.html>.

* pygnulib/GLInfo.py (GLInfo.usage): Document
--extract-usability-in-testdir option.
* pygnulib/GLModuleSystem.py (GLModule.section_label_pattern): Recognize
Usable-in-testdir section.
(GLModule.getUsabilityInTestdir): New function.
* pygnulib/GLTestDir.py (GLTestDir.execute): Invoke it to filter out
modules to avoid. Warn if such a module was specified.
* pygnulib/main.py (main): Add support for
--extract-usability-in-testdir. Provide an error message for error 24.
* pygnulib/GLError.py: Likewise.
* modules/config-h (Usable-in-testdir): New section.
* modules/lib-ignore (Usable-in-testdir): New section.
* modules/mountlist (Usable-in-testdir): New section.
* modules/non-recursive-gnulib-prefix-hack (Usable-in-testdir): New
section.
* modules/timevar (Usable-in-testdir): New section.
(Files): Remove lib/timevar.def.

9 months agognulib-tool.py: Fix an exception message.
Bruno Haible [Sun, 28 Jul 2024 21:38:45 +0000 (23:38 +0200)]
gnulib-tool.py: Fix an exception message.

* pygnulib/GLModuleSystem.py (GLModuleSystem.find): Raise error 23,
not 3.
* pygnulib/GLError.py: Provide an error message for error 23.
* pygnulib/main.py: Likewise.

9 months agoautoupdate
Paul Eggert [Sun, 28 Jul 2024 20:07:43 +0000 (13:07 -0700)]
autoupdate