]> Savannah Git Hosting - gnulib.git/log
gnulib.git
2 years agombsnrtoc32s tests: Check behaviour in the C locale.
Bruno Haible [Mon, 3 Apr 2023 12:24:48 +0000 (14:24 +0200)]
mbsnrtoc32s tests: Check behaviour in the C locale.

* tests/test-mbsnrtoc32s.c (main): Test behaviour in the C locale. Based
on tests/test-mbsnrtowcs.c.
* tests/test-mbsnrtoc32s-5.sh: New file, based on
tests/test-mbsrtowcs5.sh.
* modules/mbsnrtoc32s-tests (Files): Add it.
(Depends-on): Add btoc32.
(Makefile.am): Run test-mbsnrtoc32s-5.sh.

2 years agombsrtoc32s tests: Check behaviour in the C locale.
Bruno Haible [Mon, 3 Apr 2023 12:24:45 +0000 (14:24 +0200)]
mbsrtoc32s tests: Check behaviour in the C locale.

* tests/test-mbsrtoc32s.c (main): Test behaviour in the C locale. Based
on tests/test-mbsrtowcs.c.
* tests/test-mbsrtoc32s-5.sh: New file, based on
tests/test-mbsrtowcs5.sh.
* modules/mbsrtoc32s-tests (Files): Add it.
(Depends-on): Add btoc32.
(Makefile.am): Run test-mbsrtoc32s-5.sh.

2 years agobtoc32 tests: Check behaviour in the C locale.
Bruno Haible [Mon, 3 Apr 2023 12:24:42 +0000 (14:24 +0200)]
btoc32 tests: Check behaviour in the C locale.

* tests/test-btoc32.c (main): Test behaviour in the C locale. Based on
tests/test-btowc.c.
* tests/test-btoc32-3.sh: New file, based on tests/test-btowc3.sh.
* modules/btoc32-tests (Files): Add it.
(Makefile.am): Test it.

2 years agombrtoc32 tests: Prefer *c32* functions.
Bruno Haible [Mon, 3 Apr 2023 12:24:39 +0000 (14:24 +0200)]
mbrtoc32 tests: Prefer *c32* functions.

* tests/test-mbrtoc32.c (main): Use btoc32 instead of btowc.
* modules/mbrtoc32-tests (Depends-on): Add btoc32.

2 years agombrtoc32 tests: Add comment.
Bruno Haible [Mon, 3 Apr 2023 12:24:37 +0000 (14:24 +0200)]
mbrtoc32 tests: Add comment.

* m4/mbrtowc.m4 (gl_MBRTOWC_C_LOCALE): Add comment.
* m4/mbrtoc32.m4 (gl_MBRTOC32_C_LOCALE): Add comment.
* tests/test-mbrtoc32.c: Add comment.
* tests/test-mbrtoc32-5.sh: Use symmetric coding style.
* doc/posix-functions/mbrtoc32.texi: Update.

2 years agotrim: Fix trim_trailing result in multibyte locales.
Bruno Haible [Sun, 2 Apr 2023 19:31:36 +0000 (21:31 +0200)]
trim: Fix trim_trailing result in multibyte locales.

* lib/trim.c (IF_LINT): Remove macro.

2 years agotrim: Fix trim_trailing result in multibyte locales.
Bruno Haible [Sun, 2 Apr 2023 19:03:55 +0000 (21:03 +0200)]
trim: Fix trim_trailing result in multibyte locales.

* lib/trim.c (trim2): Simplify algorithm for trim_trailing in multibyte
locales, to use 2 instead of 3 states.

2 years agotrim: Add tests.
Bruno Haible [Sun, 2 Apr 2023 18:40:18 +0000 (20:40 +0200)]
trim: Add tests.

* tests/test-trim.c: New file.
* tests/test-trim1.sh: New file.
* tests/test-trim2.sh: New file.
* tests/test-trim3.sh: New file.
* modules/trim-tests: New file.

2 years agounistr/u8-strstr: Simplify code.
Bruno Haible [Sun, 2 Apr 2023 14:10:05 +0000 (16:10 +0200)]
unistr/u8-strstr: Simplify code.

* lib/unistr/u8-strstr.c: Inline the contents of lib/unistr/u-strstr.h.
* lib/unistr/u-strstr.h: Remove file.
* modules/unistr/u8-strstr (Files): Remove it.

2 years agounistr/u{16,32}-strstr: Use two-way algorithm (no memory allocation).
Bruno Haible [Sun, 2 Apr 2023 14:07:36 +0000 (16:07 +0200)]
unistr/u{16,32}-strstr: Use two-way algorithm (no memory allocation).

* lib/wcs-two-way.h: Use UNIT instead of wchar_t. Don't undefine
RETURN_TYPE.
* lib/wcsstr-impl.h: Move the non-linear implementation away. Use UNIT
instead of wchar_t, RETURN_TYPE instead of 'wchar_t *', FUNC instead of
wcsstr.
(AVAILABLE): Use MEMCHR0 instead of wmemchr.
(FUNC): Use STRCHR instead of wcschr.
* lib/wcsstr.c: Moved the non-linear implementation to here.
(FUNC, UNIT, RETURN_TYPE, MEMCHR0, STRCHR): New macros.
* lib/unistr/u16-strstr.c: Don't include malloca.h, str-kmp.h,
u-strstr.h. Instead, include wcsstr-impl.h.
* lib/unistr/u32-strstr.c: Likewise.
* modules/unistr/u16-strstr (Files): Remove u-strstr.h, str-kmp.h. Add
wcsstr-impl.h, wcs-two-way.h.
(Depends-on): Remove u16-strmbtouc, u16-strlen, u16-strnlen, malloca.
Add u16-chr, u16-cmp.
* modules/unistr/u32-strstr (Files): Remove u-strstr.h, str-kmp.h. Add
wcsstr-impl.h, wcs-two-way.h.
(Depends-on): Remove u32-strlen, u32-strnlen, malloca. Add u32-chr,
u32-cmp.

2 years agounistr/u*strstr tests: Add more tests.
Bruno Haible [Sun, 2 Apr 2023 10:52:44 +0000 (12:52 +0200)]
unistr/u*strstr tests: Add more tests.

* tests/unistr/test-u-strstr.h (test_u_strstr): Add the two latest tests
from tests/test-strstr.c.
* tests/unistr/test-u8-strstr.c (U_SET): New macro.
* tests/unistr/test-u16-strstr.c (U_SET): New macro.
* tests/unistr/test-u32-strstr.c (U_SET): New macro.
* modules/unistr/u8-strstr-tests (Depends-on): Add unistr/u8-set.
* modules/unistr/u16-strstr-tests (Depends-on): Add unistr/u16-set.
* modules/unistr/u32-strstr-tests (Depends-on): Add unistr/u32-set.

2 years agovasnwprintf-posix: Fix behaviour in the C locale.
Bruno Haible [Sat, 1 Apr 2023 12:51:22 +0000 (14:51 +0200)]
vasnwprintf-posix: Fix behaviour in the C locale.

