Bruno Haible [Mon, 3 Jun 2024 13:34:21 +0000 (15:34 +0200)]
dprintf-posix tests: Skip the memory leak test on macOS.
* tests/test-dprintf-posix2.c: Skip the test on macOS.
(main): Return a different exit code at each point. Allow 100 KB extra
memory consumption.
* tests/test-dprintf-posix2.sh: Update.
Bruno Haible [Sun, 2 Jun 2024 16:34:36 +0000 (18:34 +0200)]
isnanf, isnand, isnanl: Fix link errors on AIX 7.1 with xlc.
* lib/isnanf-nolibm.h (HAVE_ISNANF_NOLIBM): New macro.
* lib/isnand-nolibm.h (HAVE_ISNAND_NOLIBM): New macro.
* lib/isnanl-nolibm.h (HAVE_ISNANL_NOLIBM): New macro.
* lib/math.h (isnanf): Don't define via isnan if HAVE_ISNANF_NOLIBM is
defined.
(isnand): Don't define via isnan if HAVE_ISNAND_NOLIBM is defined.
(isnanl): Don't define via isnan if HAVE_ISNANL_NOLIBM is defined.
Bruno Haible [Thu, 30 May 2024 18:06:58 +0000 (20:06 +0200)]
assert-h, verify: Fix compilation error with g++ (4.8.5) -std=gnu++11.
Reported by Harmen <harmen@stoppels.ch> at
<https://savannah.gnu.org/bugs/index.php?65811>.
* lib/verify.h (static_assert): In C++ mode with g++ < 6 and
-std=gnu++11, define in a way that supports also the 1-argument
invocations and the invocations inside C++ struct and class.
Bruno Haible [Thu, 30 May 2024 08:23:22 +0000 (10:23 +0200)]
windows-once: Free allocated resources when done.
Based on an observation regarding Cygwin's pthread_once implementation
by Takashi Yano <takashi.yano@nifty.ne.jp> at
<https://cygwin.com/pipermail/cygwin/2024-January/255182.html> and
<https://cygwin.com/pipermail/cygwin-patches/2024q1/012600.html>
* lib/windows-once.h (glwthread_once_t): Change type of inited to LONG.
Add field 'num_threads'.
(GLWTHREAD_ONCE_INIT): Initialize it to zero.
* lib/windows-once.c (glwthread_once): Use InterlockedCompareExchange
instead of InterlockedIncrement. Increment num_threads while the thread
uses the lock. Let the last thread that uses the lock destroy it.
Bruno Haible [Thu, 30 May 2024 08:55:40 +0000 (10:55 +0200)]
call_once: Work around Cygwin 3.5.3 bug.
* m4/call_once.m4 (gl_FUNC_CALL_ONCE): Require AC_CANONICAL_HOST.
On Cygwin, set REPLACE_CALL_ONCE to 1.
* lib/call_once.c (call_once): On Cygwin, use a cast, to avoid a
compiler warning.
* modules/call_once (Depends-on): Add pthread-once.
* doc/posix-functions/call_once.texi: Mention the Cygwin bug.
Bruno Haible [Tue, 28 May 2024 20:35:54 +0000 (22:35 +0200)]
pthread-once: Work around Cygwin 3.5.3 bug.
* m4/pthread-once.m4 (gl_PTHREAD_ONCE): On Cygwin, set
REPLACE_PTHREAD_ONCE to 1.
* lib/pthread-once.c (pthread_once): Add an implementation for Cygwin.
* doc/posix-functions/pthread_once.texi: Mention the Cygwin bug.
Bruno Haible [Mon, 27 May 2024 21:29:36 +0000 (23:29 +0200)]
nstrftime: Make %r work on macOS, FreeBSD, native Windows.
* doc/posix-functions/strftime.texi: Mention the %r problem.
* lib/nstrftime.c (__strftime_internal): On macOS, FreeBSD, and native
Windows, for %r, use the English AM/PM format.
Bruno Haible [Mon, 27 May 2024 21:01:50 +0000 (23:01 +0200)]
nstrftime: Make %c work on native Windows.
* doc/posix-functions/strftime.texi: Mention the %c problem.
* lib/nstrftime.c: Include <locale.h>. Include hard-locale.h.
(__strftime_internal): For %c, use a subformat that contains the weekday
name (or abbrev.) and the month name (or abbrev.).
* modules/nstrftime (Depends-on): Add hard-locale.
(Link): New section.
* modules/nstrftime-tests (Makefile.am): Link test-nstrftime with
$(HARD_LOCALE_LIB).
Bruno Haible [Mon, 27 May 2024 15:42:20 +0000 (17:42 +0200)]
parse-datetime tests: Avoid failure on native Windows.
* tests/test-parse-datetime.c (SOME_TIMEPOINT): New macro.
(main): Use it. On native Windows, use Windows time zone names.
Invoke tzset() after setting TZ.
* doc/posix-functions/gmtime.texi: Mention the native Windows problem.
* doc/posix-functions/localtime.texi: Likewise.
Bruno Haible [Thu, 23 May 2024 21:46:52 +0000 (23:46 +0200)]
mbrtoc32: Work around bug in Cygwin 3.5.3.
* m4/mbrtoc32.m4 (gl_MBRTOC32_UTF8_LOCALE): New macro.
(gl_FUNC_MBRTOC32): Invoke it. If mbrtoc32 has this bug, define
MBRTOC32_MULTIBYTE_LOCALE_BUG and reset LOCALE_ZH_CN to 'none'.
* lib/mbrtoc32.c (mbrtoc32): Test MBRTOC32_MULTIBYTE_LOCALE_BUG.
* doc/posix-functions/mbrtoc32.texi: Mention the Cygwin bug.
Bruno Haible [Thu, 23 May 2024 13:15:40 +0000 (15:15 +0200)]
renameatu: Work around Cygwin 3.4.6 bug.
* m4/renameat.m4 (gl_FUNC_RENAMEAT): Test whether renameat2 works, and
define HAVE_WORKING_RENAMEAT2 if so.
* lib/renameatu.c (renameatu): Test HAVE_WORKING_RENAMEAT2 instead of
HAVE_RENAMEAT2.
Bruno Haible [Wed, 22 May 2024 23:10:18 +0000 (01:10 +0200)]
iconv: Reject the broken macOS 14.4 iconv implementation.
Reported by Daniel Collins <solemnwarning@solemnwarning.net> at
<https://savannah.gnu.org/bugs/?65686>.
* m4/iconv.m4 (AM_ICONV_LINK): In the test "for working iconv", test
against the macOS 14.4 iconv bug.
* doc/posix-functions/iconv.texi: Document the bug.
Bruno Haible [Mon, 20 May 2024 22:33:55 +0000 (00:33 +0200)]
vasnprintf: Don't abort for pseudo-denormal arguments on macOS 12.
Reported by Gaëtan Herfray <g.herfray@gahfy.io> via Erik Blake in
<https://lists.gnu.org/archive/html/bug-m4/2022-03/msg00002.html>
<https://lists.gnu.org/archive/html/bug-gnulib/2022-03/msg00066.html>.
* lib/vasnprintf.c (safe_frexpl): New function.
(decode_long_double, floorlog10l): Invoke it instead of frexpl.
Paul Eggert [Mon, 20 May 2024 21:55:11 +0000 (14:55 -0700)]
getopt-posix: port better to Alpine 3.20.0_rc1
Alpine’s <sys/cdefs.h> is a stub that issues a deprecation #warning.
* m4/getopt.m4 (gl_GETOPT_SUBSTITUTE_HEADER):
* m4/sched_h.m4 (gl_SCHED_H): Use the new macro
gl_CHECK_HEADER_SYS_CDEFS_H instead of checking independently.
* m4/sys_cdefs_h.m4: New file.
* modules/getopt-posix, modules/sched (Files): Add m4/sys_cdefs_h.m4.
Collin Funk [Mon, 20 May 2024 21:23:41 +0000 (14:23 -0700)]
utimensat, utimens: Work around NetBSD 10.0 bugs.
* lib/utimens.c (fdutimens): Work around a NetBSD 10.0 UTIME_OMIT bug in
the same way as Linux kernel 2.6.32 and Solaris 11.1.
(lutimens): Likewise.
* lib/utimensat.c (rpl_utimensat): Likewise. Workaround a NetBSD 10.0
bug where invalid tv_nsec values are not rejected in the same way as
Linux kernel 2.6.22.19 on hppa.
* doc/posix-functions/utimensat.texi: Document the invalid tv_nsec bug.
Bruno Haible [Thu, 9 May 2024 12:01:10 +0000 (14:01 +0200)]
explicit_bzero, memset_explicit tests: Avoid test failures with ASAN.
* tests/test-explicit_bzero.c (test_heap, test_stack): Define to empty
if ASAN is enabled.
* tests/test-memset_explicit.c (test_heap, test_stack): Likewise.
Bruno Haible [Thu, 9 May 2024 10:56:55 +0000 (12:56 +0200)]
dprintf-posix, fprintf-posix tests: Avoid test failures with ASAN.
* tests/test-dprintf-posix2.c (main): Skip the test if ASAN is enabled.
* tests/test-fprintf-posix3.c (main): Likewise.
* tests/test-dprintf-posix2.sh: Update.
* tests/test-fprintf-posix3.sh: Likewise.
Bruno Haible [Wed, 8 May 2024 23:41:52 +0000 (01:41 +0200)]
sigsegv, c-stack tests: Avoid test failures with ASAN.
* tests/test-sigsegv-catch-stackoverflow1.c
(HAVE_STACK_OVERFLOW_RECOVERY): Undefine if ASAN is enabled.
* tests/test-sigsegv-catch-stackoverflow2.c
(HAVE_STACK_OVERFLOW_RECOVERY): Likewise.
* tests/test-c-stack.c (main): Skip the test if ASAN is enabled.
Bruno Haible [Wed, 1 May 2024 22:10:21 +0000 (00:10 +0200)]
stddef: A better workaround against GCC bug 114870.
* lib/stddef.in.h: If STDDEF_NOT_IDEMPOTENT is 1, disable the special
invocation convention.
* m4/stddef_h.m4 (gl_STDDEF_H): Set STDDEF_NOT_IDEMPOTENT.
(gl_STDDEF_H_DEFAULTS): Initialize STDDEF_NOT_IDEMPOTENT.
* modules/stddef (Makefile.am): Substitute STDDEF_NOT_IDEMPOTENT.
Paul Eggert [Sat, 27 Apr 2024 16:09:38 +0000 (09:09 -0700)]
stddef: work around a GCC 14 stddef.h bug
* lib/stddef.in.h: (_GCC_NULLPTR_T): Define if needed to work around
GCC bug 114869.
* m4/stddef_h.m4 (gl_STDDEF_H, gl_STDDEF_H_DEFAULTS):
* modules/stddef (stddef.h):
Detect the two bugs 114869 and 114870.
Bruno Haible [Sat, 27 Apr 2024 00:22:05 +0000 (02:22 +0200)]
login_tty tests: Avoid gcc warnings.
* tests/test-login_tty.c: Include ignore-value.h.
(main): Ignore the results of the freopen calls.
* modules/login_tty-tests (Depends-on): Add ignore-value.
Paul Eggert [Wed, 24 Apr 2024 06:18:07 +0000 (23:18 -0700)]
manywarnings: update C warnings for GCC 14
Adjust for C programs compiled by GCC 14.
(A C++ expert still needs to look at manywarnings-c++.m4.)
* build-aux/gcc-warning.spec: Add warnings introduced in GCC 14.
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
Add -Wflex-array-member-not-at-end, -Wmissing-variable-declarations.
Bruno Haible [Fri, 5 Apr 2024 14:04:59 +0000 (16:04 +0200)]
roundl: Fix a link error on Linux/powerpc64le.
* m4/check-math-lib.m4 (gl_CHECK_MATH_LIB): Accept an additional TYPE
argument.
* m4/isfinite.m4 (gl_ISFINITE): Use the type 'double'.
* m4/isinf.m4 (gl_ISINF): Likewise.
* m4/round.m4 (gl_FUNC_ROUND): Likewise.
* m4/roundf.m4 (gl_FUNC_ROUNDF): Use the type 'float'.
* m4/roundl.m4 (gl_FUNC_ROUNDL): Use the type 'long double'.
quotearg: fix shell-escape quoting with single quotes
With shell-escape quoting, we misquoted strings
where the first and last characters required escaping,
while the string also contained single quotes.
* lib/quotearg.c (quotearg_buffer_restyled): Ensure that
pending_shell_escape_end is reset to the initial state
when reprocessing input due to single quotes.
Reported by Grisha Levit
* lib/renameatu.c(): Fall back to renameat() when
renameatx_np(RENAME_EXCL) returns "Function not implemented".
This issue was seen with macFUSE.
Reported at https://github.com/coreutils/coreutils/issues/79
Paul Eggert [Fri, 29 Mar 2024 22:56:45 +0000 (15:56 -0700)]
intprops: pacify GCC < 10 -Wsign-compare
Problem reported by Martin Dorey in:
https://savannah.gnu.org/bugs/index.php?65537
* lib/intprops-internal.h (_GL_INT_MULTIPLY_WRAPV):
When working around GCC bug 91450, pacify -Wsign-compare by
casting 0 to the result type.
Bruno Haible [Tue, 5 Mar 2024 16:10:38 +0000 (17:10 +0100)]
c-strtod, c-strtold: Make multithread-safe.
* lib/c-strtod.c: Include <langinfo.h>, c-ctype.h.
(decimal_point_char): New function, copied from lib/vasnprintf.c.
(C_STRTOD): On platforms that don't have STRTOD_L nor a working
uselocale(), pre-parse the number and call STRTOD after having replaced
the '.' with the locale-dependent decimal point character.
* m4/c-strtod.m4 (gl_C_STRTOD, gl_C_STRTOLD): Test for nl_langinfo().
* modules/c-strtod (Depends-on): Add c-ctype. Remove strdup-posix.
* modules/c-strtold (Depends-on): Likewise.
Bruno Haible [Wed, 14 Feb 2024 22:16:15 +0000 (23:16 +0100)]
Improve support of Citrus/FreeBSD iconv.
* lib/striconveh.c (iconveh_open): Use //TRANSLIT with all iconv
implementations that support it.
* lib/striconveha.c (mem_iconveha, str_iconveha): Likewise.
* lib/propername.c (proper_name_utf8): Likewise.
* m4/pthread_mutex_timedlock.m4 (gl_FUNC_PTHREAD_MUTEX_TIMEDLOCK): Pass
a pointer of the correct type to pthread_mutex_timedlock.
* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Pass a pointer of the correct
type to pthread_spin_init.
Bruno Haible [Tue, 6 Feb 2024 20:59:01 +0000 (21:59 +0100)]
nl_langinfo: Fix fallback list of month names (regression 2014-07-07).
* lib/nl_langinfo.c (nl_langinfo): In the implementation for native
Windows, fix the results for MON_8..MON_12, ALTMON_8..ALTMON_12,
ABMON_8..ABMON_12.
Paul Eggert [Sat, 3 Feb 2024 20:05:17 +0000 (12:05 -0800)]
ctime: fix false positive
Problem reported by Bjarni Ingi Gislason in:
https://lists.gnu.org/r/bug-gnulib/2024-02/msg00006.html
* lib/time.in.h (ctime): Do not warn about ctime portability,
as there is a more serious warning about it crashing,
and the two warning directives can cause false alarms.
Bruno Haible [Mon, 29 Jan 2024 17:26:41 +0000 (18:26 +0100)]
Port FALLTHROUGH to Mac OS X 10.9.
Report and fix by Ryan Carsten Schmidt <gnulib@ryandesign.com>
at <https://savannah.gnu.org/bugs/?63866>.
* m4/gnulib-common.m4 (gl_COMMON_BODY): For _GL_HAS_ATTRIBUTE, don't use
__has_attribute for Apple clang versions < 7000000.
* lib/cdefs.h (__glibc_has_attribute): Don't use __has_attribute for
Apple clang versions < 7000000.
Bruno Haible [Sun, 28 Jan 2024 19:23:10 +0000 (20:23 +0100)]
host-cpu-c-abi: Let gl_HOST_CPU_C_ABI_32BIT never return 'unknown'.
Reported by Mohammad-Reza Nabipoor <mnabipoor@gnu.org>.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI_32BIT): Use the list of
always-32-bit CPUs and the list of always-64-bit CPUs also when
gl_HOST_CPU_C_ABI has already been run. As a fallback, use a test of
'sizeof (void *)' to always return 'yes' or 'no', never 'unknown'.
Bruno Haible [Fri, 26 Jan 2024 00:12:08 +0000 (01:12 +0100)]
execute tests: Avoid test failure on macOS 14.
Reported by Guangyu Li <gl343@cornell.edu> in
<https://lists.gnu.org/archive/html/bug-gettext/2024-01/msg00006.html>.
* tests/test-execute-main.c (main): In the tests 17, 18, 19, 20, use the
file descriptors 15, 16 instead of 10, 11, respectively.
* tests/test-execute-child.c (main): Likewise.
Bruno Haible [Thu, 25 Jan 2024 23:55:45 +0000 (00:55 +0100)]
Resolve conflicts for functions introduced in Android API level 35.
* lib/time.in.h (timespec_getres): Consider REPLACE_TIMESPEC_GETRES.
* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIMESPEC_GETRES.
* modules/time-h (Makefile.am): Substitute REPLACE_TIMESPEC_GETRES.
* m4/timespec_getres.m4 (gl_FUNC_TIMESPEC_GETRES): Test for
timespec_getres using gl_CHECK_FUNCS_ANDROID instead of
AC_CHECK_FUNCS_ONCE. Conditionally set REPLACE_TIMESPEC_GETRES.
* modules/timespec_getres (Depends-on, configure.ac): Consider
REPLACE_TIMESPEC_GETRES.
* m4/gettime.m4 (gl_GETTIME_RES): Test for timespec_getres using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* doc/posix-functions/timespec_getres.texi: Mention the Android API
levels.
Bruno Haible [Thu, 25 Jan 2024 23:18:55 +0000 (00:18 +0100)]
Resolve conflicts for functions introduced in Android API level 34.
* m4/copy-file-range.m4 (gl_FUNC_COPY_FILE_RANGE): On platforms without
glibc, test for copy_file_range using gl_CHECK_FUNCS_ANDROID instead of
AC_CHECK_FUNCS_ONCE. Conditionally set REPLACE_COPY_FILE_RANGE.
* doc/glibc-functions/copy_file_range.texi: Mention the Android API
levels.
Bruno Haible [Thu, 25 Jan 2024 23:18:52 +0000 (00:18 +0100)]
Resolve conflicts for functions introduced in Android API level 34.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_BODY): Test for
posix_spawn_file_actions_addchdir_np and
posix_spawn_file_actions_addfchdir_np using gl_CHECK_FUNCS_ANDROID
instead of AC_CHECK_FUNCS_ONCE.
* m4/posix_spawn_faction_addchdir.m4
(gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR): Test for
posix_spawn_file_actions_addchdir_np using gl_CHECK_FUNCS_ANDROID
instead of AC_CHECK_FUNCS_ONCE.
* m4/posix_spawn_faction_addfchdir.m4
(gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR): Test for
posix_spawn_file_actions_addfchdir_np using gl_CHECK_FUNCS_ANDROID
instead of AC_CHECK_FUNCS_ONCE.
* doc/glibc-functions/posix_spawn_file_actions_addchdir_np.texi: Mention
the Android API levels.
* doc/glibc-functions/posix_spawn_file_actions_addfchdir_np.texi:
Likewise.
Bruno Haible [Thu, 25 Jan 2024 23:18:45 +0000 (00:18 +0100)]
Resolve conflicts for functions introduced in Android API level 34.
* m4/freadahead.m4 (gl_FUNC_FREADAHEAD): Test for __freadahead using
gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS_ONCE.
* lib/freadahead.h: Update comment.