]> Savannah Git Hosting - gnulib.git/log
gnulib.git
15 months agofenv-rounding: Avoid a test failure on OpenBSD/arm64.
Bruno Haible [Thu, 18 Jan 2024 23:54:13 +0000 (00:54 +0100)]
fenv-rounding: Avoid a test failure on OpenBSD/arm64.

* tests/test-fenv-round.c (test_towardzero, test_upward, test_downward):
Skip the 'long double' tests on OpenBSD/arm64.
* doc/posix-functions/fesetround.texi: Update platforms list.

15 months agoAvoid test failures in FreeBSD's GB18030 locale.
Bruno Haible [Thu, 18 Jan 2024 21:17:07 +0000 (22:17 +0100)]
Avoid test failures in FreeBSD's GB18030 locale.

The FreeBSD 14.0 iconv converter (GB18030 → UTF-8) cannot convert e.g.
0x94 0x32 0xBB 0x34 to U+1D100.

* tests/test-c32isalnum.c (main): Skip the GB18030 locale tests on
FreeBSD, if GL_CHAR32_T_IS_UNICODE (or, equivalently,
GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION) is defined.
* tests/test-c32isalpha.c (main): Likewise.
* tests/test-c32isblank.c (main): Likewise.
* tests/test-c32iscntrl.c (main): Likewise.
* tests/test-c32isdigit.c (main): Likewise.
* tests/test-c32islower.c (main): Likewise.
* tests/test-c32ispunct.c (main): Likewise.
* tests/test-c32isspace.c (main): Likewise.
* tests/test-c32isupper.c (main): Likewise.
* tests/test-c32isxdigit.c (main): Likewise.
* tests/test-c32rtomb.c (main): Likewise.
* tests/test-c32snrtombs.c (main): Likewise.
* tests/test-c32srtombs.c (main): Likewise.
* tests/test-c32stombs.c (main): Likewise.
* tests/test-c32tolower.c (main): Likewise.
* tests/test-c32toupper.c (main): Likewise.
* tests/test-mbrtoc16.c (main): Likewise.
* tests/test-mbrtoc32.c (main): Likewise.
* tests/test-mbsnrtoc32s.c (main): Likewise.
* tests/test-mbsrtoc32s.c (main): Likewise.
* tests/test-mbstoc32s.c (main): Likewise.

15 months agoget-rusage-data: Avoid test failure on NetBSD 9.3.
Bruno Haible [Thu, 18 Jan 2024 18:59:34 +0000 (19:59 +0100)]
get-rusage-data: Avoid test failure on NetBSD 9.3.

* tests/test-get-rusage-data.c (main): Don't expect a strict increase on
NetBSD systems.

15 months agolog10l: Work around bug on NetBSD 9.3/arm64.
Bruno Haible [Thu, 18 Jan 2024 18:46:53 +0000 (19:46 +0100)]
log10l: Work around bug on NetBSD 9.3/arm64.

* m4/log10l.m4 (gl_FUNC_LOG10L_WORKS): Add another test case, taken from
the unit test.

15 months agodoc: Update regarding <math.h> *l functions on NetBSD 9.3.
Bruno Haible [Thu, 18 Jan 2024 15:29:21 +0000 (16:29 +0100)]
doc: Update regarding <math.h> *l functions on NetBSD 9.3.

* doc/posix-functions/acoshl.texi: Mention the buggy implementation on
NetBSD.
* doc/posix-functions/acosl.texi: Likewise.
* doc/posix-functions/asinhl.texi: Likewise.
* doc/posix-functions/asinl.texi: Likewise.
* doc/posix-functions/atan2l.texi: Likewise.
* doc/posix-functions/atanhl.texi: Likewise.
* doc/posix-functions/atanl.texi: Likewise.
* doc/posix-functions/coshl.texi: Likewise.
* doc/posix-functions/cosl.texi: Likewise.
* doc/posix-functions/erfcl.texi: Likewise.
* doc/posix-functions/erfl.texi: Likewise.
* doc/posix-functions/powl.texi: Likewise.
* doc/posix-functions/sinhl.texi: Likewise.
* doc/posix-functions/sinl.texi: Likewise.
* doc/posix-functions/tanhl.texi: Likewise.
* doc/posix-functions/tanl.texi: Likewise.
* doc/posix-functions/expl.texi: Update NetBSD version info.
* doc/posix-functions/exp2l.texi: Likewise.
* doc/posix-functions/hypotl.texi: Likewise.
* doc/posix-functions/logl.texi: Likewise.
* doc/posix-functions/log10l.texi: Likewise.
* m4/expl.m4 (gl_FUNC_EXPL): Update comments.
* m4/exp2l.m4 (gl_FUNC_EXP2L): Likewise.
* m4/hypotl.m4 (gl_FUNC_HYPOTL_WORKS): Likewise.
* m4/logl.m4 (gl_FUNC_LOGL_WORKS): Likewise.
* m4/log10l.m4 (gl_FUNC_LOG10L_WORKS): Likewise.

15 months agomodfl: Work around bug on NetBSD 9.3/arm64.
Bruno Haible [Thu, 18 Jan 2024 14:41:39 +0000 (15:41 +0100)]
modfl: Work around bug on NetBSD 9.3/arm64.

* m4/modfl.m4 (gl_FUNC_MODFL): Add test whether modfl basically works.
* doc/posix-functions/modfl.texi: Mention the NetBSD bug.

15 months agoisnanl: Avoid autoconf warning.
Bruno Haible [Thu, 18 Jan 2024 14:15:43 +0000 (15:15 +0100)]
isnanl: Avoid autoconf warning.

* m4/isnanl.m4 (gl_FUNC_ISNANL): Declare through AC_DEFUN_ONCE.

15 months agofmaf, fma, fmal: Work around bugs on OpenBSD 7.4/arm64.
Bruno Haible [Thu, 18 Jan 2024 13:55:25 +0000 (14:55 +0100)]
fmaf, fma, fmal: Work around bugs on OpenBSD 7.4/arm64.