* lib/vasnprintf.c (VASNPRINTF): If NEED_WPRINTF_DIRECTIVE_C is set,
implement the 'c' directive here.
* m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke gl_MBRTOWC_C_LOCALE.
If mbrtowc is buggy in the C locale, define NEED_WPRINTF_DIRECTIVE_C.
* modules/vasnwprintf (Files): Add m4/mbrtowc.m4.
* tests/test-vasnwprintf-posix.c (test_function): Add tests of %s and %c
in the C locale.
* doc/posix-functions/fwprintf.texi: Mention the C locale behaviour bug.
* doc/posix-functions/swprintf.texi: Likewise.
* doc/posix-functions/vfwprintf.texi: Likewise.
* doc/posix-functions/vswprintf.texi: Likewise.
* doc/posix-functions/vwprintf.texi: Likewise.
* doc/posix-functions/wprintf.texi: Likewise.

2 years agovasnprintf-posix: Fix crash in narrow %lc directive (regr. 2023-03-21).
Bruno Haible [Sat, 1 Apr 2023 09:45:23 +0000 (11:45 +0200)]
vasnprintf-posix: Fix crash in narrow %lc directive (regr. 2023-03-21).

* lib/vasnprintf.c (VASNPRINTF): Negative results of local_wcrtomb can
now occur; handle them.
* tests/test-vasnprintf-posix.c (test_function): Test %lc directive with
a wint_t argument that is not a valid wide character.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.

2 years agostddef: Fix __need_wint_t handling in case of two stddef.h overrides.
Bruno Haible [Sat, 1 Apr 2023 08:56:40 +0000 (10:56 +0200)]
stddef: Fix __need_wint_t handling in case of two stddef.h overrides.

* lib/stddef.in.h: Replace _GL_STDDEF_WINT_T with a symbol that depends
on the @GUARD_PREFIX@.

2 years agovasnwprintf: Fix crash upon conversion failure when processing %s.
Bruno Haible [Fri, 31 Mar 2023 11:42:49 +0000 (13:42 +0200)]
vasnwprintf: Fix crash upon conversion failure when processing %s.

* lib/vasnprintf.c (VASNPRINTF): When processing %s with !has_precision
and !has_width, don't call abort() if there is a conversion failure.

2 years agoAvoid test failures on Android.
Bruno Haible [Fri, 31 Mar 2023 02:44:56 +0000 (04:44 +0200)]
Avoid test failures on Android.

* tests/test-btowc.c (main): Treat C locale like in
tests/test-mbrtowc.c.
* tests/test-mbsrtowcs.c (main): Likewise.
* tests/test-mbsnrtowcs.c (main): Likewise.
* tests/test-mbstowcs.c (main): Likewise.

2 years agombstowcs: Add tests.
Bruno Haible [Thu, 30 Mar 2023 22:30:39 +0000 (00:30 +0200)]
mbstowcs: Add tests.

* tests/test-mbstowcs1.sh: New file, based on tests/test-mbsrtowcs1.sh.
* tests/test-mbstowcs2.sh: New file, based on tests/test-mbsrtowcs2.sh.
* tests/test-mbstowcs3.sh: New file, based on tests/test-mbsrtowcs3.sh.
* tests/test-mbstowcs4.sh: New file, based on tests/test-mbsrtowcs4.sh.
* tests/test-mbstowcs5.sh: New file, based on tests/test-mbsrtowcs5.sh.
* tests/test-mbstowcs.c: New file, based on tests/test-mbsrtowcs.c.
* modules/mbstowcs-tests: New file, based on modules/mbsrtowcs-tests.

2 years agombstowcs: New module.
Bruno Haible [Thu, 30 Mar 2023 22:27:20 +0000 (00:27 +0200)]
mbstowcs: New module.

