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, 19 Apr 2024 11:57:14 +0000 (13:57 +0200)]
signed-nan: Don't assume that '-' works as expected on NaN values.
* lib/signed-nan.h (minus_NaNf): New function.
(positive_NaNf, negative_NaNf): Use it.
(minus_NaNd): New function.
(positive_NaNd, negative_NaNd): Use it.
(minus_NaNl): New function.
(positive_NaNl, negative_NaNl): Use it.
Bruno Haible [Fri, 19 Apr 2024 00:14:37 +0000 (02:14 +0200)]
totalorder*: Support newer MIPS CPUs.
* lib/totalorder.c (totalorder): On MIPS CPUs with MIPS_NAN2008_DOUBLE,
don't invert the most significant bit of the mantissa field.
* lib/totalorderf.c (totalorderf): On MIPS CPUs with MIPS_NAN2008_FLOAT,
don't invert the most significant bit of the mantissa field.
* lib/totalorderl.c (totalorderl): On MIPS CPUs with
MIPS_NAN2008_LONG_DOUBLE, don't invert the most significant bit of the
mantissa field.
* m4/totalorder.m4 (gl_FUNC_TOTALORDERF, gl_FUNC_TOTALORDER,
gl_FUNC_TOTALORDERL): Invoke gl_NAN_MIPS.
* modules/totalorder (Files): Add m4/nan-mips.m4.
* modules/totalorderf (Files): Likewise.
* modules/totalorderl (Files): Likewise.
Bruno Haible [Tue, 9 Apr 2024 11:08:32 +0000 (13:08 +0200)]
totalorder, totalorderf: Fix handling of SNaN on i386 and x86_64 CPUs.
* lib/totalorder.c: Include <string.h>.
(totalorder): Use memcpy to copy the 'double' values into the union.
Drop 'volatile'.
* lib/totalorderf.c: Include <string.h>.
(totalorderf): Use memcpy to copy the 'float' values into the union.
Drop 'volatile'.
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.
Bruno Haible [Fri, 19 Jan 2024 21:58:43 +0000 (22:58 +0100)]
fenv-environment: Fix for NetBSD/powerpc.
* m4/fenv-environment.m4 (gl_FENV_ENVIRONMENT): For feupdateenv, use
the same configure test on NetBSD/powerpc as on glibc/hppa.
* doc/posix-functions/feupdateenv.texi: Mention the NetBSD/powerpc bug.
Bruno Haible [Fri, 19 Jan 2024 21:34:27 +0000 (22:34 +0100)]
fenv-exceptions-state-c99: Fix for FreeBSD/powerpc64 and NetBSD/powerpc.
* m4/fenv-exceptions-state.m4 (gl_FENV_EXCEPTIONS_STATE): On
FreeBSD/powerpc64 and NetBSD/powerpc, set REPLACE_FESETEXCEPTFLAG.
* doc/posix-functions/fesetexceptflag.texi: Mention the FreeBSD and
NetBSD bug.
Bruno Haible [Fri, 19 Jan 2024 09:55:13 +0000 (10:55 +0100)]
fenv-*: Avoid test failures on OpenBSD/sparc64.
* tests/test-fenv-except-tracking-2.c (main): On OpenBSD/sparc64, skip
the 'long double' test.
* tests/test-fenv-except-trapping-2.c (main): Skip the 'long double'
tests also on OpenBSD/sparc64.
Paul Eggert [Wed, 17 Jan 2024 01:21:08 +0000 (17:21 -0800)]
posixtm: pacify clang 18
Problem reported by Khem Raj in:
https://lists.gnu.org/r/bug-gnulib/2024-01/msg00045.html
* lib/posixtm.c (posixtime): Pacify clang 18 by converting bool to int.
Arguably this is a bug in draft C2x, since the non-pointer args to
ckd_add should promote just like any other expressions do;
but that’s not clang’s fault.
Bruno Haible [Wed, 10 Jan 2024 14:26:53 +0000 (15:26 +0100)]
jit/cache: Fix for arm CPUs with GCC target arm-linux-gnueabihf.
* tests/jit/test-cache.c (CODE): Define differently on arm.
(SET_CODE, IS, SET_IS): New macros.
(main): New variables is_of_return1, is_of_return2. Use the SET_CODE and
SET_IS macros.
Bruno Haible [Tue, 9 Jan 2024 20:10:19 +0000 (21:10 +0100)]
jit/cache tests: Avoid test failure on OpenBSD.
* tests/jit/test-cache.c (return1_code, return2_code): New constants.
(main): On OpenBSD, use return1_code and return2_code instead of
CODE (return1) and CODE (return2), since the latter may not be in a
readable memory area.
Bruno Haible [Tue, 9 Jan 2024 15:56:08 +0000 (16:56 +0100)]
jit/cache tests: Avoid test failure on hppa CPUs.
* tests/jit/test-cache.c (FUNCPTR_BIAS): New macro.
(structptr_to_funcptr, funcptr_to_structptr): New functions/macros.
(xcopy_structptr): Renamed from xcopy_funcptr. Mark as inline.
(COPY_FUNCPTR, CODE): Use structptr_to_funcptr, funcptr_to_structptr.
* modules/jit/cache-tests (configure.ac): Require AC_C_INLINE.