Bruno Haible [Tue, 2 Jan 2024 10:37:05 +0000 (11:37 +0100)]
strverscmp: Work around bug in musl libc 1.2.3 and in Cygwin.
Reported by Dmitry Bogatov <KAction@gnu.org> via Simon Josefsson in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00002.html>.
* m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize REPLACE_STRVERSCMP.
* m4/strverscmp.m4 (gl_FUNC_STRVERSCMP): Test whether strverscmp works
and set REPLACE_STRVERSCMP if not.
* lib/string.in.h (strverscmp): Consider REPLACE_STRVERSCMP.
* modules/strverscmp (Depends-on, configure.ac): Likewise.
* modules/string (Makefile.am): Substitute REPLACE_STRVERSCMP.
* tests/test-strverscmp.c (main): Add test cases suggested by Dmitry
Bogatov and by Simon Josefsson.
* doc/glibc-functions/strverscmp.texi: Mention the musl and Cygwin bug.
Update version info regarding FreeBSD.
Paul Eggert [Thu, 28 Dec 2023 19:15:56 +0000 (11:15 -0800)]
stat-time: fix macOS bug with negative file times
macOS has a bug similar (but not identical) to Solaris when
file timestamps are negative: tv_nsec might go negative.
Problem reported on Darwin 8.11.0 for GNU Tar by Gordon Steemson in:
https://lists.gnu.org/r/bug-tar/2023-12/msg00001.html
This was evidently Mac OS X 10.4.11; I reproduced it on
Darwin 21.6.0 (macOS 12.5).
* lib/stat-time.h (STAT_TIMESPEC_OFFSETOF): New macro.
(stat_time_normalize): Also normalize timestamps on macOS.
* m4/fstat.m4 (gl_FUNC_FSTAT):
* m4/fstatat.m4 (gl_FUNC_FSTATAT):
* m4/lstat.m4 (gl_FUNC_LSTAT):
* m4/stat.m4 (gl_FUNC_STAT):
Also replace on macOS.
Pádraig Brady [Sun, 10 Dec 2023 14:46:58 +0000 (14:46 +0000)]
bootstrap: fix option propagation with --bootstrap-sync
* top/bootstrap: Ensure options are propagated through
upgrade_bootstrap().
* top/bootstrap-funclib.sh: Likewise.
* build-aux/bootstrap: Auto generated with `make build-aux/bootstrap`.
Fixes https://bugs.gnu.org/67731
Paul Eggert [Sat, 2 Dec 2023 06:19:22 +0000 (22:19 -0800)]
frexp: pacify clang re address-of-volatile
Problem reported by Sam James in:
https://lists.gnu.org/r/bug-gnulib/2023-12/msg00013.html
* m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Don’t try to convert
‘double volatile *’ to ‘void const *’ as the C standard
doesn’t allow accessing volatile variables through
pointer-to-nonvolatile.
* m4/frexpf.m4 (gl_FUNC_FREXPF_WORKS): Likewise.
Bruno Haible [Fri, 1 Dec 2023 18:39:26 +0000 (19:39 +0100)]
obstack: Avoid undefined behaviour.
Reported by Alexey Palienko <Alexey.Palienko@cma.se> in
<https://lists.gnu.org/archive/html/bug-m4/2023-02/msg00000.html>.
* lib/obstack.in.h: Include <stdint.h>.
(__BPTR_ALIGN): Remove macro.
(__PTR_ALIGN): For the optimized case, compute the alignment through
uintptr_t, instead of computing NULL + something.
Bruno Haible [Fri, 17 Nov 2023 11:49:40 +0000 (12:49 +0100)]
gettext: Recognize a statically built libintl on macOS and AIX.
Reported by David Edelsohn <dje.gcc@gmail.com> in
<https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636558.html>.
* m4/gettext.m4 (AM_GNU_GETTEXT): In the
"checking for GNU gettext in libintl..." test, add also the special
system library dependencies needed on macOS and AIX.
Paul Eggert [Wed, 15 Nov 2023 08:09:03 +0000 (00:09 -0800)]
striconveha: pacify gcc -Wcast-align
* lib/striconveha.c (uniconv_register_autodetect): Rewrite to
avoid the need to cast from char * to a pointer to a more strictly
aligned type. Use decls after statements to avoid some repetition.
vasnprintf: Re-enable parsing of directive with I64 (regr. 2023-03-24).
In 480a59ba60 (*printf-posix: ISO C 23: Support size specifiers 'wN' and
'wfN'., 2023-03-24), a major refactoring hides a bug in the conversion
of the code handling Windows' "%I64*" family of printf() formats:
before the refactoring, the "64" part was skipped (as desired), but
afterwards that part is not skipped and therefore the '6' is mistaken
for a conversion character. Which is invalid, of course, causing the
code to error out.
Fix this by skipping the "64" part again.
This bug was uncovered by the Git for Windows project when gettext
v0.22.3 switched to the gnulib code as work horse of the
libintl_vsnprintf() function.
* lib/printf-parse.c (PRINTF_PARSE): When parsing a size specifier
"I64", increment cp by 3, not 1.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Copyright-paperwork-exempt: Yes
Paul Eggert [Thu, 9 Nov 2023 18:50:30 +0000 (10:50 -0800)]
stdio: port better to older macOS
* lib/stdio.in.h: Do not define _POSIX_C_SOURCE on older macOS,
as it is not needed and defining it causes other problems.
Problem reported by Sevan Janiyan in:
https://mail.gnu.org/r/bug-gnulib/2023-11/msg00039.html
Bruno Haible [Thu, 9 Nov 2023 02:32:20 +0000 (03:32 +0100)]
pthread-rwlock: Port to Mac OS X 10.4.
Reported by Sevan Janiyan <venture37@geeklan.co.uk>.
* m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): On macOS, test for the
presence of PTHREAD_RWLOCK_INITIALIZER. If it is not defined, don't
attempt to use pthread_rwlock_init.
Bruno Haible [Sun, 15 Oct 2023 21:03:59 +0000 (23:03 +0200)]
pthread-spin: Fix warnings on FreeBSD 5.2.1/i386.
* lib/pthread.in.h (pthread_spinlock_t): Override if <pthread.h> defines
pthread_spinlock_t but we need to approximate spinlocks with mutexes.
* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): When the pthread_spin_*
functions are declared but don't exist, mark them as REPLACEd.
Bruno Haible [Sun, 15 Oct 2023 20:00:04 +0000 (22:00 +0200)]
pthread-spin: Fix link errors on FreeBSD 5.2.1/i386.
* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Test not only whether
<pthread.h> defines the pthread_spinlock_t type, but also whether the
function pthread_spin_init is actually defined.
Bruno Haible [Sun, 15 Oct 2023 19:57:26 +0000 (21:57 +0200)]
pthread_mutex_timedlock: Fix link errors on FreeBSD 5.2.1/i386.
* m4/pthread_mutex_timedlock.m4 (gl_FUNC_PTHREAD_MUTEX_TIMEDLOCK): Test
not only whether pthread_mutex_timedlock is declared, but also whether
it is actually defined.
Bruno Haible [Sun, 15 Oct 2023 17:10:29 +0000 (19:10 +0200)]
lock: Make Autoconf macro more robust.
* m4/pthread_rwlock_rdlock.m4 (gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER):
Require gl_THREADLIB, not gl_THREADLIB_EARLY. Needed to get the value of
LIBMULTITHREAD.
Bruno Haible [Sun, 8 Oct 2023 07:59:03 +0000 (09:59 +0200)]
isfinite: Work around a bug with 'long double' in glibc 2.5/ia64.
* m4/isfinite.m4 (gl_ISFINITEL_WORKS): Require
gl_LONG_DOUBLE_EXPONENT_LOCATION. Test also another NaN value.
* modules/isfinite (Files): Add m4/exponentl.m4.
* doc/posix-functions/isfinite.texi: Mention also a 'long double'
problem on ia64.
Bruno Haible [Tue, 3 Oct 2023 08:51:06 +0000 (10:51 +0200)]
string-c++-tests, uchar-c++-tests: Fix link errors on Mac OS X.
* modules/string-c++-tests (Makefile.am): Link test-string-c++ with
$(LIBC32CONV).
* modules/uchar-c++-tests (Makefile.am): Link test-uchar-c++ with
$(LIBC32CONV).
gnu-web-doc-update: fix updating of manual directory
* build-aux/gnu-web-doc-update: Correctly change to the 'manual' directory,
since $tmp is a relative path. This avoids removing files
outside of the 'manual' directory. Broken since commit e979787d.
Bruno Haible [Thu, 7 Sep 2023 14:21:25 +0000 (16:21 +0200)]
c-*snprintf: Fix some clang -Wmissing-prototypes warnings.
* lib/c-snprintf.c: Include c-snprintf.h instead of <stdio.h>.
* lib/c-vsnprintf.c: Include c-vsnprintf.h instead of <stdio.h>.
* lib/c-vasnprintf.c: Include c-vasnprintf.h.
Bruno Haible [Mon, 4 Sep 2023 19:54:09 +0000 (21:54 +0200)]
Use statement-expressions without warnings, even in strict ISO C mode.
Suggested by Eric Blake <eblake@redhat.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-09/msg00025.html>.
* lib/error.in.h (__gl_error_call): Use the variant with obvious control
flow also with clang. Use '__extension__' to avoid -Wpedantic warnings.
* lib/math.in.h (gl_signbitf, gl_signbitd, gl_signbitl): Define as
macros even when __STRICT_ANSI__ is defined. But use '__extension__' to
avoid -Wpedantic warnings.
* lib/setenv.c (KNOWN_VALUE): Use '__extension__' to avoid -Wpedantic
warnings.
* lib/xalloc-oversized.h (xalloc_oversized): Use optimized variant even
when __STRICT_ANSI__ is defined. But use '__extension__' to avoid
-Wpedantic warnings.
Paul Eggert [Wed, 30 Aug 2023 17:15:09 +0000 (10:15 -0700)]
wchar-single: fix module broken since 2021
Adjust to 2021-03-07 change “Rename GNULIB_WCHAR_SINGLE to
GNULIB_WCHAR_SINGLE_LOCALE”. Apparently nobody noticed that
the module was broken. Perhaps we should obsolete the module?
* modules/wchar-single (GNULIB_WCHAR_SINGLE_LOCALE): Define.
Bruno Haible [Sat, 26 Aug 2023 20:45:17 +0000 (22:45 +0200)]
crypto/{sha*,md5,sm3}-buffer: Ignore too old OpenSSL versions.
* lib/sha1.h: If <openssl/macros.h> would give a compile-time error,
undefine HAVE_OPENSSL_SHA1.
* lib/sha256.h: If <openssl/macros.h> would give a compile-time error,
undefine HAVE_OPENSSL_SHA256.
* lib/sha512.h: If <openssl/macros.h> would give a compile-time error,
undefine HAVE_OPENSSL_SHA512.
* lib/md5.h: If <openssl/macros.h> would give a compile-time error,
undefine HAVE_OPENSSL_MD5.
* lib/sm3.h: If <openssl/macros.h> would give a compile-time error,
undefine HAVE_OPENSSL_SM3.
Bruno Haible [Mon, 21 Aug 2023 15:23:41 +0000 (17:23 +0200)]
alignasof, stdalign: Fix a compilation error in C++ mode on FreeBSD 12.
* m4/stdalign.m4 (gl_ALIGNASOF): In C++ mode, prefer __builtin_offsetof
over offsetof when possible, since __builtin_offsetof works also when
<stddef.h> has not been fully included yet.
Bruno Haible [Mon, 21 Aug 2023 13:58:16 +0000 (15:58 +0200)]
wcsstr-simple: Relicense under LGPLv2+.
* modules/wcsstr-simple (License): Change to LGPLv2+.
* lib/wcsstr.c: Update license notice.
* lib/wcsstr-impl.h: Update license notice. The code added here on
2023-03-27 was under LGPLv2+.
Bruno Haible [Sun, 20 Aug 2023 00:43:01 +0000 (02:43 +0200)]
ldexp: Work around OpenBSD/mips64 bug.
* lib/math.in.h (ldexp): New declaration.
* lib/ldexp.c: New file, based on lib/ldexpl.c.
* lib/ldexpl.c: Moved the implementation to lib/ldexp.c. Just include
it.
* m4/math_h.m4 (gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LDEXP.
(gl_MATH_H_DEFAULTS): Initialize REPLACE_LDEXP.
* m4/ldexp.m4 (gl_FUNC_LDEXP): Require gl_MATH_H_DEFAULTS and
gl_FUNC_ISNAND. Invoke gl_FUNC_LDEXP_WORKS. Set REPLACE_LDEXP. Consider
it when setting LDEXP_LIBM.
(gl_FUNC_LDEXP_WORKS): New macro.
* modules/math (Makefile.am): Substitute GNULIB_LDEXP, REPLACE_LDEXP.
* modules/ldexp (Files): Add lib/ldexp.c.
(Depends-on): Add math, isnand.
(configure.ac): Set GL_COND_OBJ_LDEXP. Invoke gl_MATH_MODULE_INDICATOR.
(Makefile.am): Conditionally compile ldexp.c.
* modules/ldexpl (Files): Add lib/ldexp.c.
* doc/posix-functions/ldexp.texi: Mention the OpenBSD bug.
Bruno Haible [Sat, 19 Aug 2023 22:45:05 +0000 (00:45 +0200)]
logbl: Work around endless loop on OpenBSD 7.3/mips64.
* m4/logbl.m4 (gl_FUNC_LOGBL_WORKS): Terminate the test program if it
takes longer than 5 seconds.
* doc/posix-functions/logbl.texi: Mention the OpenBSD bug.
Bruno Haible [Fri, 18 Aug 2023 20:38:04 +0000 (22:38 +0200)]
thrd: Work around thrd_join bug on AIX 7.3.1.
* m4/threads_h.m4 (gl_THREADS_H): Test against AIX 7 thrd_join bug. Set
BROKEN_THRD_JOIN.
(gl_THREADS_H_DEFAULTS): Initialize BROKEN_THRD_JOIN.
* m4/thrd.m4 (gl_FUNC_THRD_JOIN): Set REPLACE_THRD_* to 1 also if
BROKEN_THRD_JOIN is 1. Define BROKEN_THRD_START_T_OR_JOIN instead of
BROKEN_THRD_START_T.
* modules/threads-h (Makefile.am): Substitute BROKEN_THRD_JOIN.
* lib/threads.in.h (rpl_thrd_t, thrd_t): Define also if BROKEN_THRD_JOIN
is 1.
* lib/thrd.c: Test BROKEN_THRD_START_T_OR_JOIN instead of
BROKEN_THRD_START_T.
* doc/posix-functions/thrd_join.texi: Update.
* doc/posix-functions/thrd_exit.texi: Likewise.
Bruno Haible [Fri, 18 Aug 2023 19:14:40 +0000 (21:14 +0200)]
thrd: Refactor.
* m4/thrd.m4 (gl_FUNC_THRD_JOIN): Define BROKEN_THRD_JOIN_NULL, not
BROKEN_THRD_JOIN. Rename gl_cv_func_thrd_join_works to
gl_cv_func_thrd_join_null_works.
* lib/thrd.c: Test BROKEN_THRD_JOIN_NULL instead of BROKEN_THRD_JOIN.
Bruno Haible [Fri, 18 Aug 2023 16:54:28 +0000 (18:54 +0200)]
aligned_alloc: Fix test failure on AIX 7.3 with ibm-clang.
* m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Use 'volatile', to
disable optimization of ibm-clang -O2.
* doc/posix-functions/aligned_alloc.texi: Update version info.
Bruno Haible [Thu, 3 Aug 2023 16:09:29 +0000 (18:09 +0200)]
alignasof, stdalign: Avoid some -Wundef warnings from config.h.
Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00012.html>.
* m4/stdalign.m4 (gl_ALIGNASOF): Test whether __cplusplus is defined
before evaluating it. Assume HAVE_STDALIGN_H, _GL_STDALIGN_NEEDS_STDDEF
are never defined to 0.
* lib/readutmp.h (extract_trimmed_name): Add specification comment.
(read_utmp): Move specification comment from lib/readutmp.c to here.
Mention also UTMP_FILE and READ_UTMP_USER_PROCESS.
* lib/readutmp.c (extract_trimmed_name): Fix comment.
* modules/readutmp (Include): Only include the .h file if
HAVE_UTMPX_H || HAVE_UTMP_H.