* lib/stdlib.in.h (mbstowcs): New declaration.
* lib/mbstowcs.c: New file, based on lib/mbstoc32s.c.
* m4/mbstowcs.m4: New file.
* m4/stdlib_h.m4 (gl_STDLIB_H): Test whether mbstowcs is declared.
(gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize GNULIB_MBSTOWCS.
(gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MBSTOWCS.
* modules/stdlib (Makefile.am): Substitute GNULIB_MBSTOWCS,
REPLACE_MBSTOWCS.
* modules/mbstowcs: New file.
* tests/test-stdlib-c++.cc (mbstowcs): Check signature.
* doc/posix-functions/mbstowcs.texi: Mention the C locale behaviour bug
and the new module.

2 years agombsnrtowcs: Fix behaviour in the C locale.
Bruno Haible [Thu, 30 Mar 2023 21:15:52 +0000 (23:15 +0200)]
mbsnrtowcs: Fix behaviour in the C locale.

* m4/mbsnrtowcs.m4 (gl_FUNC_MBSNRTOWCS): Invoke gl_MBRTOWC_C_LOCALE. If
mbrtowc is buggy in the C locale, override also mbsnrtowcs.
* modules/mbsnrtowcs (Files): Add m4/mbrtowc.m4.
* tests/test-mbsnrtowcs.c (main): Add a test of the C locale, based on
tests/test-mbsrtowcs.c.
* tests/test-mbsnrtowcs5.sh: New file, based on tests/test-mbrtowc5.sh.
* modules/mbsnrtowcs-tests (Files): Add it.
(Makefile.am): Test it.
* doc/posix-functions/mbsnrtowcs.texi: Mention the C locale behaviour
bug.

2 years agombsrtowcs: Fix behaviour in the C locale.
Bruno Haible [Thu, 30 Mar 2023 21:12:50 +0000 (23:12 +0200)]
mbsrtowcs: Fix behaviour in the C locale.

* m4/mbsrtowcs.m4 (gl_FUNC_MBSRTOWCS): Invoke gl_MBRTOWC_C_LOCALE. If
mbrtowc is buggy in the C locale, override also mbsrtowcs.
* modules/mbsrtowcs (Files): Add m4/mbrtowc.m4.
* tests/test-mbsrtowcs.c (main): Add a test of the C locale, based on
tests/test-mbrtowc.c.
* tests/test-mbsrtowcs5.sh: New file, based on tests/test-mbrtowc5.sh.
* modules/mbsrtowcs-tests (Files): Add it.
(Makefile.am): Test it.
* doc/posix-functions/mbsrtowcs.texi: Mention the C locale behaviour
bug.

2 years agombrlen: Add tests.
Bruno Haible [Thu, 30 Mar 2023 15:55:31 +0000 (17:55 +0200)]
mbrlen: Add tests.

* tests/test-mbrlen1.sh: New file, based on tests/test-mbrtowc1.sh.
* tests/test-mbrlen2.sh: New file, based on tests/test-mbrtowc2.sh.
* tests/test-mbrlen3.sh: New file, based on tests/test-mbrtowc3.sh.
* tests/test-mbrlen4.sh: New file, based on tests/test-mbrtowc4.sh.
* tests/test-mbrlen5.sh: New file, based on tests/test-mbrtowc5.sh.
* tests/test-mbrlen.c: New file, based on tests/test-mbrtowc.c.
* tests/test-mbrlen-w32-1.sh: New file, based on
tests/test-mbrtowc-w32-1.sh.
* tests/test-mbrlen-w32-2.sh: New file, based on
tests/test-mbrtowc-w32-2.sh.
* tests/test-mbrlen-w32-3.sh: New file, based on
tests/test-mbrtowc-w32-3.sh.
* tests/test-mbrlen-w32-4.sh: New file, based on
tests/test-mbrtowc-w32-4.sh.
* tests/test-mbrlen-w32-5.sh: New file, based on
tests/test-mbrtowc-w32-5.sh.
* tests/test-mbrlen-w32-6.sh: New file, based on
tests/test-mbrtowc-w32-6.sh.
* tests/test-mbrlen-w32-7.sh: New file, based on
tests/test-mbrtowc-w32-7.sh.
* tests/test-mbrlen-w32.c: New file, based on tests/test-mbrtowc-w32.c.
* modules/mbrlen-tests: New file, based on modules/mbrtowc-tests.
* doc/posix-functions/mbrlen.texi: Update.

2 years agobtowc: Fix behaviour in the C locale.
Bruno Haible [Thu, 30 Mar 2023 11:25:20 +0000 (13:25 +0200)]
btowc: Fix behaviour in the C locale.

* lib/btowc.c: Include <string.h>
(btowc): Use mbrtowc instead of mbtowc when possible.
* m4/btowc.m4 (gl_FUNC_BTOWC): Test for the mingw bug in the C locale.
Invoke gl_MBRTOWC_C_LOCALE. If mbrtowc is buggy in the C locale,
override also btowc.
(gl_PREREQ_BTOWC): Test whether mbrtowc exists.
* modules/btowc (Files): Add m4/mbrtowc.m4.
(Depends-on): Add mbrtowc.
* tests/test-btowc.c (main): Add a test of the C locale, based on
tests/test-mbrtowc.c.
* tests/test-btowc3.sh: New file, based on tests/test-mbrtowc5.sh.
* modules/btowc-tests (Files): Add it.
(Makefile.am): Test it.
* doc/posix-functions/btowc.texi: Mention the two C locale behaviour
bugs and that they are worked around.

2 years agombrtowc tests: Add comment.
Bruno Haible [Thu, 30 Mar 2023 11:20:29 +0000 (13:20 +0200)]
mbrtowc tests: Add comment.

* tests/test-mbrtowc.c: Add comment.
* tests/test-mbrtowc5.sh: Use symmetric coding style.
* doc/posix-functions/mbrtowc.texi: Update.

2 years agostdlib tests: Check behaviour of C locale.
Bruno Haible [Thu, 30 Mar 2023 10:25:05 +0000 (12:25 +0200)]
stdlib tests: Check behaviour of C locale.

* tests/test-stdlib.c (main): Check MB_CUR_MAX.

2 years agostring-desc tests: Fix "make distcheck" failure.
Bruno Haible [Thu, 30 Mar 2023 12:28:16 +0000 (14:28 +0200)]
string-desc tests: Fix "make distcheck" failure.

* tests/test-string-desc.sh: Run the test in a subdir.

2 years agosnprintf: Avoid autoconf warning regarding gl_PRINTF_POSITIONS.
Bruno Haible [Thu, 30 Mar 2023 10:52:14 +0000 (12:52 +0200)]
snprintf: Avoid autoconf warning regarding gl_PRINTF_POSITIONS.

* m4/printf.m4 (gl_PRINTF_POSITIONS): Define through AC_DEFUN_ONCE.

2 years agodoc: Document string-desc and related modules.
Bruno Haible [Tue, 28 Mar 2023 22:31:47 +0000 (00:31 +0200)]
doc: Document string-desc and related modules.

* doc/string-desc.texi: New file.
* doc/gnulib.texi (Particular Modules): Include it.

2 years agostring-desc-quotearg: Add tests.
Bruno Haible [Tue, 28 Mar 2023 22:27:37 +0000 (00:27 +0200)]
string-desc-quotearg: Add tests.

* tests/test-string-desc-quotearg.c: New file.
* modules/string-desc-quotearg-tests: New file.

2 years agostring-desc-quotearg: New module.
Bruno Haible [Tue, 28 Mar 2023 22:26:51 +0000 (00:26 +0200)]
string-desc-quotearg: New module.

* lib/string-desc-quotearg.h: New file.
* lib/string-desc-quotearg.c: New file.
* modules/string-desc-quotearg: New file.

2 years agoxstring-desc: Add tests.
Bruno Haible [Tue, 28 Mar 2023 22:25:50 +0000 (00:25 +0200)]
xstring-desc: Add tests.

* tests/test-xstring-desc.c: New file.
* modules/xstring-desc-tests: New file.

2 years agoxstring-desc: New module.
Bruno Haible [Tue, 28 Mar 2023 22:24:57 +0000 (00:24 +0200)]
xstring-desc: New module.

* lib/xstring-desc.h: New file.
* lib/xstring-desc.c: New file.
* modules/xstring-desc: New file.

2 years agostring-desc: Add tests.
Bruno Haible [Tue, 28 Mar 2023 22:23:55 +0000 (00:23 +0200)]
string-desc: Add tests.

* tests/test-string-desc.sh: New file.
* tests/test-string-desc.c: New file.
* modules/string-desc-tests: New file.

2 years agostring-desc: New module.
Bruno Haible [Tue, 28 Mar 2023 22:22:17 +0000 (00:22 +0200)]
string-desc: New module.

* lib/string-desc.h: New file.
* lib/string-desc.c: New file.
* lib/string-desc-contains.c: New file.
* modules/string-desc: New file.

2 years agoautoupdate
Karl Berry [Tue, 28 Mar 2023 15:41:22 +0000 (08:41 -0700)]
autoupdate

2 years agodoc: Fix placement of memset_explicit node.
Bruno Haible [Tue, 28 Mar 2023 12:06:06 +0000 (14:06 +0200)]
doc: Fix placement of memset_explicit node.

* doc/posix-functions/memset_explicit.texi: Define a section, not a
subsection.

2 years agodoc: Update regarding linear string search.
Bruno Haible [Tue, 28 Mar 2023 11:13:55 +0000 (13:13 +0200)]
doc: Update regarding linear string search.

* doc/glibc-functions/memmem.texi: Update platforms list.
* doc/posix-functions/strstr.texi: Likewise.
* doc/glibc-functions/strcasestr.texi: Likewise.

2 years agoialloc: Add comments.
Bruno Haible [Tue, 28 Mar 2023 00:18:02 +0000 (02:18 +0200)]
ialloc: Add comments.

* lib/ialloc.h (imalloc, irealloc, icalloc, ireallocarray): Add
comments.

2 years agoSupport FALLTHROUGH macro better in glibc+clang.
Paul Eggert [Mon, 27 Mar 2023 17:22:35 +0000 (19:22 +0200)]
Support FALLTHROUGH macro better in glibc+clang.

* lib/fnmatch.c (FALLTHROUGH): Use __attribute__ ((__fallthrough__))
also in clang >= 10.
* lib/fts.c (FALLTHROUGH): Likewise.
* lib/regex_internal.h (FALLTHROUGH): Likewise.

2 years agowcsstr: Ensure worst-case linear execution time.
Bruno Haible [Mon, 27 Mar 2023 13:41:30 +0000 (15:41 +0200)]
wcsstr: Ensure worst-case linear execution time.

* lib/wchar.in.h (wcsstr): Consider REPLACE_WCSSTR.
* lib/wcs-two-way.h: New file, based on lib/str-two-way.h.
* lib/wcsstr-impl.h: If requested, use the two-way algorithm. New code
based on lib/strstr.c.
* m4/wcsstr.m4 (gl_FUNC_WCSSTR_SIMPLE): Renamed from gl_FUNC_WCSSTR.
(gl_FUNC_WCSSTR): New macro, based on gl_FUNC_STRSTR in m4/strstr.m4.
* m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WCSSTR.
* modules/wchar (Makefile.am): Substitute REPLACE_WCSSTR.
* modules/wcsstr-simple: New file, based on modules/wcsstr.
* modules/wcsstr (Description): Document that this module now provides
an efficient implementation.
(Files): Add lib/wcs-two-way.h.
(Depends-on): Depend on wcsstr-simple and the dependencies of the
two-way implementation.
(configure.ac): Use AC_LIBOBJ instead of a conditional. Don't invoke
gl_WCHAR_MODULE_INDICATOR.
(Makefile.am): Don't augment lib_SOURCES.
* tests/test-wcsstr.c: New file, based on tests/test-strstr.c.
* modules/wcsstr-tests: New file, based on modules/strstr-tests.
* doc/posix-functions/wcsstr.texi: Mention the worst-case complexity.
Mention the new 'wcsstr-simple' module.
* doc/posix-functions/strstr.texi: Fix typo.

2 years agoAdd test case from a past musl libc bug.
Bruno Haible [Mon, 27 Mar 2023 13:13:41 +0000 (15:13 +0200)]
Add test case from a past musl libc bug.

* tests/test-strstr.c (main): Add test of periodic needle.
* tests/test-strcasestr.c (main): Likewise.
* tests/test-c-strstr.c (main): Likewise.
* tests/test-c-strcasestr.c (main): Likewise.
* tests/test-memmem.c (main): Likewise.

2 years agouchar: ISO C 23: Define char8_t.
Bruno Haible [Mon, 27 Mar 2023 10:30:46 +0000 (12:30 +0200)]
uchar: ISO C 23: Define char8_t.

* lib/uchar.in.h (char8_t): New type or macro.
* m4/uchar_h.m4 (gl_TYPE_CHAR8_T): New macro.
(gl_UCHAR_H): Invoke it. Set CXX_HAS_CHAR8_TYPE.
* modules/uchar (Makefile.am): Substitute CXX_HAS_CHAR8_TYPE,
GNULIBHEADERS_OVERRIDE_CHAR8_T.
* tests/test-uchar.c: Add tests for char8_t.

2 years agostdlib: ISO C 23: Document issue with once_flag and call_once.
Bruno Haible [Sat, 25 Mar 2023 20:48:31 +0000 (21:48 +0100)]
stdlib: ISO C 23: Document issue with once_flag and call_once.

* doc/posix-headers/stdlib.texi: Document issue and workaround.

2 years agocall_once: New module, separate from mtx.
Bruno Haible [Sat, 25 Mar 2023 19:54:29 +0000 (20:54 +0100)]
call_once: New module, separate from mtx.

* lib/threads.in.h (call_once): Declare as part of module 'call_once',
not module 'mtx'.
* lib/call_once.c: New file, extracted from lib/mtx.c.
* lib/mtx.c (call_once): Remove function.
* m4/threads_h.m4 (gl_THREADS_H_REQUIRE_DEFAULTS): Inititalize
GNULIB_CALL_ONCE.
* modules/threads-h (Makefile.am): Substitute GNULIB_CALL_ONCE.
* modules/call_once: New file, based on modules/mtx.
* modules/threads (Depends-on): Add call_once.
* tests/test-threads-c++.cc: Update accordingly.
* modules/call_once-tests: New file, based on modules/mtx-tests.
* modules/mtx-tests (Files): Remove tests/test-call_once.c.
(Makefile.am): Don't compile test-call_once.
* doc/posix-functions/call_once.texi: Document that the relevant module
is now 'call_once'.
* NEWS: Mention the change.

2 years agostdio: ISO C 23: Define _PRINTF_NAN_LEN_MAX.
Bruno Haible [Sat, 25 Mar 2023 18:36:31 +0000 (19:36 +0100)]
stdio: ISO C 23: Define _PRINTF_NAN_LEN_MAX.

* lib/stdio.in.h (_PRINTF_NAN_LEN_MAX): New macro.
* m4/stdio_h.m4 (gl_STDIO_H): Invoke gl_MUSL_LIBC.
* modules/stdio (Files): Add m4/musl.m4.
* tests/test-stdio.c: Check that _PRINTF_NAN_LEN_MAX is defined.
Include nan.h, macros.h.
(main): Check the value of _PRINTF_NAN_LEN_MAX.
* modules/stdio-tests (Files): Add tests/nan.h, tests/macros.h,
m4/exponentd.m4.
(configure.ac): Invoke gl_DOUBLE_EXPONENT_LOCATION.

2 years agoMake some header file tests a bit stronger.
Bruno Haible [Sat, 25 Mar 2023 18:31:14 +0000 (19:31 +0100)]
Make some header file tests a bit stronger.

* tests/test-float.c: Include fpucw.h and macros.h only after checking
the macros.
* tests/test-glob-h.c: Include macros.h only after checking the types
and macros.
* tests/test-inttypes.c: Don't include <stddef.h>.
* tests/test-math.c: Include <limits.h> and macros.h only after checking
the types and macros.
* tests/test-stddef.c: Include <limits.h> only after checking the types
and macros.
* tests/test-sys_select.c: Include signature.h only after checking the
types.
* tests/test-sys_socket.c: Include <errno.h> only after checking the
types and macros.
* tests/test-wctype-h.c: Include macros.h only after checking the types.

2 years agois* tests: Ensure needed .m4 files are packaged.
Bruno Haible [Sat, 25 Mar 2023 17:40:24 +0000 (18:40 +0100)]
is* tests: Ensure needed .m4 files are packaged.

* modules/isfinite-tests (Files): Add m4/exponent*.m4.
* modules/isnan-tests (Files): Likewise.
* modules/isnanf-tests (Files): Add m4/exponentf.m4.
* modules/isnanf-nolibm-tests (Files): Likewise.
* modules/isnand-tests (Files): Add m4/exponentd.m4.
* modules/isnand-nolibm-tests (Files): Likewise.
* modules/isnanl-tests (Files): Add m4/exponentl.m4.
* modules/isnanl-nolibm-tests (Files): Likewise.
* modules/isinf-tests (Files): Reorder.

2 years ago*printf-posix: ISO C 23: Support size specifiers 'wN' and 'wfN'.
Bruno Haible [Fri, 24 Mar 2023 21:14:09 +0000 (22:14 +0100)]
*printf-posix: ISO C 23: Support size specifiers 'wN' and 'wfN'.

* lib/printf-args.h: Include <stdint.h>.
(arg_type): Add TYPE_[U]INT8_T, ..., TYPE_[U]INT_FAST64_T and
TYPE_COUNT_INT8_T_POINTER, ..., TYPE_COUNT_INT_FAST64_T_POINTER.
(argument): Add the union members a_[u]int8_t, ..., a_[u]int_fast64_t
and a_count_int8_t_pointer, ..., a_count_int_fast64_t_pointer.
* lib/printf-args.c: Include <limits.h>.
(PRINTF_FETCHARGS): Handle TYPE_[U]INT8_T, ..., TYPE_[U]INT_FAST64_T and
TYPE_COUNT_INT8_T_POINTER, ..., TYPE_COUNT_INT_FAST64_T_POINTER.
* lib/printf-parse.c (PRINTF_PARSE): Accept only one size specifier, not
a sequence of size specifiers. Accept "wN" and "wfN", where N = 8, 16,
32, 64.
* lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Handle the new TYPE_*
values as well.
* m4/printf.m4 (gl_PRINTF_SIZES_C23): New macro.
* m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Require
gl_PRINTF_SIZES_C23. Test gl_cv_func_printf_sizes_c23.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): Likewise.
* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX):
Likewise.
* m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): Likewise.
* m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): Likewise.
* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Likewise.
* m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): Likewise.
* m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): Likewise.
* m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise.
* m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise.
* tests/test-vasnprintf-posix.c (test_function): Add tests for size
specifiers with %d, %u, %b, %o, %x.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* modules/vasnprintf (Depends-on): Add limits-h.
* modules/vasnwprintf (Depends-on): Add limits-h.
* modules/c-vasnprintf (Depends-on): Add limits-h, stdint.
* modules/unistdio/u-printf-args (Depends-on): Add stdint, limits-h.
* doc/posix-functions/dprintf.texi: Mention the ISO C 23 size
specifiers.
* doc/posix-functions/fprintf.texi: Likewise.
* doc/posix-functions/fwprintf.texi: Likewise.
* doc/posix-functions/printf.texi: Likewise.
* doc/posix-functions/snprintf.texi: Likewise.
* doc/posix-functions/sprintf.texi: Likewise.
* doc/posix-functions/swprintf.texi: Likewise.
* doc/posix-functions/vdprintf.texi: Likewise.
* doc/posix-functions/vfprintf.texi: Likewise.
* doc/posix-functions/vfwprintf.texi: Likewise.
* doc/posix-functions/vprintf.texi: Likewise.
* doc/posix-functions/vsnprintf.texi: Likewise.
* doc/posix-functions/vsprintf.texi: Likewise.
* doc/posix-functions/vswprintf.texi: Likewise.
* doc/posix-functions/vwprintf.texi: Likewise.
* doc/posix-functions/wprintf.texi: Likewise.

