Bruno Haible [Tue, 24 Dec 2024 10:22:40 +0000 (11:22 +0100)]
threads-h: Support several gnulib-tool invocations better.
* lib/threads.in.h (_GL_ALREADY_INCLUDING_THREADS_H): Rename to a macro
that depends on GUARD_PREFIX.
(struct thrd_with_exitcode): Avoid duplicate definition.
Bruno Haible [Tue, 24 Dec 2024 10:21:51 +0000 (11:21 +0100)]
sys_socket: Support several gnulib-tool invocations better.
* lib/sys_socket.in.h (_GL_ALREADY_INCLUDING_SYS_SOCKET_H): Rename to a
macro that depends on GUARD_PREFIX.
(struct msghdr): Avoid duplicate definition.
Bruno Haible [Tue, 24 Dec 2024 10:19:49 +0000 (11:19 +0100)]
stdio: Support several gnulib-tool invocations better.
* lib/stdio.in.h: Test _GL_SKIP_GNULIB_STDIO_H.
(_GL_ALREADY_INCLUDING_STDIO_H): Rename to a macro that depends on
GUARD_PREFIX.
* lib/fopen.c: Set _GL_SKIP_GNULIB_STDIO_H instead of
_GL_ALREADY_INCLUDING_STDIO_H.
* lib/freopen.c: Likewise.
Paul Eggert [Mon, 23 Dec 2024 20:57:12 +0000 (12:57 -0800)]
stdlib: fix MB_CUR_MAX on older Android
Android NDK r16 MB_CUR_MAX doesn’t link when compiling C.
Problem found in GNU Emacs, which worked around it this way:
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=39a7e6b79fdeafc539a36f6831d922a2622cb679
... but this ran afoul of the recent Gnulib change that
added lib/stdlib.c.
* lib/stdlib.in.h (gl_MB_CUR_MAX): If @REPLACE_MB_CUR_MAX@
is positive, use its value directly.
* m4/stdlib_h.m4 (gl_STDLIB_H): Set REPLACE_MB_CUR_MAX to (-1)
if the Solaris bug, and to 4 if the Android bug. Use AS_CASE
so that Emacs can navigate this code better.
* tests/test-stdlib.c (main): Check that MB_CUR_MAX compiles
and is nonzero.
Bruno Haible [Mon, 23 Dec 2024 15:59:20 +0000 (16:59 +0100)]
mbrtowc tests: Test in the UTF-8 environment on native Windows.
* tests/test-mbrtowc-w32utf8.sh: New file.
* tests/test-mbrtowc-w32utf8.c: New file.
* modules/mbrtowc-tests (Files): Add these files and
m4/windows-rc.m4, tests/windows-utf8.rc, tests/windows-utf8.manifest.
(Depends-on): Add test-xfail.
(configure.ac): Invoke gl_WINDOWS_RC.
(Makefile.am): Arrange to compile test-mbrtowc-w32utf8 and run
test-mbrtowc-w32utf8.sh.
Bruno Haible [Mon, 23 Dec 2024 15:58:53 +0000 (16:58 +0100)]
setlocale tests: Test in the UTF-8 environment on native Windows.
* tests/test-setlocale-w32utf8.sh: New file.
* tests/test-setlocale-w32utf8.c: New file.
* modules/setlocale-tests (Files): Add these files and
m4/windows-rc.m4, tests/windows-utf8.rc, tests/windows-utf8.manifest.
(Depends-on): Add test-xfail.
(configure.ac): Invoke gl_WINDOWS_RC.
(Makefile.am): Arrange to compile test-setlocale-w32utf8 and run
test-setlocale-w32utf8.sh.
Bruno Haible [Mon, 23 Dec 2024 15:57:15 +0000 (16:57 +0100)]
setlocale: Support the UTF-8 environment on native Windows.
* lib/setlocale.c: Include <windows.h>.
(setlocale_unixlike): In the UTF-8 environment, append a suffix ".65001"
to the locale names passed to the native setlocale().
Bruno Haible [Mon, 23 Dec 2024 15:57:02 +0000 (16:57 +0100)]
localename tests: Test in the UTF-8 environment on native Windows.
* tests/test-localename-w32utf8.sh: New file.
* tests/test-localename-w32utf8.c: New file.
* modules/localename-tests (Files): Add these files and
m4/windows-rc.m4, tests/windows-utf8.rc, tests/windows-utf8.manifest.
(Depends-on): Add test-xfail.
(configure.ac): Invoke gl_WINDOWS_RC.
(Makefile.am): Arrange to compile test-localename-w32utf8 and run
test-localename-w32utf8.sh.
Bruno Haible [Mon, 23 Dec 2024 15:56:37 +0000 (16:56 +0100)]
localcharset tests: Test in the UTF-8 environment on native Windows.
* m4/windows-rc.m4: New file.
* tests/test-localcharset-w32utf8.sh: New file.
* tests/test-localcharset-w32utf8.c: New file.
* tests/windows-utf8.rc: New file.
* tests/windows-utf8.manifest: New file.
* modules/localcharset-tests (Files): Add these files.
(Depends-on): Add test-xfail.
(configure.ac): Invoke gl_WINDOWS_RC.
(Makefile.am): Arrange to compile test-localcharset-w32utf8 and run
test-localcharset-w32utf8.sh.
Bruno Haible [Sun, 22 Dec 2024 11:03:22 +0000 (12:03 +0100)]
test-framework-sh: Avoid test suite failures on MSYS2.
* tests/init.sh (compare_) [MSys]: Use a temporary file on MSYS2.
* tests/test-update-copyright.sh: Use the test framework.
(compare): Remove function.
* modules/update-copyright-tests (Depends-on): Add test-framework-sh.
Bruno Haible [Sun, 22 Dec 2024 03:38:48 +0000 (04:38 +0100)]
execl, execle, execlp: Fix compilation error with gcc 14.
* lib/execl.c (execl): Cast second argument of execv.
* lib/execle.c (execle): Cast second argument of execve.
* lib/execlp.c (execlp): Cast second argument of execvp.
Bruno Haible [Sun, 22 Dec 2024 00:09:17 +0000 (01:09 +0100)]
crc-x86_64: Fix compilation error with clang in a simpler way.
Suggested by Collin Funk.
* modules/crc-x86_64 (Makefile.am): Revert last change.
* lib/crc-x86_64-pclmul.c: Normalize includes.
(crc32_update_no_xor_pclmul): Use __attribute__ ((__target (...))).
* m4/crc-x86_64.m4 (gl_CRC_X86_64_PCLMUL): Use
__attribute__ ((__target (...))) here as well. Don't use modified
CFLAGS.
Pádraig Brady [Wed, 18 Dec 2024 12:53:02 +0000 (12:53 +0000)]
crc-x86_64: fix build failure due to indentation
* modules/crc-x86_64: Remove indentation on lib_SOURCES,
as otherwise it's replaced with libcoreutils_a_SOURCES
rather than the required lib_libcoreutils_a_SOURCES, resulting in:
lib/gnulib.mk:1090: error: libcoreutils_a_SOURCES must be set with '=' before using '+='
lib/gnulib.mk:1090: warning: variable 'libcoreutils_a_SOURCES' is defined but no program or
lib/gnulib.mk:1090: library has 'libcoreutils_a' as canonical name (possible typo)
Sam Russell [Tue, 17 Dec 2024 07:49:50 +0000 (08:49 +0100)]
crc: Add PCLMUL implementation
* lib/crc-x86_64-pclmul.c: Implement CRC32 with PCLMUL intrinsics.
* lib/crc-x86_64.h: Add header for CRC32 with PCLMUL instrinsics.
* lib/crc.c: Use PCLMUL implementation if available.
* m4/crc-x86_64.m4: Detect PCLMUL and build accordingly.
* modules/crc-x86_64: New module for crc-x86_64.
Signed-off-by: Simon Josefsson <simon@josefsson.org>
Paul Eggert [Wed, 11 Dec 2024 20:17:18 +0000 (12:17 -0800)]
doc: isdigit and isxdigit are locale-independent
* doc/posix-functions/isdigit.texi:
* doc/posix-functions/isxdigit.texi:
Document that mingw and MSVC do not conform to the C standard,
which says that isdigit and isxdigit are independent of locale.
Issue pointed out by Florian Weimer in:
https://sourceware.org/pipermail/libc-alpha/2024-December/162362.html
Bruno Haible [Mon, 9 Dec 2024 12:31:23 +0000 (13:31 +0100)]
unicodeio: Use the translation domain "gnulib".
* lib/unicodeio.h (unicode_to_mb): Clarify that the message passed to
the failure callback may already be localized.
* lib/unicodeio.c (unicode_to_mb): For the messages defined in this
file, use the translation domain "gnulib".
Bruno Haible [Mon, 9 Dec 2024 12:18:21 +0000 (13:18 +0100)]
Localizations: Fix omissions from the POT file.
Reported by Benno Schulenberg.
* po/Makefile ($(DOMAIN).pot): Remove the file pre-filtering; just pass
all source files to xgettext.
* po/Makevars (XGETTEXT_OPTIONS): Recognize gettext_noop as a keyword.
Bruno Haible [Mon, 9 Dec 2024 08:51:01 +0000 (09:51 +0100)]
quotearg tests: Fix test failure (regression yesterday).
* tests/testlocale/fr/LC_MESSAGES/gnulib.po: Renamed from
tests/testlocale/fr/LC_MESSAGES/test-quotearg.po.
* tests/testlocale/fr/LC_MESSAGES/gnulib.mo: Renamed from
tests/testlocale/fr/LC_MESSAGES/test-quotearg.mo.
* tests/test-quotearg.c (main): Use bindtextdomain for the domain
"gnulib", not "test-quotearg".
* tests/test-quotearg.sh: Fix typo in comments.
* modules/quotearg-tests (Files): Update.
Bruno Haible [Sun, 8 Dec 2024 17:15:49 +0000 (18:15 +0100)]
Document the new approach for gnulib localization.
* doc/gnulib-tool.texi (Localization): Recommend to use the gnulib-l10n
package. Deprecate the two previous approaches.
* gnulib-tool.sh (func_usage): Deprecate the --po-base and --po-domain
options.
* pygnulib/GLInfo.py (GLInfo.usage): Likewise.
Bruno Haible [Sun, 8 Dec 2024 16:40:53 +0000 (17:40 +0100)]
Add infrastructure for handling gnulib localizations.
* po/Makefile: New file.
* po/Makevars: New file, based on the template from GNU gettext.
* gnulib-l10n/README: New file.
* gnulib-l10n/configure.ac: New file.
* gnulib-l10n/Makefile.am: New file.
* gnulib-l10n/m4/Makefile.am: New file.
* gnulib-l10n/autogen.sh: New file.
* gnulib-l10n/autoclean.sh: New file.
* Makefile (gnulib.pot, gnulib-tp-snapshot, gnulib-l10n-release): New
targets.
Bruno Haible [Sun, 8 Dec 2024 16:13:00 +0000 (17:13 +0100)]
bison-i18n: Improve usability.
* modules/bison-i18n (Depends-on): Remove 'gettext'.
* m4/bison-i18n.m4 (BISON_I18N): Instead of bailing out if there is no
AM_GNU_GETTEXT invocation, just warn. Define BISON_LOCALEDIR also in
config.h, removing the need to do it in the Makefile.
Bruno Haible [Fri, 6 Dec 2024 08:16:37 +0000 (09:16 +0100)]
Update build-aux/po/Makefile.in.in.
Reported by Assaf Gordon in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00045.html>
and by Reuben Thomas <rrt@sc3d.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00020.html>.
* build-aux/po/Makefile.in.in: Sync from GNU gettext 0.23.
Fixes:
- Don't fail when 'make' is used with option -j.
- Pass the option --quiet to 'msgmerge'.
- Simplify by assuming that 'sed' groks comments.
* build-aux/po/remove-potcdate.sed: Renamed from
build-aux/po/remove-potcdate.sin.
* doc/gnulib.texi (Developer tools): Update file list.
* gnulib-tool.sh (func_import): Copy remove-potcdate.sed instead of
remove-potcdate.sin.
* pygnulib/GLImport.py (GLImport.execute): Likewise.
Bruno Haible [Thu, 5 Dec 2024 08:28:13 +0000 (09:28 +0100)]
gnulib-tool.py: Refactor.
* pygnulib/GLModuleSystem.py (GLModuleSystem.getAllModules): Moved here
from GLModule._getAllModules. No need to eliminate empty module names.
(GLModule._getDependents, GLModule.getDependentsRecursively): Update.
Bruno Haible [Thu, 5 Dec 2024 08:14:49 +0000 (09:14 +0100)]
gnulib-tool.py: Remove dead code.
* pygnulib/GLModuleSystem.py (GLModule.getDependents): Remove top_level
parameter. Use the cached value if present.
* pygnulib/main.py: Update accordingly.
Collin Funk [Thu, 5 Dec 2024 02:49:45 +0000 (18:49 -0800)]
gnulib-tool.py: Make --extract-dependents quick again.
Suggested by Bruno Haible in:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-12/msg00012.html>.
* pygnulib/GLModuleSystem.py (GLModule.getDependents): Add an optional
argument to use the implementation before yesterdays change.
* pygnulib/main.py (mode == 'extract-dependents'): Add the optional
argument to call of GLModule.getDependents.
* pygnulib/GLModuleSystem.py (GLModuleSystem.list): Add optional
argument to include test modules.
(GLModule._getDependents) New function.
(GLModule.getDependents): Use it.
(GLModule.getDependentsRecursively): Likewise.
(GLModule._getAllModules): New function.
Paul Eggert [Thu, 21 Nov 2024 01:19:45 +0000 (17:19 -0800)]
tests: omit MEMCHR etc as no longer needed
* tests/test-memchr.c (MEMCHR):
* tests/test-memchr2.c (MEMCHR2):
* tests/test-memrchr.c (MEMRCHR):
* tests/test-rawmemchr.c (RAWMEMCHR):
Remove these macros, as the code never adds to their results.
All uses replaced by original functions.
Paul Eggert [Mon, 18 Nov 2024 16:13:26 +0000 (08:13 -0800)]
openat: omit unnecessary fd test
* lib/openat.c (openat_permissive): Close fd regardless
of whether it’s STDERR_FILENO. This saves a bit of code space
and there’s no point to making this unlikely path faster.
Also change a couple of != 0 to < 0 for clarity
when -1 is the only option.
Paul Eggert [Mon, 18 Nov 2024 15:54:54 +0000 (07:54 -0800)]
openat: don’t lose track of save_cwd errno
* lib/openat.c (openat_permissive): When ‘close’ is called
after save_cwd failed, don’t lose track of save_cwd’s errno.
This fixes a recently-introduced unlikely bug.
Paul Eggert [Wed, 20 Nov 2024 02:29:57 +0000 (18:29 -0800)]
savewd: remove O_SEARCH optimization
* lib/savewd.c (savewd_save): Remove recently-added optimization
for platforms with O_SEARCH, as it does not work on macOS 12.6
due to what seems to be a bug there.