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 [Thu, 18 Apr 2024 14:29:28 +0000 (16:29 +0200)]
totalorderl: Simplify on MSVC.
* lib/totalorderl.c (totalorderl): If 'long double' is the same as
'double', just invoke totalorder. Otherwise, drop the optimized code
for small 'long double' since it does not occur on any platform.
* m4/totalorder.m4 (gl_FUNC_TOTALORDERL): Require
gl_LONG_DOUBLE_VS_DOUBLE. If 'long double' is the same as 'double', use
TOTALORDER_LIBM.
* modules/totalorderl (Depends-on): Add totalorder.
Bruno Haible [Wed, 17 Apr 2024 23:34:02 +0000 (01:34 +0200)]
totalorder* tests: Strengthen tests.
* tests/test-totalorder.h: Include <math.h>.
(positive_NaN_with_payload, negative_NaN_with_payload): New functions.
(main): Test quiet NaNs of each sign with different payload.
* tests/test-totalorder.c (TOTALORDER_POSITIVE_NAN,
TOTALORDER_NEGATIVE_NAN): Remove macros.
(TOTALORDER_SETPAYLOAD): New macro.
* tests/test-totalorderf.c (TOTALORDER_POSITIVE_NAN,
TOTALORDER_NEGATIVE_NAN): Remove macros.
(TOTALORDER_SETPAYLOAD): New macro.
* tests/test-totalorderl.c (TOTALORDER_POSITIVE_NAN,
TOTALORDER_NEGATIVE_NAN): Remove macros.
(TOTALORDER_SETPAYLOAD): New macro.
* modules/totalorder-tests (Depends-on): Add setpayload.
(Makefile.am): Link test-totalorder with $(SETPAYLOAD_LIBM).
* modules/totalorderf-tests (Depends-on): Add setpayloadf.
(Makefile.am): Link test-totalorderf with $(SETPAYLOADF_LIBM).
* modules/totalorderl-tests (Depends-on): Add setpayloadl.
(Makefile.am): Link test-totalorderl with $(SETPAYLOADL_LIBM).
Bruno Haible [Wed, 17 Apr 2024 09:08:40 +0000 (11:08 +0200)]
getpayloadl: New module.
* lib/math.in.h (getpayloadl): New declaration.
* lib/getpayloadl.c: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether getpayloadl is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_GETPAYLOADL.
(gl_MATH_H_DEFAULTS): Initialize HAVE_GETPAYLOADL, REPLACE_GETPAYLOADL.
* modules/math (Makefile.am): Substitute GNULIB_GETPAYLOADL,
HAVE_GETPAYLOADL, REPLACE_GETPAYLOADL.
* modules/getpayloadl: New file.
* doc/posix-functions/getpayloadl.texi: Mention the new module and the
glibc bug.
Bruno Haible [Wed, 17 Apr 2024 09:02:52 +0000 (11:02 +0200)]
getpayloadf: New module.
* lib/math.in.h (getpayloadf): New declaration.
* lib/getpayloadf.c: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether getpayloadf is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_GETPAYLOADF.
(gl_MATH_H_DEFAULTS): Initialize HAVE_GETPAYLOADF, REPLACE_GETPAYLOADF.
* modules/math (Makefile.am): Substitute GNULIB_GETPAYLOADF,
HAVE_GETPAYLOADF, REPLACE_GETPAYLOADF.
* modules/getpayloadf: New file.
* doc/posix-functions/getpayloadf.texi: Mention the new module and the
glibc bug.
Bruno Haible [Wed, 17 Apr 2024 08:57:05 +0000 (10:57 +0200)]
getpayload: New module.
* lib/math.in.h (getpayload): New declaration.
* lib/getpayload.c: New file.
* m4/getpayload.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether getpayload is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_GETPAYLOAD.
(gl_MATH_H_DEFAULTS): Initialize HAVE_GETPAYLOAD, REPLACE_GETPAYLOAD.
* modules/math (Makefile.am): Substitute GNULIB_GETPAYLOAD,
HAVE_GETPAYLOAD, REPLACE_GETPAYLOAD.
* modules/getpayload: New file.
* doc/posix-functions/getpayload.texi: Mention the new module and the
glibc bug.
Bruno Haible [Tue, 16 Apr 2024 19:28:42 +0000 (21:28 +0200)]
setpayloadsigl: New module.
* lib/math.in.h (setpayloadsigl): New declaration.
* lib/setpayloadsigl.c: New file, based on lib/setpayloadl.c.
* m4/math_h.m4 (gl_MATH_H): Test whether setpayloadsigl is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_SETPAYLOADSIGL.
(gl_MATH_H_DEFAULTS): Initialize HAVE_SETPAYLOADSIGL.
* modules/math (Makefile.am): Substitute GNULIB_SETPAYLOADSIGL,
HAVE_SETPAYLOADSIGL.
* modules/setpayloadsigl: New file.
* doc/posix-functions/setpayloadsigl.texi: Mention the new module.
Bruno Haible [Tue, 16 Apr 2024 19:15:16 +0000 (21:15 +0200)]
setpayloadsigf: Add tests.
* tests/test-setpayloadf.c (PAYLOAD_BITS): New macro.
(main): Use it.
* tests/test-setpayloadsigf.c: New file, based on
tests/test-setpayloadf.c.
* modules/setpayloadsigf-tests: New file.
Bruno Haible [Tue, 16 Apr 2024 19:12:39 +0000 (21:12 +0200)]
setpayloadsigf: New module.
* lib/math.in.h (setpayloadsigf): New declaration.
* lib/setpayloadsigf.c: New file, based on lib/setpayloadf.c.
* m4/math_h.m4 (gl_MATH_H): Test whether setpayloadsigf is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_SETPAYLOADSIGF.
(gl_MATH_H_DEFAULTS): Initialize HAVE_SETPAYLOADSIGF.
* modules/math (Makefile.am): Substitute GNULIB_SETPAYLOADSIGF,
HAVE_SETPAYLOADSIGF.
* modules/setpayloadsigf: New file.
* doc/posix-functions/setpayloadsigf.texi: Mention the new module.
Bruno Haible [Tue, 16 Apr 2024 19:06:20 +0000 (21:06 +0200)]
setpayloadsig: Add tests.
* tests/test-setpayload.c (PAYLOAD_BITS): New macro.
(main): Use it.
* tests/test-setpayloadsig.c: New file, based on
tests/test-setpayload.c.
* modules/setpayloadsig-tests: New file.
Bruno Haible [Tue, 16 Apr 2024 19:01:17 +0000 (21:01 +0200)]
setpayloadsig: New module.
* lib/math.in.h (setpayloadsig): New declaration.
* lib/setpayloadsig.c: New file, based on lib/setpayload.c.
* m4/setpayloadsig.m4: New file, based on m4/setpayload.m4.
* m4/math_h.m4 (gl_MATH_H): Test whether setpayloadsig is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_SETPAYLOADSIG.
(gl_MATH_H_DEFAULTS): Initialize HAVE_SETPAYLOADSIG.
* modules/math (Makefile.am): Substitute GNULIB_SETPAYLOADSIG,
HAVE_SETPAYLOADSIG.
* modules/setpayloadsig: New file.
* doc/posix-functions/setpayloadsig.texi: Mention the new module.
Bruno Haible [Tue, 16 Apr 2024 22:38:07 +0000 (00:38 +0200)]
setpayloadl: Fix platform-specific bugs.
* lib/setpayloadl.c (setpayloadl): On m68k, consider the actual memory
layout of a 'long double'. On platforms with quadruple-precision
'long double', store 111 bits of payload, not only 110 bits.
* pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Use a set to
represent the unconditional modules instead of a dictionary. Remove
redundant comments.
(GLModuleTable.addUnconditional): Add the module to a set instead of
using it as a key to the dictionary.
gnulib-tool.py: Don't use mutable default arguments.
* pygnulib/GLFileSystem.py (GLFileAssistant.__init__): Set the default
argument for 'transformers' to None. If it is None then set it to an
empty dictionary in the body.
Bruno Haible [Sat, 13 Apr 2024 23:38:42 +0000 (01:38 +0200)]
bootstrap: Implement phase 1 as documented in the --help output.
Reported by Simon Josefsson as bug #1 in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00152.html>.
* top/bootstrap: Correct indentation.
* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): Implement as
documented:
If GNULIB_SRCDIR and GNULIB_REVISION are set and there is a 'gnulib'
submodule, checkout the revision GNULIB_REVISION.
If GNULIB_SRCDIR and GNULIB_REVISION are set and --no-git is specified,
don't checkout the revision GNULIB_REVISION.
Bruno Haible [Sat, 13 Apr 2024 22:08:50 +0000 (00:08 +0200)]
bootstrap: Simplify git submodule initialization.
* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): Err out if git is
older than version 1.6.4. Remove fallback code for older versions.
* build-aux/bootstrap: Regenerated.
* pygnulib/GLConfig.py (GLConfig.update): Use list-merging for the test
categories.
* pygnulib/GLImport.py (GLImport.__init__): Don't merge back those
values which were already considered by taking the union.
* pygnulib/GLConfig.py (GLConfig.update): Don't test for the unused key
'tests'.
(GLConfig.default): Likewise.
* pygnulib/GLImport.py (GLImport.__init__): Don't merge back those
values which were already considered by taking the union.
* pygnulib/GLConfig.py (GLConfig.update): Don't test for the unused key
'tests'.
* pygnulib/GLImport.py (GLImport.__init__): Don't merge back those
values which were already considered by taking the union.
* pygnulib/GLConfig.py (GLConfig.default): For 'conddeps', return None,
not False.
(GLConfig.checkCondDeps): Update result type.
(resetCondDeps): Reset to return None, not False.
* pygnulib/GLImport.py (GLImport.actioncmd): Update.
* pygnulib/GLConfig.py (GLConfig.default): For 'conddeps', return None,
not False.
(GLConfig.checkCondDeps): Update result type.
(resetCondDeps): Reset to return None, not False.
* pygnulib/GLImport.py (GLImport.actioncmd): Update.
* pygnulib/GLConfig.py (GLConfig.default): For 'libtool', return None,
not False.
(GLConfig.checkLibtool): Update result type.
(resetLibtool): Reset to return None, not False.
* pygnulib/GLImport.py (GLImport.actioncmd): Update.
Bruno Haible [Fri, 12 Apr 2024 14:32:37 +0000 (16:32 +0200)]
gnulib-tool.py: Fix parsing of gnulib-cache.m4.
* pygnulib/GLImport.py (GLImport.__init__): While parsing
gnulib-cache.m4, stop parsing the identifier starting with 'gl_' when
encountering a character that is not a uppercase letter, digit, or
underscore.
Bruno Haible [Thu, 11 Apr 2024 19:49:45 +0000 (21:49 +0200)]
gnulib-tool.py: Optimize module set lookups.
* gnulib-tool.py (profiler_args): New variable.
* pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Turn
handledmodules into a set.
(GLModuleTable.transitive_closure_separately): For the 'in' test, use
a set variable main_modules_set.
gnulib-tool.py: Remove redundant backslashes from regexps.
* pygnulib/GLTestDir.py (GLTestDir.execute): Don't backslash ']' when it
is outside of a set.
* pygnulib/GLImport.py (GLImport.__init__): Don't use a backslash when
']' is at the start of a '[...]' set. Don't backslash special characters
in a '[...]' set since they have their meaning dropped.
* pygnulib/main.py (main): Likewise.
Bruno Haible [Wed, 10 Apr 2024 23:55:05 +0000 (01:55 +0200)]
gnulib-tool.py: Skip nonexistent modules instead of failing.
* pygnulib/GLModuleSystem.py (GLModuleSystem.find): Use the same warning
wording as gnulib-tool.sh.
* pygnulib/GLImport.py (GLImport.gnulib_cache): Print the specified
modules, not the base modules.
(GLImport.prepare): Don't put None elements into base_modules.
gnulib-tool.py: Use function arguments instead of magic numbers.
* pygnulib/GLEmiter.py (GLEmiter.autoconfSnippets): Remove the
'verifier' integer flag argument. Add the 'module_filter' function
argument. Use it to determine if Autoconf snippets should be printed for
each module.
* pygnulib/GLImport.py (GLImport.gnulib_comp): Update call to use a
lambda function.
* pygnulib/GLTestDir.py (GLTestDir.execute): Likewise.
gnulib-tool.py: Change the avoid list to a set for lookups.
* pygnulib/GLModuleSystem.py (GLModuleSystem.__init__): Store the
avoided modules in a set instead of a list. This is used only for
membership checks when computing the transitive closure of the given
modules, therefore prefer the O(1) average case over O(n).
gnulib-tool.py: Simplify use of GLModuleTable accessors.
* pygnulib/GLModuleSystem.py (GLModuleTable.__getitem__): Remove
function.
* pygnulib/GLImport.py (GLImport.gnulib_cache, GLImport.gnulib_comp)
(GLImport.execute): Use function calls on the GLModuleTable to access
module lists instead of using keys to emulate a dictionary.
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'.
gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'.
* pygnulib/*.py: Change occurrences '+= [item]' to use '.append(item)'
where item is a single element added to the list.
See discussion here:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00091.html>
* pygnulib/GLModuleSystem.py (GLModuleTable.getCondition): Add None to
the return type hint. This is the return value when the module is not a
conditional dependency.
gnulib-tool.py: Remove an unused and incorrect function.
* pygnulib/GLFileSystem.py (GLFileAssistant.removeFile): Remove this
unused function. The correct method of removing an element from a list
is to use the remove() function, not pop() which takes an index.
gnulib-tool.py: Omit some unnecessary list() calls around sorted().
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Remove the list()
call in the argument to sorted. The sorted() function works on any
iterable and always returns a list.
* pygnulib/GLImport.py (GLImport.rewrite_old_files)
(GLImport.rewrite_new_files): Likewise.
* pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure)
(GLModuleTable.transitive_closure_separately): Likewise.
* pygnulib/GLTestDir.py (GLTestDir.rewrite_files): Likewise.
Reported by Collin Funk in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00036.html>.
* m4/pthread_h.m4 (gl_PTHREAD_H_PART1): New macro, extracted from
gl_PTHREAD_H.
(gl_PTHREAD_H): Require it. Define using AC_DEFUN.
* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Require gl_PTHREAD_H_PART1,
not only gl_PTHREAD_H_DEFAULTS.