2 years agoxprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 11:20:26 +0000 (12:20 +0100)]
xprintf-gnu: New module.

* modules/xprintf-gnu: New file, based on modules/vasnprintf-gnu and
modules/xprintf-posix.

2 years agoxvasprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 11:18:24 +0000 (12:18 +0100)]
xvasprintf-gnu: New module.

* modules/xvasprintf-gnu: New file, based on modules/xvasprintf-posix.

2 years agovasnwprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 11:16:36 +0000 (12:16 +0100)]
vasnwprintf-gnu: Add tests.

* tests/test-vasnwprintf-gnu.c: New file, based on
tests/test-vasnwprintf-posix.c and tests/test-vasnprintf-gnu.c.
* modules/vasnwprintf-gnu-tests: New file, based on
modules/vasnwprintf-posix-tests.

2 years agovasnwprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 11:15:42 +0000 (12:15 +0100)]
vasnwprintf-gnu: New module.

* m4/vasnwprintf-posix.m4 (gl_FUNC_VASNWPRINTF_IS_POSIX): New macro.
(gl_FUNC_VASNWPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vasnwprintf-gnu.m4: New file, based on m4/vasnprintf-gnu.m4.
* modules/vasnwprintf-gnu: New file, based on modules/vasnprintf-gnu.

2 years agoobstack-printf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 11:12:36 +0000 (12:12 +0100)]
obstack-printf-gnu: Add tests.

