Bruno Haible [Sun, 12 May 2024 13:58:32 +0000 (15:58 +0200)]
execinfo: Document known bugs.
* doc/glibc-functions/backtrace.texi: Mention the various bugs on
FreeBSD, NetBSD, OpenBSD.
* doc/glibc-functions/backtrace_symbols_fd.texi: Mention the glibc bug.
Bruno Haible [Sun, 12 May 2024 10:29:38 +0000 (12:29 +0200)]
execinfo tests: Strengthen tests.
* tests/test-execinfo.c (test_backtrace): Add an argument. Check the
return value of backtrace(). Check that backtrace_symbols_fd is defined.
Check the return value of backtrace_symbols().
(main): Test also the case of a short buffer.
* modules/execinfo-tests (Makefile.am): Verify that LIB_EXECINFO is
defined.
Paul Eggert [Sun, 12 May 2024 05:30:50 +0000 (22:30 -0700)]
stdbit: don’t assume -DHAVE_CONFIG_H
This is needed for diffutils, which doesn’t define HAVE_CONFIG_H.
There needs to be some way for a test shared with glibc to discover
whether it should use the Gnulib or the glibc testing framework,
and I guess this is it.
* modules/stdbit-tests (GNULIB_TEST_STDBIT): Define.
* tests/tst-stdbit.h: Use GNULIB_TEST_STDBIT, not HAVE_CONFIG_H.
Collin Funk [Sun, 12 May 2024 04:45:12 +0000 (21:45 -0700)]
gnulib-tool.py: Filter out dependencies that cannot be found.
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00136.html>.
* pygnulib/GLModuleSystem.py (GLModule.getDependenciesWithConditions):
Reorder conditionals to avoid duplicate checks. Filter out None from the
gathered dependencies when gathering module dependencies. Let
GLModuleSystem.find() warn instead of crashing.
Collin Funk [Sun, 12 May 2024 03:46:12 +0000 (20:46 -0700)]
execinfo: Add tests.
* modules/execinfo-tests: New file.
* tests/test-execinfo.c (test_backtrace): New function. Simply test that
the symbols defined in execinfo.h can be used.
(main): Use it.
Paul Eggert [Sat, 11 May 2024 18:23:34 +0000 (11:23 -0700)]
stdbit: clean up namespace and simplify
Fix namespace pollution in substitute stdbit.h.
Clean up and simplify some of the non-GCC code, by preferring
inline functions to macros and substituting something
more straightforward than a de Bruijn hash (possibly faster?).
The non-GCC non-C23 substitutes should all compile to
branch-free code, if the compiler is good.
* lib/stdbit.c (COUNT_LEADING_ZEROS_INLINE)
(COUNT_TRAILING_ZEROS_INLINE, COUNT_ONE_BITS_INLINE): Remove.
(__gl_stdbit_clztab) [!_GL_STDBIT_HAS_BUILTIN_CLZ && !_MSC_VER]:
New constant array.
(__gl_stdbit_popcount_support): Adjust to stdbit.in.h changes.
* lib/stdbit.in.h: Do not include <limits.h> or <stdlib.h>.
Check that bytes are 8 bits.
(COUNT_LEADING_ZEROS_INLINE, COUNT_TRAILING_ZEROS_INLINE)
(COUNT_ONE_BITS_INLINE, COUNT_LEADING_ZEROS)
(count_leading_zeros_32, count_leading_zeros)
(count_leading_zeros_l, count_leading_zeros_ll)
(COUNT_TRAILING_ZEROS, count_trailing_zeros_32)
(count_trailing_zeros, count_trailing_zeros_l)
(count_trailing_zeros_ll, COUNT_ONE_BITS, count_one_bits_32)
(COUNT_ONE_BITS_GENERIC, count_one_bits, count_one_bits_l)
(count_one_bits_ll): Remove, replacing all uses with ...
(_GL_STDBIT_HAS_BUILTIN_CLZ)
(_GL_STDBIT_HAS_BUILTIN_CTZ, _GL_STDBIT_HAS_BUILTIN_POPCOUNT)
(__gl_stdbit_clz, __gl_stdbit_clzl, __gl_stdbit_clzll)
(__gl_stdbit_ctz, __gl_stdbit_ctzl, __gl_stdbit_ctzll)
(__gl_stdbit_popcount, __gl_stdbit_popcountl, __gl_stdbit_popcountll)
(__gl_stdbit_popcount255): ... these new functions and macros.
(__popcnt64): Omit unnecessary casts.
(__gl_stdbit_popcount_support): Rename from popcount_support
and make it a signed char since that’s all we need.
(__gl_stdbit_popcount_supported): Rename from popcount_supported.
All uses changed.
* modules/stdbit (Depends-on): Add assert-h, for static_assert.
Paul Eggert [Fri, 10 May 2024 17:54:43 +0000 (10:54 -0700)]
stdbit: remove most module dependence
Remove dependence of stdbit on the modules count-leading-zeros,
count-trailing-zeros, and count-one-bits. stdbit is part of C23
and in the long run is more likely to be more portable, so code
should start preferring it.
* lib/stdbit.c (popcount_support): New var, if needed.
* lib/stdbit.in.h: Contain contents of count-leading-zeros.h,
count-trailing-zeros.h, and count-one-bits.h instead of including
those files. In the long run those files should be stubs that are
implemented via stdbit.
* modules/stdbit (Depends-on): Do not depend on count-leading-zeros,
count-trailing-zeros, count-one-bits.
Bruno Haible [Sat, 11 May 2024 12:27:02 +0000 (14:27 +0200)]
doc: Update regarding backtrace functions on *BSD.
* doc/glibc-functions/backtrace.texi: Mention in which *BSD releases
this function was missing.
* doc/glibc-functions/backtrace_symbols.texi: Likewise.
* doc/glibc-functions/backtrace_symbols_fd.texi: LIkewise.
* doc/glibc-headers/execinfo.texi: Update *BSD versions.
Collin Funk [Sat, 11 May 2024 07:58:44 +0000 (00:58 -0700)]
doc: Mention backtrace functions supported on BSD.
* doc/glibc-functions/backtrace.texi (backtrace): Mention that FreeBSD
supports this function from 10.0 onwards. Mention that NetBSD and
OpenBSD support this function from 7.0 onwards.
* doc/glibc-functions/backtrace_symbols.texi (backtrace_symbols):
Likewise.
* doc/glibc-functions/backtrace_symbols_fd.texi (backtrace_symbols_fd):
Likewise.
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: 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.
Collin Funk [Thu, 9 May 2024 01:55:51 +0000 (18:55 -0700)]
ftello: Prefer stdckdint to intprops.
* lib/ftello.c (ftello): Include stdckdint.h instead of intprops.h.
Prefer ckd_add to INT_ADD_OK.
* modules/ftello (Depends-on): Depend on stdckdint instead of intprops.
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.
Collin Funk [Wed, 8 May 2024 00:10:23 +0000 (17:10 -0700)]
gnulib-tool.py: Handle module dependencies that cannot be found.
* pygnulib/GLModuleSystem.py
(GLModule.getDependenciesWithoutConditions): Filter out None from the
module dependencies. An appropriate warning will already be printed by
GLModuleSystem.find().
Paul Eggert [Tue, 7 May 2024 16:19:17 +0000 (09:19 -0700)]
nstrftime: use clearer code for padding
This also works around GCC bug 114965
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114965>.
* lib/strftime.c (enum pad_style): New type.
(width_add, my_strftime, __strftime_internal):
Use it instead of checking the raw chars.
* tests/test-nstrftime.h (T): Test for the GCC bug.
Bruno Haible [Sun, 5 May 2024 14:30:10 +0000 (16:30 +0200)]
gnulib-tool.py: Regenerate aclocal.m4 before using 'autoconf -t ...'.
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00065.html>.
* pygnulib/GLImport.py (GLImport): New field m4dirs.
(GLImport.__init__): Accept an additional m4dirs argument.
(GLImport.execute): Regenerate aclocal.m4 before creating the library
Makefile.
* pygnulib/main.py (main): Pass the guessed_m4dirs to GLImport.
Collin Funk [Sat, 4 May 2024 00:26:18 +0000 (17:26 -0700)]
gnulib-tool.py: Fix an undefined function name.
* pygnulib/main.py (main_with_exception_handling): Use the tempfile
module prefix when calling mkdtemp(). Use the 'glpy' prefix for the
temporary directory that exists for the entirety of the program.
Collin Funk [Thu, 2 May 2024 07:49:58 +0000 (00:49 -0700)]
gnulib-tool.py: Don't leave temporary directories on exit.
* pygnulib/main.py (main_with_exception_handling): Use
tempfile.TemporaryDirectory as a context manager so it is removed before
the program exits.
(main): Expect a temporary directory to be passed as an argument.
* pygnulib/GLConfig.py (GLConfig.__init__): Accept an optional temporary
directory parameter instead of creating one.
* pygnulib/GLImport.py (GLImport.__init__): Don't remove the cache's
temporary directory since it doesn't create one anymore.
(GLImport.execute): Don't remove the temporary directory explicitly. It
is handled by the usage of a context manager.
* pygnulib/GLTestDir.py (GLTestDir.execute, GLMegaTestDir.execute):
Likewise.
Collin Funk [Thu, 2 May 2024 04:26:34 +0000 (21:26 -0700)]
gnulib-tool.py: Quote file names passed to 'patch'.
* pygnulib/GLTestDir.py (_patch_test_driver): Import shlex and cleanup
unused imports. Use shlex.quote() on the file names passed to 'patch'.
* pygnulib/GLFileSystem.py (GLFileSystem.lookup): Likewise. Perform
redirection using sp.call() arguments instead of using the shell.
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.
Collin Funk [Wed, 1 May 2024 09:21:43 +0000 (02:21 -0700)]
gnulib-tool.py: Fix mistake in previous commit.
* pygnulib/GLModuleSystem.py (GLModuleSystem.exists)
(GLModuleSystem.find): Rename 'module' argument to 'module_name' so it
is clear they are not a GLModule object. Treat them as such.
Paul Eggert [Wed, 1 May 2024 02:36:43 +0000 (19:36 -0700)]
intprops: document fix for GCC bug 68193
* lib/intprops-internal.h (_GL__GENERIC_BOGUS):
GCC bug 68193 is fixed in GCC 14. This is just for documentation,
as _GL__GENERIC_BOGUS is not consulted in GCC 14.
* pygnulib/GLModuleSystem.py (GLModule.__init__)
(GLModuleTable.__init__): Remove the unused GLFileSystem variable. These
classes perform lookups with a GLModuleSystem.
* pygnulib/GLTestDir.py (GLTestDir.__init__): Remove the unused
GLFileAssistant variable. The transformations it performs are not needed
in testdirs.
* pygnulib/*.py: Add type hints for all instance and class variables.
* pygnulib/GLMakefileTable.py (GLMakefileTable.__getitem__): Fix return
type hint since the dictionary has str values.
gnulib-tool.py: Emit libtests in testdirs generated Makefile.am.
Reported by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00463.html>.
* pygnulib/GLTestDir.py (GLTestDir.execute): Modify the GLEmiter's
config variable instead of the GLTestDir's so that it can be accessed
when emitting the Makefile.am.
doc: Mention AC_CONFIG_MACRO_DIRS in configure.ac.
Document the following gnulib-tool change:
2021-12-19 Bruno Haible <bruno@clisp.org>
gnulib-tool: Don't insist on ACLOCAL_AMFLAGS.
* doc/gnulib-tool.texi (Initial import): Update the example gnulib-tool
invocation. Document the use of AC_CONFIG_MACRO_DIRS as an alternative
to ACLOCAL_AMFLAGS.
Bruno Haible [Sun, 28 Apr 2024 09:29:27 +0000 (11:29 +0200)]
bootstrap: Support checking out a recent GNULIB_REVISION, part 2.
Reported by Markus Mützel <markus.muetzel@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00507.html>.
* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): If using a submodule
and the 'git checkout' command fails, fetch the newer commits and then
retry it.
* build-aux/bootstrap: Regenerated.
Bruno Haible [Sat, 27 Apr 2024 18:33:59 +0000 (20:33 +0200)]
gnulib-tool: Simplify the Python version test.
Suggested by Pádraig Brady in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00469.html>.
* gnulib-tool: Use Python's sys.version_info, not --version.
* gnulib-tool.py: Use the same version test here. Use --version only to
produce a specific error message.
Paul Eggert [Sat, 27 Apr 2024 23:07:16 +0000 (16:07 -0700)]
maint: be more precise and vague about GCC 14
In commentary, be specific about which particular GCC 14 prerelease is
meant when this matters, and don’t say “GCC 14” otherwise.
Prompted by a remark by Sam James in:
https://lists.gnu.org/r/bug-gnulib/2024-04/msg00484.html
Paul Eggert [Sat, 27 Apr 2024 16:09:38 +0000 (09:09 -0700)]
stddef: work around GCC 14 stddef.h bugs
* lib/stddef.in.h: Do nothing if _@GUARD_PREFIX@_STDDEF_H is
defined, as stddef.h has already been included. This works
around GCC bug 114870.
(_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.
Bruno Haible [Sat, 27 Apr 2024 17:08:06 +0000 (19:08 +0200)]
bootstrap: Support checking out a recent GNULIB_REVISION.
Reported by Markus Mützel <markus.muetzel@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00462.html>.
* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): If the
'git checkout' command fails, fetch the newer commits and then retry it.
* build-aux/bootstrap: Regenerated.
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.
Bruno Haible [Fri, 26 Apr 2024 09:33:06 +0000 (11:33 +0200)]
gnulib-tool: Use the Python implementation by default.
* gnulib-tool: If GNULIB_TOOL_IMPL is not set: Use the Python
implementation if a suitable 'python3' program is found in $PATH;
otherwise print a warning and use the shell implementation.
gnulib-tool.py: Reduce code duplication in file name transformations.
* pygnulib/functions.py: New file for shared functions between modules.
Add a function based on functions removed from GLImport and GLTestDir.
Accepts a single file name instead of a list.
* pygnulib/GLImport.py (GLImport.prepare): Use the new function.
(GLImport.rewrite_new_files, GLImport.rewrite_old_files): Remove
functions.
* pygnulib/GLTestDir.py (GLTestDir.execute): Use the new function.
(GLTestDir.rewrite_files): Remove functions.
* pygnulib/main.py (main): Remove unused function import. Use the new
function.
* pygnulib/GLFileTable.py: New file. Define the GLFileTable class with
five attributes which can be individually typed.
* pygnulib/GLTestDir.py (GLTestDir.execute): Use the GLFileTable class.
* pygnulib/GLImport.py (GLImport.gnulib_comp, GLImport.prepare)
(GLImport.execute): Likewise. Update type hints and doc strings.
Paul Eggert [Wed, 24 Apr 2024 21:56:28 +0000 (14:56 -0700)]
largefile: port to C++
This patch is mostly taken from Autoconf master.
* m4/largefile.m4 (AC_SYS_YEAR2038_RECOMMENDED):
Undefine if unpatched Autoconf 2.72 or earlier, so that
later code will redefine it.
The remaining part of this patch is from Autoconf master.
(_AC_SYS_YEAR2038_PROBE, _AC_SYS_LARGEFILE_PROBE):
Put "$CCFLAGS" in diagnostics, not "$CC".
(_AC_SYS_LARGEFILE_OPTIONS): Omit -n32.
(AC_SYS_LARGEFILE_PROBE): Fiddle with CPPFLAGS, not CC.
Do not worry about -n32.
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 13.
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
Add -Wflex-array-member-not-at-end, -Wmissing-variable-declarations.
* pygnulib/*.py: Import functions from constants.py directly instead of
assigning them to module-specific variable. Keep the module prefix for
standard library functions.
Bruno Haible [Tue, 23 Apr 2024 14:58:04 +0000 (16:58 +0200)]
Update HACKING.
* HACKING: Mention the linear git history, how to work with ChangeLog,
how to run a testdir, where to find the gnulib-tool tests, and where are
the continuous integrations.
Bruno Haible [Mon, 22 Apr 2024 11:11:05 +0000 (13:11 +0200)]
gnulib-tool.py: Fix trouble caused by Python's bytecode cache.
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00367.html>.
* gnulib-tool.py: Set PYTHONPYCACHEPREFIX, so as to avoid creating a
__pycache__ directory in the developer's gnulib checkout (only effective
with Python ≥ 3.8).
gnulib-tool.py: Don't fail when given a bad module name.
* pygnulib/GLTestDir.py (GLTestDir.execute): Don't include None in the
list of GLModule objects.
* pygnulib/GLModuleSystem.py (GLModuleSystem.find): Document the meaning
of the None return.
* pygnulib/GLImport.py (GLImport.execute): Update transformer type hint
to reflect change from sed expressions to re.sub() arguments.
(GLImport.prepare): Likewise. Don't reference sed or license
replacements in docstring.
Bruno Haible [Sat, 20 Apr 2024 23:58:39 +0000 (01:58 +0200)]
nan: Relicense under LGPLv2+.
Eric Blake's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00290.html>.
Paul Eggert's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00324.html>.
Daniel Richard G.'s approval was given in private email.
Bruno Haible [Sat, 20 Apr 2024 22:27:18 +0000 (00:27 +0200)]
gnulib-tool: In sh+py mode, don't fail because of dangling symlinks.
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00318.html>
and Pádraig Brady in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00321.html>.
* gnulib-tool: In sh+py mode, use diff option '--no-dereference' if
available.
* pygnulib/constants.py: Remove duplicate __authors__, __license__, and
__copyright__ definitions.
* pygnulib/GLInfo.py: Use the value of __authors__ and __copyright__
from __init__.py for output.
* pygnulib/*.py: Remove unused references to the constant.py
definitions.
Bruno Haible [Sat, 20 Apr 2024 21:45:59 +0000 (23:45 +0200)]
gnulib-tool.py: Fix a bug in removed / added files handling.
* pygnulib/GLImport.py (GLImport.execute): When looking for files that
are in both filetable['old'] and filetable['new'], consider only the
first element of each tuple, not the entire tuple.