* m4/fmaf.m4 (gl_FUNC_FMAF_WORKS): Use a volatile function pointer
variable to disable clang's inlining.
* m4/fma.m4 (gl_FUNC_FMA_WORKS): Likewise.
* m4/fmal.m4 (gl_FUNC_FMAL_WORKS): Likewise.
* doc/posix-functions/fmaf.texi: Mention the OpenBSD bug.
* doc/posix-functions/fma.texi: Likewise.
* doc/posix-functions/fmal.texi: Likewise.

15 months agodoc: Update regarding stable branches.
Bruno Haible [Thu, 18 Jan 2024 08:56:44 +0000 (09:56 +0100)]
doc: Update regarding stable branches.

* doc/gnulib-readme.texi (Stable Branches): Mention new branch
stable-202401. Mention that stable-202301 is no longer updated.

15 months agogetopt-gnu: Fix out-of-bounds access (regression 2023-12-11).
Bruno Haible [Thu, 18 Jan 2024 00:12:20 +0000 (01:12 +0100)]
getopt-gnu: Fix out-of-bounds access (regression 2023-12-11).

* lib/getopt.c (process_long_option): Don't set ambig_set[option_index]
if ambig_set is &ambig_fallback.

15 months agoImprove naming of local variables.
Bruno Haible [Wed, 17 Jan 2024 20:53:15 +0000 (21:53 +0100)]
Improve naming of local variables.