* modules/obstack-printf-gnu-tests: New file, based on
modules/obstack-printf-posix-tests.

2 years agoobstack-printf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 11:11:52 +0000 (12:11 +0100)]
obstack-printf-gnu: New module.

* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX): New
macro, extracted from gl_FUNC_OBSTACK_PRINTF_POSIX.
(gl_FUNC_OBSTACK_PRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/obstack-printf-gnu.m4: New file, based on
m4/obstack-printf-posix.m4.
* modules/obstack-printf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/glibc-functions/obstack_printf.texi: Mention the new module.
* doc/glibc-functions/obstack_vprintf.texi: Likewise.

2 years agodprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 11:05:26 +0000 (12:05 +0100)]
dprintf-gnu: Add tests.

* tests/test-dprintf-gnu.sh: New file, based on
tests/test-dprintf-posix.sh.
* tests/test-dprintf-gnu.c: New file, based on
tests/test-vasnprintf-gnu.c.
* modules/dprintf-gnu-tests: New file, based on
modules/dprintf-posix-tests.

2 years agodprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 11:04:20 +0000 (12:04 +0100)]
dprintf-gnu: New module.

* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_DPRINTF_POSIX.
(gl_FUNC_DPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/dprintf-gnu.m4: New file, based on m4/dprintf-posix.m4.
* modules/dprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/dprintf.texi: Mention the new module.

2 years agovdprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 11:01:45 +0000 (12:01 +0100)]
vdprintf-gnu: Add tests.

* tests/test-vdprintf-gnu.sh: New file, based on
tests/test-vdprintf-posix.sh.
* tests/test-vdprintf-gnu.c: New file, based on
tests/test-vdprintf-posix.c.
* modules/vdprintf-gnu-tests: New file, based on
modules/vdprintf-posix-tests.

2 years agovdprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 11:00:23 +0000 (12:00 +0100)]
vdprintf-gnu: New module.

* m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_VDPRINTF_POSIX.
(gl_FUNC_VDPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vdprintf-gnu.m4: New file, based on m4/vdprintf-posix.m4.
* modules/vdprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/vdprintf.texi: Mention the new module.

2 years agoprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:57:19 +0000 (11:57 +0100)]
printf-gnu: Add tests.

* tests/test-printf-gnu.sh: New file, based on
tests/test-printf-posix.sh.
* tests/test-printf-gnu.c: New file, based on tests/test-printf-posix.c.
* modules/printf-gnu-tests: New file, based on
modules/printf-posix-tests.

2 years agoprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:55:38 +0000 (11:55 +0100)]
printf-gnu: New module.

