summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* mbsnrtoc32s tests: Check behaviour in the C locale.Bruno Haible2023-04-032-0/+86
| | | | | | | | | | * 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.
* mbsrtoc32s tests: Check behaviour in the C locale.Bruno Haible2023-04-032-0/+86
| | | | | | | | | | * 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.
* btoc32 tests: Check behaviour in the C locale.Bruno Haible2023-04-032-0/+39
| | | | | | | | * 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.
* mbrtoc32 tests: Prefer *c32* functions.Bruno Haible2023-04-031-1/+1
| | | | | * tests/test-mbrtoc32.c (main): Use btoc32 instead of btowc. * modules/mbrtoc32-tests (Depends-on): Add btoc32.
* mbrtoc32 tests: Add comment.Bruno Haible2023-04-032-2/+9
| | | | | | | | * 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.
* trim: Add tests.Bruno Haible2023-04-024-0/+193
| | | | | | | | * 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.
* unistr/u*strstr tests: Add more tests.Bruno Haible2023-04-024-0/+41
| | | | | | | | | | | * 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.
* vasnwprintf-posix: Fix behaviour in the C locale.Bruno Haible2023-04-011-0/+42
| | | | | | | | | | | | | | | | * 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.
* vasnprintf-posix: Fix crash in narrow %lc directive (regr. 2023-03-21).Bruno Haible2023-04-015-0/+101
| | | | | | | | | | | * 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.
* Avoid test failures on Android.Bruno Haible2023-03-314-0/+36
| | | | | | | | * 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.
* mbstowcs: Add tests.Bruno Haible2023-03-316-0/+323
| | | | | | | | | | * 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.
* mbstowcs: New module.Bruno Haible2023-03-311-0/+5
| | | | | | | | | | | | | | | * 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.
* mbsnrtowcs: Fix behaviour in the C locale.Bruno Haible2023-03-302-0/+75
| | | | | | | | | | | | | * 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.
* mbsrtowcs: Fix behaviour in the C locale.Bruno Haible2023-03-302-0/+75
| | | | | | | | | | | | | * 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.
* mbrlen: Add tests.Bruno Haible2023-03-3014-0/+959
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* btowc: Fix behaviour in the C locale.Bruno Haible2023-03-302-0/+28
| | | | | | | | | | | | | | | | | | * 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.
* mbrtowc tests: Add comment.Bruno Haible2023-03-302-2/+7
| | | | | | * tests/test-mbrtowc.c: Add comment. * tests/test-mbrtowc5.sh: Use symmetric coding style. * doc/posix-functions/mbrtowc.texi: Update.
* stdlib tests: Check behaviour of C locale.Bruno Haible2023-03-301-1/+12
| | | | * tests/test-stdlib.c (main): Check MB_CUR_MAX.
* string-desc tests: Fix "make distcheck" failure.Bruno Haible2023-03-301-6/+5
| | | | * tests/test-string-desc.sh: Run the test in a subdir.
* string-desc-quotearg: Add tests.Bruno Haible2023-03-291-0/+100
| | | | | * tests/test-string-desc-quotearg.c: New file. * modules/string-desc-quotearg-tests: New file.
* xstring-desc: Add tests.Bruno Haible2023-03-291-0/+84
| | | | | * tests/test-xstring-desc.c: New file. * modules/xstring-desc-tests: New file.
* string-desc: Add tests.Bruno Haible2023-03-292-0/+199
| | | | | | * tests/test-string-desc.sh: New file. * tests/test-string-desc.c: New file. * modules/string-desc-tests: New file.
* wcsstr: Ensure worst-case linear execution time.Bruno Haible2023-03-271-0/+274
| | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Add test case from a past musl libc bug.Bruno Haible2023-03-275-0/+40
| | | | | | | | * 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.
* uchar: ISO C 23: Define char8_t.Bruno Haible2023-03-271-3/+11
| | | | | | | | | * 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.
* call_once: New module, separate from mtx.Bruno Haible2023-03-251-0/+3
| | | | | | | | | | | | | | | | | | | * 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.
* stdio: ISO C 23: Define _PRINTF_NAN_LEN_MAX.Bruno Haible2023-03-251-0/+32
| | | | | | | | | | | | * 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.
* Make some header file tests a bit stronger.Bruno Haible2023-03-258-58/+65
| | | | | | | | | | | | | | | | | * 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.
* *printf-posix: ISO C 23: Support size specifiers 'wN' and 'wfN'.Bruno Haible2023-03-245-0/+2805
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* vasnwprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+276
| | | | | | | * 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.
* dprintf-gnu: Add tests.Bruno Haible2023-03-242-0/+113
| | | | | | | | | * 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.
* vdprintf-gnu: Add tests.Bruno Haible2023-03-242-0/+64
| | | | | | | | | * 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.
* printf-gnu: Add tests.Bruno Haible2023-03-242-0/+51
| | | | | | | | * 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.
* vprintf-gnu: Add tests.Bruno Haible2023-03-243-0/+145
| | | | | | | | | | | * 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.
* fprintf-gnu: Add tests.Bruno Haible2023-03-242-0/+52
| | | | | | | | | * 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.
* vfprintf-gnu: Add tests.Bruno Haible2023-03-244-0/+163
| | | | | | | | | | | | | * 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.
* vasprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+275
| | | | | | | * 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.
* sprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+35
| | | | | | | * 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.
* vsprintf-gnu: Add tests.Bruno Haible2023-03-242-0/+223
| | | | | | | | | * 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.
* snprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+35
| | | | | | | * 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.
* vsnprintf-gnu: Add tests.Bruno Haible2023-03-242-0/+223
| | | | | | | | | * 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.
* vasnprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+275
| | | | | | * tests/test-vasnprintf-gnu.c: New file, based on tests/test-vasnprintf-posix.c. * modules/vasnprintf-gnu-tests: New file.
* *printf-posix: Fix implementation of %b directive.Bruno Haible2023-03-225-0/+1662
| | | | | | | | | | | | | | * 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.
* vasnwprintf: Fix for older platforms without swprintf.Bruno Haible2023-03-211-0/+38
| | | | | | | | | * 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.
* *printf-posix: Work around bug with %lc of 0 on many platforms.Bruno Haible2023-03-214-0/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* memrchr tests: Avoid GCC warning.Bruno Haible2023-03-201-1/+1
| | | | | * tests/test-memrchr.c: Don't use '#pragma GCC diagnostic' for GCC versions older than 4.7.
* test-pselect, test-select: use different portsPaul Eggert2023-03-193-2/+2
| | | | | | | | | | | | | I have served rare and hard-to-reproduce problems with the GNU grep release candidate with ‘make -j5 check’ on Fedora 37 x86-64. One possibility is that test-pselect and test-select interfere with each other somehow when run simultaneously, as they use the same port. Work around this possibility by using different ports from each other, and from test-poll (which also uses 12345). Of course it’d be better if all these tests used system-assigned ports, but I assume that’d take more work. * tests/test-pselect.c, tests/test-select.c (TEST_PORT): New macro. * tests/test-select.h (TEST_PORT): Remove.
* *printf-posix: ISO C 23: Add %b directive for binary output of integers.Bruno Haible2023-03-175-0/+415
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/printf-parse.c (PRINTF_PARSE): Recognize the 'b' directive. * lib/printf-parse.h: Update comment. * lib/wprintf-parse.h: Likewise. * lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Add support for the 'b' directive. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_B): New macro. (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it. * m4/vasnwprintf-posix.m4 (gl_FUNC_VASNWPRINTF_POSIX): Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_B. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require gl_PRINTF_DIRECTIVE_B and test its result. Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_B. * 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 some tests of 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. * doc/glibc-functions/asprintf.texi: Mention the 'b' directive. * 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/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.
* vasnwprintf-posix: Add tests.Bruno Haible2023-03-174-0/+4215
| | | | | | | | | | | | | * tests/test-vasnwprintf-posix.c: New file, based on tests/test-vasnprintf-posix.c. * tests/test-vasnwprintf-posix2.sh: New file, based on tests/test-vasnprintf-posix2.sh. * tests/test-vasnwprintf-posix2.c: New file, based on tests/test-vasnprintf-posix2.c. * tests/test-vasnwprintf-posix3.c: New file, based on tests/test-vasnprintf-posix3.c. * modules/vasnwprintf-posix-tests: New file, based on modules/vasnprintf-posix-tests.
* vasnwprintf: Add tests.Bruno Haible2023-03-171-0/+122
| | | | | | * tests/test-vasnwprintf.c: New file, based on tests/test-vasnprintf.c. * modules/vasnwprintf-tests: New file, based on modules/vasnprintf-tests.