* gnulib-tool, posix-modules, build-aux/relocatable.sh.in,
build-aux/reloc-ldflags, build-aux/install-reloc, tests/init.sh,
m4/argz.m4: Rename save_IFS to saved_IFS.
* m4/*.m4: Rename save_LIBS to saved_LIBS.
* m4/00gnulib.m4, m4/gnulib-common.m4, m4/warn-on-use.m4, m4/wchar_h.m4:
Rename save_ac_compile to saved_ac_compile.
* m4/00gnulib.m4: Rename ac_save_ac_compile to ac_saved_ac_compile.
* m4/gnulib-common.m4: Rename save_ac_compile_for_check_decl to
saved_ac_compile_for_check_decl.
* m4/assert_h.m4, m4/manywarnings.m4, m4/stdalign.m4, m4/visibility.m4:
Rename gl_save_CFLAGS to gl_saved_CFLAGS.
* m4/dirfd.m4: Rename dirfd_save_CFLAGS to gl_saved_CFLAGS.
* m4/include_next.m4, m4/pread.m4, m4/pwrite.m4, m4/termcap.m4,
m4/terminfo.m4: Rename gl_save_CPPFLAGS to gl_saved_CPPFLAGS.
* m4/lib-link.m4: Rename ac_save_CPPFLAGS to acl_save_CPPFLAGS.
* m4/iconv.m4, m4/readline.m4: Rename am_save_CPPFLAGS to
gl_saved_CPPFLAGS.
* m4/gettext.m4: Rename gt_save_CPPFLAGS to gt_saved_CPPFLAGS.
* m4/ansi-c++.m4: Rename gl_save_CXX to gl_saved_CXX.
* m4/manywarnings-c++.m4: Rename gl_save_CXXFLAGS to gl_saved_CXXFLAGS.
* m4/lib-link.m4: Rename acl_save_ifs to acl_saved_IFS.
* m4/lib-prefix.m4: Rename acl_save_IFS to acl_saved_IFS.
* m4/progtest.m4: Rename ac_save_IFS to gt_saved_IFS.
* m4/lib-link.m4: Rename save_libdir to saved_libdir, acl_save_libdir to
acl_saved_libdir.
* m4/ld-version-script.m4: Rename save_LDFLAGS to saved_LDFLAGS.
* m4/acl.m4, m4/getgroups.m4: Rename ac_save_LIBS to gl_saved_LIBS.
* m4/lib-link.m4: Rename ac_save_LIBS to acl_saved_LIBS.
* m4/getdomainname.m4, m4/gethostname.m4, m4/getloadavg.m4,
m4/hostent.m4, m4/inet_ntop.m4, m4/inet_pton.m4,
m4/pthread_mutex_timedlock.m4, m4/pthread_sigmask.m4,
m4/pthread-spin.m4, m4/readutmp.m4, m4/selinux-selinux-h.m4,
m4/servent.m4, m4/socketlib.m4, m4/termcap.m4, m4/terminfo.m4,
m4/thread.m4: Rename gl_save_LIBS to gl_saved_LIBS.
* m4/getaddrinfo.m4, m4/iconv.m4, m4/readline.m4: Rename am_save_LIBS to
gl_saved_LIBS.
* m4/gettext.m4, m4/intlmacosx.m4: Rename gt_save_LIBS to gt_saved_LIBS.
* m4/libunistring.m4: Rename glus_save_LIBS to glus_saved_LIBS.
* m4/nanosleep.m4: Rename nanosleep_save_libs to gl_saved_LIBS.
* m4/lib-prefix.m4: Rename acl_save_prefix to acl_saved_prefix,
acl_save_exec_prefix to acl_saved_exec_prefix.
* m4/configmake.m4: Rename gl_save_<variable> to gl_saved_<variable>.
* m4/terminfo.m4: Likewise.
* m4/gettext.m4: Rename gt_save_<variable> to gt_saved_<variable>.
* m4/javaexec.m4: Rename save_CLASSPATH to gt_saved_CLASSPATH.
* m4/warnings.m4: Rename gl_save_compiler_FLAGS to
gl_saved_compiler_FLAGS.
* lib/pread.c, lib/pwrite.c, lib/read-file.c, lib/tempname.c: Rename
save_errno to saved_errno.
* lib/read-file.c: Rename save_alloc to saved_alloc.
* lib/strptime.c: Rename save_wday to saved_wday, save_mday to
saved_mday, save_mon to saved_mon.

15 months agoposixtm: pacify clang 18
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.

15 months agoupdate-copyright: handle more cases
Jim Meyering [Mon, 15 Jan 2024 18:36:34 +0000 (10:36 -0800)]
update-copyright: handle more cases

* build-aux/update-copyright: Handle cases like gunzip.in
with its two copyright lines.
Making it work required two changes: don't stop upon first match.
And then, when continuing, a little trickiness: knowing that the
final substitution would reset m{}g's "pos()", so save and restore
that, to avoid an infinite loop in some cases.
* tests/test-update-copyright.sh: Add a test for this.

15 months agotest-framework-sh: fix spelling typo
Paul Eggert [Mon, 15 Jan 2024 16:36:51 +0000 (08:36 -0800)]
test-framework-sh: fix spelling typo

* tests/init.sh (setup_): Name local var consistently with
elsewhere in Gnulib, fixing a typo.

15 months agoautoupdate
Karl Berry [Mon, 15 Jan 2024 15:11:14 +0000 (07:11 -0800)]
autoupdate

15 months agotest-framework-sh: Improve portability to native Windows and OS/2.
Bruno Haible [Mon, 15 Jan 2024 15:05:00 +0000 (16:05 +0100)]
test-framework-sh: Improve portability to native Windows and OS/2.

Reported by KO Myung-Hun <komh78@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00037.html>.

* tests/init.sh (setup_): Test for an absolute directory name like
Autoconf does.

15 months agotest-framework-sh: Improve portability to native Windows and OS/2.
Bruno Haible [Mon, 15 Jan 2024 14:56:40 +0000 (15:56 +0100)]
test-framework-sh: Improve portability to native Windows and OS/2.

Reported by KO Myung-Hun <komh78@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00037.html>.

* tests/init.sh (setup_): In new_PATH, use $PATH_SEPARATOR instead of
':'.

15 months agotest-framework-sh: Improve portability to native Windows and OS/2.
Bruno Haible [Mon, 15 Jan 2024 14:50:52 +0000 (15:50 +0100)]
test-framework-sh: Improve portability to native Windows and OS/2.

Reported by KO Myung-Hun <komh78@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00037.html>.

* tests/init.sh (setup_): Set IFS, like in Autoconf's _AS_PATH_WALK and
in build-aux/relocatable.sh.in.

15 months agojit/cache tests: Fix link error.
Bruno Haible [Fri, 12 Jan 2024 13:35:33 +0000 (14:35 +0100)]
jit/cache tests: Fix link error.

* modules/jit/cache-tests (Makefile.am): Link test-cache with
$(LIBINTL).

15 months agoqsort_r: Fix compilation error in C++ mode on FreeBSD 14.0/powerpc64.
Bruno Haible [Fri, 12 Jan 2024 06:44:59 +0000 (07:44 +0100)]
qsort_r: Fix compilation error in C++ mode on FreeBSD 14.0/powerpc64.

* lib/stdlib.in.h (qsort_r): Enable the C++ alias warning only on glibc
systems.

15 months agotime: Fix test failure on FreeBSD 12.2/sparc64.
Bruno Haible [Thu, 11 Jan 2024 12:50:04 +0000 (13:50 +0100)]
time: Fix test failure on FreeBSD 12.2/sparc64.

* m4/time.m4 (gl_FUNC_TIME): Guess that it does not work on
FreeBSD/sparc.
* doc/posix-functions/time.texi: Mention the bug on FreeBSD/sparc.

15 months agognulib-tool: Reject broken 'join' program as seen in macOS, FreeBSD etc.
Bruno Haible [Thu, 11 Jan 2024 11:25:35 +0000 (12:25 +0100)]
gnulib-tool: Reject broken 'join' program as seen in macOS, FreeBSD etc.

Reported by Avinash Sonawane <rootkea@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00028.html>.

* gnulib-tool: Move the func_gnulib_dir and func_tmpdir invocations
ahead. If the 'join' program exists but does not handle missing fields,
bail out.

15 months agojit/cache tests: Fix for powerpc64le CPUs.
Bruno Haible [Wed, 10 Jan 2024 16:26:57 +0000 (17:26 +0100)]
jit/cache tests: Fix for powerpc64le CPUs.

* tests/jit/test-cache.c: Treat Linux/powerpc64le *not* like AIX.

15 months agojit/cache tests: Avoid gcc -Wstrict-aliasing warning on Linux/powerpc64.
Bruno Haible [Wed, 10 Jan 2024 15:46:48 +0000 (16:46 +0100)]
jit/cache tests: Avoid gcc -Wstrict-aliasing warning on Linux/powerpc64.

* tests/jit/test-cache.c (funcptr_to_structptr): Turn into an inline
function.

15 months agojit/cache tests: Fix for arm CPUs with GCC target arm-linux-gnueabihf.
Bruno Haible [Wed, 10 Jan 2024 15:23:23 +0000 (16:23 +0100)]
jit/cache tests: Fix for arm CPUs with GCC target arm-linux-gnueabihf.

15 months agojit/cache: Fix for arm CPUs with GCC target arm-linux-gnueabihf.
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.

15 months agojit/cache tests: Avoid compiler warnings on OpenBSD.
Bruno Haible [Wed, 10 Jan 2024 13:22:44 +0000 (14:22 +0100)]
jit/cache tests: Avoid compiler warnings on OpenBSD.

* tests/jit/test-cache.c (main): New variables size_of_return1,
size_of_return2.

15 months agojit/cache: Fix for ia64 CPUs.
Bruno Haible [Tue, 9 Jan 2024 21:55:26 +0000 (22:55 +0100)]
jit/cache: Fix for ia64 CPUs.

* lib/jit/cache.h (clear_cache): On ia64 CPUs, use the 'fc', 'sync',
'srlz' instructions.

15 months agojit/cache: Fix for hppa CPUs.
Bruno Haible [Tue, 9 Jan 2024 21:12:11 +0000 (22:12 +0100)]
jit/cache: Fix for hppa CPUs.

* lib/jit/cache.h (clear_cache): On hppa CPUs, use the 'fdc' and 'fic'
instructions.

15 months agojit/cache tests: Avoid test failure on OpenBSD.
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.

15 months agojit/cache tests: Avoid test failure on hppa CPUs.
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.

15 months agojit/cache tests: Fix for powerpc*, ia64, hppa* CPUs, part 2.
Bruno Haible [Mon, 8 Jan 2024 22:02:04 +0000 (23:02 +0100)]
jit/cache tests: Fix for powerpc*, ia64, hppa* CPUs, part 2.

* tests/jit/test-cache.c (CODE): Fix mistake in last commit.

15 months agojit/cache tests: Fix for powerpc*, ia64, hppa* CPUs.
Bruno Haible [Mon, 8 Jan 2024 21:48:46 +0000 (22:48 +0100)]
jit/cache tests: Fix for powerpc*, ia64, hppa* CPUs.

* modules/jit/cache-tests (Depends-on): Add xalloc.
* tests/jit/test-cache.c: Include xalloc.h.
(FUNCPTR_POINTS_TO_CODE, COPY_FUNCPTR): New macros.
(xcopy_funcptr): New function.
(main): Create a copy of the function pointer return1, so as not to
destructively modify return1. Fix memcpy argument.

15 months agojit/cache tests: Port to native Windows.
Bruno Haible [Mon, 8 Jan 2024 17:45:20 +0000 (18:45 +0100)]
jit/cache tests: Port to native Windows.

* tests/jit/test-cache.c (main): On native Windows, use VirtualAlloc
instead of mmap.

15 months agojit/cache tests: Avoid test failure on OpenBSD.
Bruno Haible [Mon, 8 Jan 2024 17:10:28 +0000 (18:10 +0100)]
jit/cache tests: Avoid test failure on OpenBSD.

* modules/jit/cache-tests (Files): Add m4/warnings.m4.
(configure.ac): Set and substitute DISABLE_OPENBSD_RETGUARD.
(Makefile.am): Set test_cache_CFLAGS.
* tests/jit/test-cache.c (main): If the compiler defines _RET_PROTECTOR,
skip the test.

15 months agojit/cache tests: Avoid test failure on CentOS, *BSD, macOS.
Bruno Haible [Mon, 8 Jan 2024 16:15:35 +0000 (17:15 +0100)]
jit/cache tests: Avoid test failure on CentOS, *BSD, macOS.

* tests/jit/test-cache.c: Include <fcntl.h>, <stdio.h>, <stdlib.h>.
Don't include pagealign_alloc.h. Include clean-temp-simple.h. Don't test
HAVE_MPROTECT.
(struct func): Fix #if conditions.
(main): Don't invoke pagealign_xalloc and mprotect. Instead, invoke mmap,
using a temporary file if needed.
* modules/jit/cache-tests (Files): Add m4/mmap-anon.m4.
(Depends-on): Add clean-temp-simple. Remove pagealign_alloc.
(configure.ac): Invoke gl_FUNC_MMAP_ANON. Don't test for mprotect.

15 months agodoc: adjust to texinfo 7.1
Paul Eggert [Mon, 8 Jan 2024 00:54:12 +0000 (16:54 -0800)]
doc: adjust to texinfo 7.1

* doc/Makefile (MAKEINFO): Adjust to texinfo 7.1, where makeinfo
by default outputs ASCII approximations to characters.

15 months ago* build-aux/update-copyright: Fix grammar in comment (taken from Emacs).
Paul Eggert [Sun, 7 Jan 2024 04:03:36 +0000 (20:03 -0800)]
* build-aux/update-copyright: Fix grammar in comment (taken from Emacs).

15 months ago* build-aux/gitlog-to-changelog: Fix grammar in comment (taken from Emacs source).
Paul Eggert [Sun, 7 Jan 2024 03:49:32 +0000 (19:49 -0800)]
* build-aux/gitlog-to-changelog: Fix grammar in comment (taken from Emacs source).

15 months agoautoupdate
Paul Eggert [Sun, 7 Jan 2024 00:14:30 +0000 (16:14 -0800)]
autoupdate

15 months ago* tests/test-update-copyright.sh: Fix "is is" typo (thanks to Eric Blake).
Paul Eggert [Sun, 7 Jan 2024 00:03:15 +0000 (16:03 -0800)]
* tests/test-update-copyright.sh: Fix "is is" typo (thanks to Eric Blake).

15 months agoautoupdate
Karl Berry [Sat, 6 Jan 2024 16:04:45 +0000 (08:04 -0800)]
autoupdate

16 months ago* ChangeLog: Fix macOS version typo.
Paul Eggert [Tue, 2 Jan 2024 17:19:44 +0000 (09:19 -0800)]
* ChangeLog: Fix macOS version typo.

16 months agoautoupdate
Karl Berry [Tue, 2 Jan 2024 16:02:43 +0000 (08:02 -0800)]
autoupdate

16 months agostrverscmp: Work around bug in musl libc 1.2.3 and in Cygwin.
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.

16 months agoupdate-copyright-tests: immunize against self
Paul Eggert [Tue, 2 Jan 2024 00:51:51 +0000 (16:51 -0800)]
update-copyright-tests: immunize against self

Problem reported by Bernhard Voelker in:
https://lists.gnu.org/r/bug-gnulib/2024-01/msg00003.html
* tests/test-update-copyright.sh (ight): New var.
Use it in tests, to prevent update-copyright from
messing with the test data.

16 months agomaint: run 'make update-copyright'
Simon Josefsson [Mon, 1 Jan 2024 09:31:48 +0000 (10:31 +0100)]
maint: run 'make update-copyright'

16 months agoautoupdate
Karl Berry [Sun, 31 Dec 2023 16:33:17 +0000 (08:33 -0800)]
autoupdate

16 months agotests: don’t skip if LONG_MAX < pid
Paul Eggert [Sat, 30 Dec 2023 03:20:19 +0000 (19:20 -0800)]
tests: don’t skip if LONG_MAX < pid

* modules/pthread_sigmask-tests, modules/sigprocmask-tests:
(Depends-on): Add inttypes.
* tests/test-pthread_sigmask1.c, tests/test-sigprocmask.c:
Include inttypes.h.
(main): Don’t skip test if pid exceeds LONG_MAX.

16 months agoOmit no-longer-needed pragmas
Paul Eggert [Fri, 29 Dec 2023 18:33:42 +0000 (10:33 -0800)]
Omit no-longer-needed pragmas

* lib/anytostr.c, lib/poll.c, lib/regex.c:
Omit pragmas that should no longer be needed.

16 months agognulib-common: suppress -Wtautological-constant-out-of-range-compare
Paul Eggert [Fri, 29 Dec 2023 18:33:03 +0000 (10:33 -0800)]
gnulib-common: suppress -Wtautological-constant-out-of-range-compare

* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Pass
-Wno-tautological-constant-out-of-range-compare to clang, as it’s
the warning is enabled by default and in portable code where type
ranges are platform dependent it is generally more trouble than
it’s worth.

16 months agoannounce-gen: Improve links.
Simon Josefsson [Fri, 29 Dec 2023 18:28:17 +0000 (19:28 +0100)]
announce-gen: Improve links.

* build-aux/announce-gen: Use https:// URLs.

16 months agoerror: More clang -Winclude-next-absolute-path silencing.
Bruno Haible [Fri, 29 Dec 2023 09:39:52 +0000 (10:39 +0100)]
error: More clang -Winclude-next-absolute-path silencing.

* modules/error (Include): Suggest <error.h>, not "error.h".
* tests/test-error.c: Write #include <error.h>.
* tests/test-exclude.c: Likewise.
* tests/test-verror.c: Likewise.
* tests/test-xstrtol.c: Likewise.

16 months agoinclude_next: pacify clang -Winclude-next-absolute-path
Paul Eggert [Thu, 28 Dec 2023 20:25:16 +0000 (12:25 -0800)]
include_next: pacify clang -Winclude-next-absolute-path

Without this change, Ubuntu clang version 16.0.6 (15) issues
warnings like this: “In file included from xalloc-die.c:25:
./error.h:28:3: warning: #include_next in file found relative to
primary source file or found by absolute path; will search from
start of include path [-Winclude-next-absolute-path]”.
And sure enough, each file includes itself rather than the
next include file and it’s only the subsidiary include that
gets around to including the next include file.
* lib/argmatch.c, lib/chdir-long.c, lib/clean-temp-simple.c:
* lib/clean-temp.c, lib/closein.c, lib/closeout.c, lib/copy-acl.c:
* lib/copy-file.c, lib/creat.c, lib/csharpcomp.c:
* lib/csharpexec.c, lib/error.c, lib/exclude.c, lib/execute.c:
* lib/faccessat.c, lib/fopen.c, lib/freopen.c, lib/getopt.c:
* lib/getopt1.c, lib/git-merge-changelog.c, lib/javacomp.c:
* lib/javaexec.c, lib/javaversion.c, lib/mkdir-p.c, lib/open.c:
* lib/openat-die.c, lib/openat.c, lib/os2-spawn.c:
* lib/pagealign_alloc.c, lib/pipe-filter-gi.c:
* lib/pipe-filter-ii.c, lib/same.c, lib/set-acl.c:
* lib/sigpipe-die.c, lib/spawn-pipe.c, lib/sys_socket.c, lib/truncate.c:
* lib/unistd.c, lib/verror.c, lib/wait-process.c, lib/wctype-h.c:
* lib/xalloc-die.c, lib/xfreopen.c, lib/xmemcoll.c, lib/xprintf.c:
* lib/xsetenv.c, lib/xstdopen.c, lib/xstrtol-error.c:
Use ‘#include <foo.h>’ instead of ‘#include "foo.h"’ if foo.h
possibly uses #include_next.  (However, don’t do this on OSF/1
which has its own problems.)

16 months agostat-time: fix macOS bug with negative file times
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.

16 months agojit/cache: Fix compilation error on m68k, sparc, etc.
Bruno Haible [Tue, 19 Dec 2023 21:10:58 +0000 (22:10 +0100)]
jit/cache: Fix compilation error on m68k, sparc, etc.

* lib/jit/cache.h: Include <stdint.h>.
* modules/jit/cache (Depends-on): Add stdint.

16 months agojit/cache tests: Make more portable.
Marc Nieper-Wißkirchen [Tue, 19 Dec 2023 19:04:12 +0000 (20:04 +0100)]
jit/cache tests: Make more portable.

* tests/jit/test-cache.c (CODE): New macro.
(struct func): New type.
(main): Initialize f more carefully.
* modules/jit/cache-tests (Depends-on): Add host-cpu-c-abi.

16 months agoselinux-h: add stubs and wrappers for raw counterparts
Christian Göttsche [Tue, 19 Dec 2023 14:54:37 +0000 (15:54 +0100)]
selinux-h: add stubs and wrappers for raw counterparts

Add stubs and wrappers of already covered libselinux interfaces for
their `raw` counterparts.  These counterparts perform the same
operation expect for context translation.  Context translation is used
to convert SELinux MCS/MLS labels into human readable form, see
mcstransd(8).

* lib/se-selinux.in.h: Add declarations for raw variants.
* lib/se-label.in.h: Likewise.
* lib/getfilecon.c: Add wrappers for problematic raw variants.
* m4/selinux-selinux-h.m4: Use wrappers for problematic raw variants.

16 months agomcel-tests: fix thinko in test
Paul Eggert [Fri, 15 Dec 2023 01:15:27 +0000 (17:15 -0800)]
mcel-tests: fix thinko in test

* tests/test-mcel.c (main): Fix typo in mcel_scanz test.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2023-12/msg00034.html

16 months ago* ChangeLog: Fix typo.
Paul Eggert [Tue, 12 Dec 2023 02:31:23 +0000 (18:31 -0800)]
* ChangeLog: Fix typo.

16 months agosavedir: scale better when sorting by name
Paul Eggert [Tue, 12 Dec 2023 01:47:38 +0000 (17:47 -0800)]
savedir: scale better when sorting by name

* lib/savedir.c: Include attribute.h.
(direntry_t): The ‘name’ member is now idx_t, not char *,
so that it survives name_space relocation.
(direntry_cmp_name, direntry_cmp_inode, comparison_function):
Adjust to qsort_r API, and to direntry_t layout change.
(streamsavedir): Redo to avoid need for xstrdup on each directory
entry.  Instead, copy the string data into name_space; this
typically scales better the memory allocator is called O(log N)
rather than O(N) times.  Use qsort_r so that name_space can be
passed to the comparison functions.  Simplify calls to ‘free’ so
that lack of leakage is more obvious.
* modules/savedir (Depends-on): Add attribute, qsort_r.

16 months agogetopt: pacify gcc -Wanalyzer-null-dereference
Paul Eggert [Mon, 11 Dec 2023 18:57:06 +0000 (10:57 -0800)]
getopt: pacify gcc -Wanalyzer-null-dereference

* lib/getopt.c (process_long_option): Simplify logic slightly.
This pacifies gcc -flto -Wanalyzer-null-dereference when compiling
GNU tar on x86-64 with gcc 13.2.1 20231205 (Red Hat 13.2.1-6).

16 months agobootstrap: fix option propagation with --bootstrap-sync
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

17 months agofrexp: pacify clang re address-of-volatile
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.

17 months agoUpdate portability doc for CHERI, C23
Paul Eggert [Fri, 1 Dec 2023 20:17:32 +0000 (12:17 -0800)]
Update portability doc for CHERI, C23

* doc/gnulib-readme.texi:
Prefer “null pointer” to “@code{NULL}” since C23 has nullptr.
(Portability guidelines): Mention C99 instead of C89 for what
Gnulib assumes of headers.
(C99 features avoided): Mention CHERI issue with intptr_t etc.
(Other portability assumptions): Say that C23 requires two’s
complement.  Mention CHERI’s holes.

17 months agoobstack: Avoid undefined behaviour.
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.

17 months agodoc: Update for FreeBSD 14.0.
Bruno Haible [Fri, 1 Dec 2023 12:21:44 +0000 (13:21 +0100)]
doc: Update for FreeBSD 14.0.

* 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.
* m4/printf.m4: Update comments.

17 months agosethostname tests: Fix a compilation error on FreeBSD 14.0.
Bruno Haible [Fri, 1 Dec 2023 10:47:31 +0000 (11:47 +0100)]
sethostname tests: Fix a compilation error on FreeBSD 14.0.

* tests/test-sethostname1.c: Skip the SIGNATURE_CHECK on some platforms.
* doc/glibc-functions/sethostname.texi: Update platforms list.

17 months agostack: Fix documentation in header file.
Marc Nieper-Wißkirchen [Mon, 27 Nov 2023 16:46:58 +0000 (17:46 +0100)]
stack: Fix documentation in header file.

* lib/stack.h: Correct documentation on `stack_current_base'.

17 months agojit/cache-tests: Fix include guard.
Marc Nieper-Wißkirchen [Mon, 27 Nov 2023 16:36:42 +0000 (17:36 +0100)]
jit/cache-tests: Fix include guard.

* tests/jit/test-cache.c (main): Extend range of include guard.

17 months agojit/cache-tests: New module.
Marc Nieper-Wißkirchen [Sat, 25 Nov 2023 17:14:55 +0000 (18:14 +0100)]
jit/cache-tests: New module.

* tests/jit/test-cache.c: New file.
* modules/jit/cache-tests: New file.  Mark the test as unportable
for now.

17 months agojit/cache: Fix configure error.
Marc Nieper-Wißkirchen [Sat, 25 Nov 2023 19:58:31 +0000 (20:58 +0100)]
jit/cache: Fix configure error.

* m4/valgrind-helper.m4: Unconditionally set support_valgrind.

17 months agoautoupdate
Karl Berry [Sat, 25 Nov 2023 17:21:42 +0000 (09:21 -0800)]
autoupdate

17 months agofloorf, ceilf tests: Strengthen against compiler optimizations.
Bruno Haible [Fri, 24 Nov 2023 19:02:37 +0000 (20:02 +0100)]
floorf, ceilf tests: Strengthen against compiler optimizations.

Reported by René Rebe <rene@t2-project.org>.

* tests/test-floorf1.c (main): Mark my_floorf as 'volatile'.
* tests/test-floorf-ieee.c (main): Likewise.
* tests/test-ceilf1.c (main): Mark my_ceilf as 'volatile'.
* tests/test-ceilf-ieee.c (main): Likewise.

17 months agostrerrorname_np: Work around glibc bug on HPPA systems.
Bruno Haible [Tue, 21 Nov 2023 15:18:44 +0000 (16:18 +0100)]
strerrorname_np: Work around glibc bug on HPPA systems.

* m4/strerrorname_np.m4 (gl_FUNC_STRERRORNAME_NP): Test also
strerrorname_np (ENOSYM).
* lib/strerrorname_np.c (strerrorname_np): Update comments.
* tests/test-strerrorname_np.c (main): Likewise.
* doc/glibc-functions/strerrorname_np.texi: Mention that glibc 2.37
still needs a workaround.

17 months agorand: Use the usual patterns for overriding a function.
Bruno Haible [Tue, 21 Nov 2023 14:25:24 +0000 (15:25 +0100)]
rand: Use the usual patterns for overriding a function.

* lib/stdlib.in.h (RAND_MAX): Override also if module 'rand' is present.
(rand): New declaration.
* m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize GNULIB_RAND.
(gl_STDLIB_H_DEFAULTS): Initialize REPLACE_RAND.
* modules/stdlib (Makefile.am): Substitute GNULIB_RAND and REPLACE_RAND.

17 months agonan, snan tests: Don't include these tests by default.
Bruno Haible [Sat, 18 Nov 2023 05:42:56 +0000 (06:42 +0100)]
nan, snan tests: Don't include these tests by default.

* modules/nan-tests (Status): Mark the test as unportable.
* modules/snan-tests (Status): Likewise.

17 months agorealloc-gnu: Fix wrong configure test result with optimizing ibm-clang.
Bruno Haible [Fri, 17 Nov 2023 23:18:37 +0000 (00:18 +0100)]
realloc-gnu: Fix wrong configure test result with optimizing ibm-clang.

* m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Use 'volatile', to defeat an
ibm-clang optimization.
* m4/malloc.m4 (_AC_FUNC_MALLOC_IF): Likewise.

17 months agombrtowc, mbrtoc32, nl_langinfo, setlocale-null: Obey --disable-threads.
Bruno Haible [Fri, 17 Nov 2023 18:37:24 +0000 (19:37 +0100)]
mbrtowc, mbrtoc32, nl_langinfo, setlocale-null: Obey --disable-threads.

Reported by David Edelsohn <dje.gcc@gmail.com> in
<https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636830.html>,
<https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636843.html>.

* m4/threadlib.m4 (gl_THREADLIB_BODY): If --disable-threads was
specified, define AVOID_ANY_THREADS to 1.
* lib/mbtowc-lock.c: Omit all code if --disable-threads was specified.
* lib/nl_langinfo-lock.c: Likewise.
* lib/setlocale-lock.c: Likewise.
* lib/mbtowc-lock.h: Omit locking code if --disable-threads was
specified.
* lib/nl_langinfo.c: Likewise.
* lib/setlocale_null.c: Likewise.
* lib/mbrtowc.c: Don't include any multithreading headers if
--disable-threads was specified.
* lib/mbrtoc32.c: Likewise.

17 months agogettext: Recognize a statically built libintl on macOS and AIX.
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.

17 months agoboot-time: Make it work on Adélie Linux.
Bruno Haible [Thu, 16 Nov 2023 13:06:29 +0000 (14:06 +0100)]
boot-time: Make it work on Adélie Linux.

* lib/boot-time.c (get_boot_time_uncached): Invoke Linux fallbacks also
on Linux systems that have neither <utmp.h> nor <utmpx.h>.

17 months agoobstack: Modernize, fixing several problems.
Bruno Haible [Wed, 15 Nov 2023 23:09:40 +0000 (00:09 +0100)]
obstack: Modernize, fixing several problems.

* lib/obstack.in.h: Renamed from lib/obstack.h. Add reference to the
glibc documentation.
(_OBSTACK_INTERFACE_VERSION): Remove macro.
(_OBSTACK_SIZE_T, _CHUNK_SIZE_T, _OBSTACK_CAST): Mark old values with
_LIBC.
(_obstack_newchunk, _obstack_free, _obstack_begin, _obstack_begin_1,
_obstack_memory_used, _obstack_allocated_p): Override if REPLACE_OBSTACK
is 1.
* lib/obstack.c: Don't include <gnu-versions.h>.
(_OBSTACK_ELIDE_CODE): Remove macro.
* m4/obstack.m4 (gl_FUNC_OBSTACK): Test whether obstack.h exists. Don't
define HAVE_OBSTACK any more. Set HAVE_OBSTACK, REPLACE_OBSTACK,
GL_GENERATE_OBSTACK_H.
* modules/obstack (Files): Remove obstack.h. Add obstack.in.h.
(Depends-on): Add gen-header. Add conditions.
(configure.ac): Consider HAVE_OBSTACK, REPLACE_OBSTACK. Invoke
gl_CONDITIONAL_HEADER and AC_PROG_MKDIR_P.
(Makefile.am): Generate obstack.h. Augment BUILT_SOURCES and
MOSTLYCLEANFILES.

17 months agostriconveha: pacify gcc -Wcast-align
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.

17 months agodoc: Mention a 'random' limitation on OpenBSD.
Bruno Haible [Tue, 14 Nov 2023 18:33:21 +0000 (19:33 +0100)]
doc: Mention a 'random' limitation on OpenBSD.

Reported by Corinna Vinschen <vinschen@redhat.com>.

* doc/posix-functions/random.texi: Mention the OpenBSD limitation.

17 months agorand: Mark as obsolete.
Bruno Haible [Tue, 14 Nov 2023 18:18:16 +0000 (19:18 +0100)]
rand: Mark as obsolete.

* modules/rand (Status, Notice): New sections.

17 months ago*printf-posix: Revert expectations of %lc of 0.
Bruno Haible [Tue, 14 Nov 2023 13:10:57 +0000 (14:10 +0100)]
*printf-posix: Revert expectations of %lc of 0.

* m4/printf.m4 (gl_PRINTF_DIRECTIVE_LC): Expect a NUL byte in the
output.
* lib/vasnprintf.c (VASNPRINTF): In the %lc implementation, don't
special-case the NUL wide character.
* tests/test-vasnprintf-posix.c (test_function): Change expected result
for %lc of L'\0'.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* doc/posix-functions/dprintf.texi: Update platform list regarding %lc
of 0 bug.
* doc/posix-functions/fprintf.texi: Likewise.
* doc/posix-functions/printf.texi: Likewise.
* doc/posix-functions/snprintf.texi: Likewise.
* doc/posix-functions/sprintf.texi: Likewise.
* doc/posix-functions/vdprintf.texi: Likewise.
* doc/posix-functions/vfprintf.texi: Likewise.
* doc/posix-functions/vprintf.texi: Likewise.
* doc/posix-functions/vsnprintf.texi: Likewise.
* doc/posix-functions/vsprintf.texi: Likewise.
* doc/glibc-functions/asprintf.texi: Likewise.
* doc/glibc-functions/vasprintf.texi: Likewise.
* doc/glibc-functions/obstack_printf.texi: Likewise.
* doc/glibc-functions/obstack_vprintf.texi: Likewise.

17 months agodoc: Add a note.
Bruno Haible [Tue, 14 Nov 2023 01:47:21 +0000 (02:47 +0100)]
doc: Add a note.

* doc/posix-headers/stdatomic.texi: Add a note about the memory model.

17 months agoDon't use CHERI facilities with CC="clang -march=morello".
Bruno Haible [Mon, 13 Nov 2023 13:55:01 +0000 (14:55 +0100)]
Don't use CHERI facilities with CC="clang -march=morello".

Suggested by Jessica Clarke <jrtc27@jrtc27.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00116.html>.

* lib/alignalloc.h (alignalloc): Test __CHERI_PURE_CAPABILITY__, not
__CHERI__.
* lib/eealloc.h (eemalloc, eerealloc): Likewise.
* lib/ialloc.h (irealloc, ireallocarray): Likewise.
* lib/malloca.h (malloca): Likewise.
* lib/malloca.c (small_t, mmalloca, freea): Likewise.
* lib/rawmemchr.c (rawmemchr): Likewise.
* lib/safe-alloc.h (safe_alloc_realloc_n): Likewise.
* lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): Likewise.
* lib/ssfmalloc.h (struct dissected_page_header, init_small_block_page,
init_medium_block_page, free_block_from_pool, allocate_block): Likewise.
* tests/test-stdint.c: Likewise.

17 months agojit/cache: Fix configure test.
Bruno Haible [Mon, 13 Nov 2023 13:32:37 +0000 (14:32 +0100)]
jit/cache: Fix configure test.

* m4/valgrind-helper.m4 (gl_VALGRIND_HELPER): Check already at configure
time whether <valgrind/valgrind.h> exists. Fix AC_DEFINE_UNQUOTED
invocation.

17 months agorawmemchr: speed up, particularly on CHERI
Paul Eggert [Mon, 13 Nov 2023 07:21:40 +0000 (23:21 -0800)]
rawmemchr: speed up, particularly on CHERI

* lib/rawmemchr.c (rawmemchr) [__CHERI__]: Use memchr instead of
one-byte reads.  This sped up a simple benchmark (rawmemchr on
100,000 bytes) by 6x on a Research Morello SoC r0p0 on CheriBSD 14.
[!__CHERI__]: Use sizeof, not alignof, as better alignment
should help performance a bit on some platforms.
* modules/rawmemchr (Depends-on): Remove alignasof.

17 months agojit/cache: New module.
Bruno Haible [Sun, 12 Nov 2023 17:22:50 +0000 (18:22 +0100)]
jit/cache: New module.

* lib/jit/cache.h: New file.
* m4/valgrind-helper.m4: New file.
* modules/jit/cache: New file.

17 months agossfmalloc: Take advantage of CHERI bounds-checking.
Bruno Haible [Sat, 11 Nov 2023 23:45:39 +0000 (00:45 +0100)]
ssfmalloc: Take advantage of CHERI bounds-checking.

* lib/ssfmalloc.h: Include <cheri.h>.
(struct dissected_page_header) [CHERI]: Add field 'whole_page'.
(init_small_block_page, init_medium_block_page) [CHERI]: Initialize it.
(free_block_from_pool) [CHERI]: Use this field to initialize
pool->freeable_page.
(allocate_block) [CHERI]: Return a pointer with a tight upper bound.

17 months agovasnprintf: Re-enable parsing of directive with I64 (regr. 2023-03-24).
Johannes Schindelin [Sat, 11 Nov 2023 21:53:33 +0000 (22:53 +0100)]
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

17 months agomalloca: Take advantage of CHERI bounds-checking.
Bruno Haible [Sat, 11 Nov 2023 19:04:02 +0000 (20:04 +0100)]
malloca: Take advantage of CHERI bounds-checking.

* lib/malloca.h: Include <cheri.h>.
(malloca) [CHERI]: In the stack-allocation case, return a pointer with
a tight lower bound and a tight upper bound.
* lib/malloca.c: Include <cheri.h>.
(small_t) [CHERI]: Define as uintptr_t.
(mmalloca) [CHERI]: Return a pointer with a tight upper bound.
(freea) [CHERI]: Update.

17 months agosafe-alloc: Take advantage of CHERI bounds-checking.
Bruno Haible [Sat, 11 Nov 2023 18:36:36 +0000 (19:36 +0100)]
safe-alloc: Take advantage of CHERI bounds-checking.

* lib/safe-alloc.h: Include <cheri.h>.
(safe_alloc_realloc_n): When count or size is 0, return a pointer whose
bounds are of size 0, not 1.

17 months agoialloc: Take advantage of CHERI bounds-checking.
Bruno Haible [Sat, 11 Nov 2023 18:34:26 +0000 (19:34 +0100)]
ialloc: Take advantage of CHERI bounds-checking.

* lib/ialloc.h: Include <cheri.h>.
(irealloc): When s is 0, return a pointer whose bounds are of size 0,
not 1.
(ireallocarray): When n or s is 0, return a pointer whose bounds are of
size 0, not 1.

17 months agoeealloc: Take advantage of CHERI bounds-checking.
Bruno Haible [Sat, 11 Nov 2023 18:31:56 +0000 (19:31 +0100)]
eealloc: Take advantage of CHERI bounds-checking.

* lib/eealloc.h: Include <cheri.h>.
(eemalloc): When n is 0, return a pointer whose bounds are of size 0,
not 1.
(eerealloc): Likewise.

17 months agoalignalloc: Take advantage of CHERI bounds-checking.
Bruno Haible [Sat, 11 Nov 2023 18:28:26 +0000 (19:28 +0100)]
alignalloc: Take advantage of CHERI bounds-checking.

* lib/alignalloc.h: Include <cheri.h>.
(alignalloc): When size is 0, return a pointer whose bounds are of
size 0, not 1.

17 months agorawmemchr tests: Add test case for last commit.
Bruno Haible [Sat, 11 Nov 2023 10:44:47 +0000 (11:44 +0100)]
rawmemchr tests: Add test case for last commit.

* tests/test-rawmemchr.c (main): Add test case for aligned oversized
read.

17 months agorawmemchr: port better to CHERI
Paul Eggert [Sat, 11 Nov 2023 08:09:55 +0000 (00:09 -0800)]
rawmemchr: port better to CHERI

* lib/rawmemchr.c (rawmemchr): Use unsigned char for longword,
since CHERI doesn’t allow the aligned-word trick to speed up
performance.