* m4/printf-posix.m4: Renamed from m4/printf-posix-rpl.m4.
(gl_FUNC_PRINTF_IS_POSIX): New macro.
(gl_FUNC_PRINTF_POSIX): Require it. Don't require
gl_FUNC_VFPRINTF_POSIX. Invoke gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
and gl_REPLACE_VASNPRINTF.
* m4/printf-gnu.m4: New file, based on m4/fprintf-posix.m4.
* modules/printf-posix (Files): Update.
* modules/printf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/printf.texi: Mention the new module.

2 years agovprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:47:20 +0000 (11:47 +0100)]
vprintf-gnu: Add tests.

* tests/test-vprintf-gnu.sh: New file, based on
tests/test-vprintf-posix.sh.
* tests/test-vprintf-gnu.c: New file, based on
tests/test-vprintf-posix.c.
* tests/test-printf-gnu.h: New file, based on
tests/test-vasnprintf-gnu.c.
* modules/vprintf-gnu-tests: New file, based on
modules/vprintf-posix-tests.

2 years agovprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:46:24 +0000 (11:46 +0100)]
vprintf-gnu: New module.

* m4/vprintf-posix.m4 (gl_FUNC_VPRINTF_IS_POSIX): New macro.
(gl_FUNC_VPRINTF_POSIX): Require it. Don't require
gl_FUNC_VFPRINTF_POSIX. Invoke gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
and gl_REPLACE_VASNPRINTF.
* m4/vprintf-gnu.m4: New file, based on m4/vfprintf-posix.m4.
* modules/vprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/vprintf.texi: Mention the new module.

2 years agofprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:41:10 +0000 (11:41 +0100)]
fprintf-gnu: Add tests.

* tests/test-fprintf-gnu.sh: New file, based on
tests/test-fprintf-posix.sh.
* tests/test-fprintf-gnu.c: New file, based on
tests/test-fprintf-posix.c.
* modules/fprintf-gnu-tests: New file, based on
modules/fprintf-posix-tests.

2 years agofprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:39:47 +0000 (11:39 +0100)]
fprintf-gnu: New module.

* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_FPRINTF_POSIX.
(gl_FUNC_FPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/fprintf-gnu.m4: New file, based on m4/fprintf-posix.m4.
* modules/fprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/fprintf.texi: Mention the new module.

2 years agovfprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:36:53 +0000 (11:36 +0100)]
vfprintf-gnu: Add tests.

* tests/test-vfprintf-gnu.sh: New file, based on
tests/test-vfprintf-posix.sh.
* tests/test-vfprintf-gnu.c: New file, based on
tests/test-vfprintf-posix.c.
* tests/test-fprintf-gnu.h: New file, based on
tests/test-vasnprintf-gnu.c.
* tests/test-printf-gnu.output: New file, based on
tests/test-vasnprintf-gnu.c.
* modules/vfprintf-gnu-tests: New file, based on
modules/vfprintf-posix-tests.

2 years agovfprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:35:26 +0000 (11:35 +0100)]
vfprintf-gnu: New module.

* m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_VFPRINTF_POSIX.
(gl_FUNC_VFPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vfprintf-gnu.m4: New file, based on m4/vfprintf-posix.m4.
* modules/vfprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/vfprintf.texi: Mention the new module.

2 years agovasprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:29:58 +0000 (11:29 +0100)]
vasprintf-gnu: Add tests.

* tests/test-vasprintf-gnu.c: New file, based on
tests/test-vasprintf-posix.c and tests/test-vasnprintf-gnu.c.
* modules/vasprintf-gnu-tests: New file, based on
modules/vasprintf-posix-tests.

2 years agovasprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:28:38 +0000 (11:28 +0100)]
vasprintf-gnu: New module.

* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_VASPRINTF_POSIX.
(gl_FUNC_VASPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vasprintf-gnu.m4: New file, based on m4/vasprintf-posix.m4.
* modules/vasprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/glibc-functions/vasprintf.texi: Mention the new module.
* doc/glibc-functions/asprintf.texi: Likewise.

2 years agosprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:23:51 +0000 (11:23 +0100)]
sprintf-gnu: Add tests.

* tests/test-sprintf-gnu.c: New file, based on
tests/test-sprintf-posix.c.
* modules/sprintf-gnu-tests: New file, based on
modules/sprintf-posix-tests.

2 years agosprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:22:20 +0000 (11:22 +0100)]
sprintf-gnu: New module.

* m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_SPRINTF_POSIX.
(gl_FUNC_SPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/sprintf-gnu.m4: New file, based on m4/sprintf-posix.m4.
* modules/sprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/sprintf.texi: Mention the new module.

2 years agovsprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:19:18 +0000 (11:19 +0100)]
vsprintf-gnu: Add tests.

* tests/test-vsprintf-gnu.c: New file, based on
tests/test-vsprintf-posix.c.
* tests/test-sprintf-gnu.h: New file, based on
tests/test-vasnprintf-gnu.c.
* modules/vsprintf-gnu-tests: New file, based on
modules/vsprintf-posix-tests.

2 years agovsprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:17:22 +0000 (11:17 +0100)]
vsprintf-gnu: New module.

* m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_VSPRINTF_POSIX.
(gl_FUNC_VSPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vsprintf-gnu.m4: New file, based on m4/vsprintf-posix.m4.
* modules/vsprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/vsprintf.texi: Mention the new module.

2 years agosnprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:13:47 +0000 (11:13 +0100)]
snprintf-gnu: Add tests.

* tests/test-snprintf-gnu.c: New file, based on
tests/test-snprintf-posix.c.
* modules/snprintf-gnu-tests: New file, based on
modules/snprintf-posix-tests.

2 years agosnprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:12:47 +0000 (11:12 +0100)]
snprintf-gnu: New module.

* m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_SNPRINTF_POSIX.
(gl_FUNC_SNPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/snprintf-gnu.m4: New file, based on m4/snprintf-posix.m4.
* modules/snprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/snprintf.texi: Mention the new module.

2 years agovsnprintf-gnu: Add tests.
Bruno Haible [Fri, 24 Mar 2023 10:06:44 +0000 (11:06 +0100)]
vsnprintf-gnu: Add tests.

* tests/test-vsnprintf-gnu.c: New file, based on
tests/test-vsnprintf-posix.c.
* tests/test-snprintf-gnu.h: New file, based on
tests/test-vasnprintf-gnu.c.
* modules/vsnprintf-gnu-tests: New file, based on
modules/vsnprintf-posix-tests.

2 years agovsnprintf-gnu: New module.
Bruno Haible [Fri, 24 Mar 2023 10:05:38 +0000 (11:05 +0100)]
vsnprintf-gnu: New module.

* m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_VSNPRINTF_POSIX.
(gl_FUNC_VSNPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vsnprintf-gnu.m4: New file, based on m4/vsnprintf-posix.m4.
* modules/vsnprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/posix-functions/vsnprintf.texi: Mention the new module.

2 years agovasnprintf-gnu: Add tests.
Bruno Haible [Thu, 23 Mar 2023 12:53:44 +0000 (13:53 +0100)]
vasnprintf-gnu: Add tests.

* tests/test-vasnprintf-gnu.c: New file, based on
tests/test-vasnprintf-posix.c.
* modules/vasnprintf-gnu-tests: New file.

2 years agovasnprintf-gnu: New module.
Bruno Haible [Thu, 23 Mar 2023 12:51:41 +0000 (13:51 +0100)]
vasnprintf-gnu: New module.

Suggested by Eric Blake in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-03/msg00060.html>.

* lib/printf-parse.c (PRINTF_PARSE): Recognize the 'B' conversion.
* lib/printf-parse.h: Update comments.
* lib/wprintf-parse.h: Likewise.
* lib/vasnprintf.c (MAX_ROOM_NEEDED): Treat the 'B' conversion like 'b'.
(VASNPRINTF): Implement 'B' conversion if
NEED_PRINTF_DIRECTIVE_UPPERCASE_B is set. Support the 'B' conversion if
requested.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): When cross-compiling, guess yes
on glibc >= 2.35.
(gl_PRINTF_DIRECTIVE_UPPERCASE_B): New macro.
* m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS): Renamed
from gl_PREREQ_VASNPRINTF_WITH_EXTRAS.
(gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B,
gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS): New macros.
* m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_VASNPRINTF_POSIX.
(gl_FUNC_VASNPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vasnprintf-gnu.m4: New file.
* modules/vasnprintf-gnu: New file.
* modules/c-vasnprintf (configure.ac): Update.
* modules/unistdio/u8-vasnprintf (configure.ac): Likewise.
* modules/unistdio/u8-u8-vasnprintf (configure.ac): Likewise.
* modules/unistdio/u16-vasnprintf (configure.ac): Likewise.
* modules/unistdio/u16-u16-vasnprintf (configure.ac): Likewise.
* modules/unistdio/u32-vasnprintf (configure.ac): Likewise.
* modules/unistdio/u32-u32-vasnprintf (configure.ac): Likewise.
* modules/unistdio/ulc-vasnprintf (configure.ac): Likewise.

2 years agoprintf-posix tests: Fix compilation error (regression 2021-08-28).
Bruno Haible [Fri, 24 Mar 2023 01:45:09 +0000 (02:45 +0100)]
printf-posix tests: Fix compilation error (regression 2021-08-28).

* modules/printf-posix-tests (Files): Add tests/qemu.h.

2 years agognu-web-doc-update: don't use host alias, cvs.sv.gnu.org
Jim Meyering [Thu, 23 Mar 2023 02:51:12 +0000 (19:51 -0700)]
gnu-web-doc-update: don't use host alias, cvs.sv.gnu.org

* build-aux/gnu-web-doc-update: Use hostname cvs.savannah.gnu.org,
not cvs.sv.gnu.org. Using the shorter alias would elicit this:
  $ pkg=grep ; cvs -d $USER@cvs.sv.gnu.org:/webcvs/$pkg co $pkg
  Bad server host key: Invalid key length

2 years ago*printf-posix: Fix implementation of %b directive.
Bruno Haible [Wed, 22 Mar 2023 20:43:23 +0000 (21:43 +0100)]
*printf-posix: Fix implementation of %b directive.

* lib/vasnprintf.c (VASNPRINTF): In the %b directive implementation, fix
the precision handling, and ignore the '0' flag when a width and a
precision are both present.
* tests/test-snprintf-posix.h (test_function): Add test cases for the %x
directive and more test cases for the %b directive.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnprintf-posix.c (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* modules/vasnwprintf-posix-tests (Files): Add m4/musl.m4.
(configure.ac): Invoke gl_MUSL_LIBC.

2 years agovasnwprintf: Fix a warning: implicit declaration of function ‘wcsnlen’.
Bruno Haible [Wed, 22 Mar 2023 20:33:24 +0000 (21:33 +0100)]
vasnwprintf: Fix a warning: implicit declaration of function ‘wcsnlen’.

* m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Test also whether wcsnlen is
declared.
* lib/vasnprintf.c (local_wcsnlen): Together with HAVE_WCSNLEN, test
also HAVE_DECL_WCSNLEN.

2 years agovasnwprintf: Fix a "warning: unused function local_wcsnlen".
Bruno Haible [Wed, 22 Mar 2023 20:28:21 +0000 (21:28 +0100)]
vasnwprintf: Fix a "warning: unused function local_wcsnlen".

* lib/vasnprintf.c: Adjust #if conditions.

2 years agovasnwprintf: Fix test failures on FreeBSD, NetBSD, AIX, mingw.
Bruno Haible [Wed, 22 Mar 2023 18:39:33 +0000 (19:39 +0100)]
vasnwprintf: Fix test failures on FreeBSD, NetBSD, AIX, mingw.

* m4/printf.m4 (gl_SWPRINTF_WORKS): New macro.
* m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke it and define
HAVE_WORKING_SWPRINTF accordingly.
* lib/vasnprintf.c: Together with HAVE_SWPRINTF, test also
HAVE_WORKING_SWPRINTF.
(VASNPRINTF): If WIDE_CHAR_VERSION && !DCHAR_IS_TCHAR, don't pass a
wchar_t[] to snprintf. Add a workaround against mingw's snwprintf
function.
* doc/posix-functions/swprintf.texi: Document the null wide character
bug.

2 years agovasnwprintf: Fix a "warning: unused function 'wmax_room_needed'".
Bruno Haible [Wed, 22 Mar 2023 16:46:23 +0000 (17:46 +0100)]
vasnwprintf: Fix a "warning: unused function 'wmax_room_needed'".

* lib/vasnprintf.c (MAX_ROOM_NEEDED): Adjust #if condition.

2 years agovasnwprintf: Simplify last change.
Bruno Haible [Wed, 22 Mar 2023 14:01:53 +0000 (15:01 +0100)]
vasnwprintf: Simplify last change.

* lib/vasnprintf.c (VASNPRINTF): Remove unused variable 'len'.

2 years agovasnwprintf tests: Fix link errors on AIX.
Bruno Haible [Wed, 22 Mar 2023 13:42:58 +0000 (14:42 +0100)]
vasnwprintf tests: Fix link errors on AIX.

* modules/vasnwprintf (Link): New section.
* modules/vasnwprintf-posix (Link): New section.
* modules/vasnwprintf-tests (Makefile.am): Link test-vasnwprintf with
$(MBRTOWC_LIB).
* modules/vasnwprintf-posix-tests (Makefile.am): Link
test-vasnwprintf-posix, test-vasnwprintf-posix2, test-vasnwprintf-posix3
with $(MBRTOWC_LIB).

2 years agognu-web-doc-update: Make it work for the first upload of a manual.
Bruno Haible [Wed, 22 Mar 2023 05:43:02 +0000 (06:43 +0100)]
gnu-web-doc-update: Make it work for the first upload of a manual.

Reported by Reuben Thomas <rrt@sc3d.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-03/msg00066.html>.

* build-aux/gnu-web-doc-update: Put the 'manual' directory under version
control if it is not yet.

2 years agounistdio/u*-vasnprintf: Fix conversion of %Id directive result.
Bruno Haible [Wed, 22 Mar 2023 05:13:18 +0000 (06:13 +0100)]
unistdio/u*-vasnprintf: Fix conversion of %Id directive result.

* lib/vasnprintf.c (VASNPRINTF): Don't assume that snprintf's result is
entirely ASCII if the directive contain the glibc 'I' flag.

2 years agovasnwprintf: Fix for older platforms without swprintf.
Bruno Haible [Tue, 21 Mar 2023 16:47:04 +0000 (17:47 +0100)]
vasnwprintf: Fix for older platforms without swprintf.

* lib/vasnprintf.c (VASNPRINTF): In the %lc handling, ignore the
precision. Convert the snprintf result to a wchar_t[] not by mbsrtowcs,
but by a loop that does not stop at NUL characters.
* tests/test-vasnwprintf-posix.c (test_function): Add more tests for the
%c and %lc directives.
* modules/vasnwprintf (Depends-on): Add mbrtowc. Remove mbsrtowcs.

2 years agoautoupdate
Karl Berry [Tue, 21 Mar 2023 15:04:38 +0000 (08:04 -0700)]
autoupdate

2 years ago*printf-posix: Work around bug with %lc of 0 on many platforms.
Bruno Haible [Tue, 21 Mar 2023 14:49:06 +0000 (15:49 +0100)]
*printf-posix: Work around bug with %lc of 0 on many platforms.

* lib/vasnprintf.c (local_wctomb): Define also for
NEED_PRINTF_DIRECTIVE_LC.
(VASNPRINTF): Implement %lc handling ourselves if
NEED_PRINTF_DIRECTIVE_LC.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_LC): New macro.
* m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_LC): New macro.
(gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require
gl_PRINTF_DIRECTIVE_LC and test its result. Invoke
gl_PREREQ_VASNPRINTF_DIRECTIVE_LC.
* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Likewise.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise.
* m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Likewise.
* m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise.
* m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise.
* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise.
* m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise.
* m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_POSIX): Likewise.
* m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise.
* m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise.
* tests/test-snprintf-posix.h (test_function): Add more tests for the
%c and %lc directives.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* doc/glibc-functions/asprintf.texi: Mention the %lc 0 bug.
* doc/glibc-functions/obstack_printf.texi: Likewise.
* doc/glibc-functions/obstack_vprintf.texi: Likewise.
* doc/glibc-functions/vasprintf.texi: Likewise.
* doc/posix-functions/dprintf.texi: Likewise.
* 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.

2 years agognupload: correct SFTP connection URL
Ar Rakin [Mon, 20 Mar 2023 07:21:27 +0000 (07:21 +0000)]
gnupload: correct SFTP connection URL

Approved by Sergey Poznyakoff in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-03/msg00078.html>.

* build-aux/gnupload: fix gnu.org.ua SFTP connection URL:
puszcza.gnu.org.ua -> download.gnu.org.ua

2 years agomemrchr tests: Avoid GCC warning.
Bruno Haible [Mon, 20 Mar 2023 18:46:06 +0000 (19:46 +0100)]
memrchr tests: Avoid GCC warning.

* tests/test-memrchr.c: Don't use '#pragma GCC diagnostic' for GCC
versions older than 4.7.

2 years agounistdio: Simplify code.
Bruno Haible [Mon, 20 Mar 2023 11:39:30 +0000 (12:39 +0100)]
unistdio: Simplify code.

* lib/unistdio/u8-vasnprintf.c (DCHAR_T_IS_UINT8_T): Remove unused
macro.
* lib/unistdio/u8-u8-vasnprintf.c: Likewise.
* lib/unistdio/u16-vasnprintf.c (DCHAR_T_IS_UINT16_T): Remove unused
macro.
* lib/unistdio/u16-u32-vasnprintf.c: Likewise.
* lib/unistdio/u32-vasnprintf.c (DCHAR_T_IS_UINT32_T): Remove unused
macro.
* lib/unistdio/u32-u32-vasnprintf.c: Likewise.

2 years agovasnwprintf: Port to older platforms without swprintf.
Bruno Haible [Mon, 20 Mar 2023 18:18:02 +0000 (19:18 +0100)]
vasnwprintf: Port to older platforms without swprintf.

* m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Test for swprintf.
* lib/vasnprintf.c (TCHAR_T, DCHAR_IS_TCHAR, SNPRINTF): When
WIDE_CHAR_VERSION and swprintf does not exist, use TCHAR_T = char,
SNPRINTF = snprintf, and !DCHAR_IS_TCHAR.
(VASNPRINTF): In this case, implement %ls and %lc directly. Adjust a
couple of #if conditions. For the conversion from TCHAR_T[] to
DCHAR_T[], use mbsrtowcs.
* modules/vasnwprintf (Depends-on): Add mbsrtowcs.

2 years agowmemset: Relicense under LGPLv2+.
Bruno Haible [Mon, 20 Mar 2023 09:09:57 +0000 (10:09 +0100)]
wmemset: Relicense under LGPLv2+.

* modules/wmemset (License): Change to LGPLv2+.
* lib/wmemset.c: Update license notice.
* lib/wmemset-impl.h: Likewise.

2 years agowmemcpy: Relicense under LGPLv2+.
Bruno Haible [Mon, 20 Mar 2023 09:09:16 +0000 (10:09 +0100)]
wmemcpy: Relicense under LGPLv2+.

* modules/wmemcpy (License): Change to LGPLv2+.
* lib/wmemcpy.c: Update license notice.
* lib/wmemcpy-impl.h: Likewise.

2 years agovasnwprintf: Fix test failures on musl libc.
Bruno Haible [Mon, 20 Mar 2023 02:26:44 +0000 (03:26 +0100)]
vasnwprintf: Fix test failures on musl libc.

* m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke gl_MUSL_LIBC.
* lib/vasnprintf.c (VASNPRINTF): On musl libc, when WIDE_CHAR_VERSION,
- force pad_ourselves to be 1,
- don't use %n.
Fix zero-padding when the result starts with a prefix "0x" or "0b".
* modules/vasnwprintf (Files): Add musl.m4.
* doc/posix-functions/swprintf.texi: Mention two musl libc bugs.

2 years agovasnwprintf: Fix module dependencies.
Bruno Haible [Mon, 20 Mar 2023 02:20:48 +0000 (03:20 +0100)]
vasnwprintf: Fix module dependencies.

* modules/vasnwprintf (Depends-on): Add wmemcpy, wmemset.
* modules/vasnwprintf-tests (Depends-on): Add wmemcmp.
* modules/vasnwprintf-posix-tests (Depends-on): Likewise.

2 years agovasnwprintf: Fix module dependencies.
Bruno Haible [Mon, 20 Mar 2023 02:12:43 +0000 (03:12 +0100)]
vasnwprintf: Fix module dependencies.

* modules/vasnwprintf (Depends-on): Add wmemcpy, wmemset.
* modules/vasnwprintf-tests (Depends-on): Add wmemcmp.
* modules/vasnwprintf-posix-tests (Depends-on): Likewise.