]> Savannah Git Hosting - gnulib.git/log
gnulib.git
2 years agodoc: Avoid ambiguous wording.
Bruno Haible [Mon, 10 Apr 2023 12:49:45 +0000 (14:49 +0200)]
doc: Avoid ambiguous wording.

* doc/posix-headers/time.texi: Say "or" not "and".

2 years agodoc: Fix a typo.
Bruno Haible [Mon, 10 Apr 2023 01:54:47 +0000 (03:54 +0200)]
doc: Fix a typo.

* doc/posix-headers/time.texi: Fix typo in module name.

2 years agodoc: improve cross-refs for year 2038 issue
Paul Eggert [Mon, 10 Apr 2023 01:16:57 +0000 (18:16 -0700)]
doc: improve cross-refs for year 2038 issue

2 years agolargefile: sync from Autoconf master
Paul Eggert [Mon, 10 Apr 2023 01:16:57 +0000 (18:16 -0700)]
largefile: sync from Autoconf master

* modules/largefile-required, modules/year2038-required: New modules.
* MODULES.html.sh, doc/largefile.texi, doc/posix-headers/time.texi:
* doc/year2038.texi: Document this.
* m4/largefile.m4: Sync from Autoconf master.
Conditionalize the workaround on AC_SYS_LARGEFILE_REQUIRED rather
than on AC_SYS_YEAR2038 so that we replace older but still
unreleased Autoconf.
(AC_SYS_LARGEFILE_REQUIRED, AC_SYS_YEAR2038_REQUIRED): New macros.

2 years agoyear2038: configure earlier
Paul Eggert [Mon, 10 Apr 2023 01:16:13 +0000 (18:16 -0700)]
year2038: configure earlier

* modules/year2038: Put AC_SYS_YEAR2038 in configure.ac-early
since it can affect CPPFLAGS with _TIME_BITS=64.

2 years agomaint: no Autoconf 2.72
Paul Eggert [Mon, 10 Apr 2023 01:15:16 +0000 (18:15 -0700)]
maint: no Autoconf 2.72

Rewrite commentary to not mention Autoconf 2.72, as the plan is to
jump from 2.71 to 2.73 with no 2.72.  Leave code uses of
‘m4_version_prereq([2.72], ...)’ alone, though as they’re still
correct for Autoconf released versions and will help test Autoconf
release candidates.

2 years agoc32toupper: Add tests.
Bruno Haible [Sun, 9 Apr 2023 23:51:54 +0000 (01:51 +0200)]
c32toupper: Add tests.

* tests/test-c32toupper.sh: New file.
* tests/test-c32toupper.c: New file, based on tests/test-c32islower.c.
* modules/c32toupper-tests: New file.

2 years agoc32toupper: New module.
Bruno Haible [Sun, 9 Apr 2023 23:50:39 +0000 (01:50 +0200)]
c32toupper: New module.

* lib/uchar.in.h (c32toupper): New declaration.
* lib/c32toupper.c: New file.
* modules/c32toupper: New file.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32TOUPPER.
* modules/uchar (Makefile.am): Substitute GNULIB_C32TOUPPER.

2 years agoc32tolower: Add tests.
Bruno Haible [Sun, 9 Apr 2023 23:46:37 +0000 (01:46 +0200)]
c32tolower: Add tests.

* tests/test-c32tolower.sh: New file.
* tests/test-c32tolower.c: New file, based on tests/test-c32isupper.c.
* modules/c32tolower-tests: New file.

2 years agoc32tolower: New module.
Bruno Haible [Tue, 4 Apr 2023 21:21:04 +0000 (23:21 +0200)]
c32tolower: New module.

* lib/uchar.in.h (c32tolower): New declaration.
* lib/c32tolower.c: New file.
* lib/c32to-impl.h: New file, based on lib/c32is-impl.h.
* modules/c32tolower: New file.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32TOLOWER.
* modules/uchar (Makefile.am): Substitute GNULIB_C32TOLOWER.

2 years agoc32is*: Ensure GNULIB_defined_mbstate_t is defined on AIX.
Bruno Haible [Sun, 9 Apr 2023 16:14:46 +0000 (18:14 +0200)]
c32is*: Ensure GNULIB_defined_mbstate_t is defined on AIX.

* m4/mbrtowc.m4 (gl_MBSTATE_T_BROKEN): Define through AC_DEFUN_ONCE.
* m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32): Require it.
* modules/c32isalnum (Files): Add m4/mbrtowc.m4, m4/locale-ja.m4.
(configure.ac): Require gl_MBSTATE_T_BROKEN.
* modules/c32isalpha: Likewise.
* modules/c32isblank: Likewise.
* modules/c32iscntrl: Likewise.
* modules/c32isdigit: Likewise.
* modules/c32isgraph: Likewise.
* modules/c32islower: Likewise.
* modules/c32isprint: Likewise.
* modules/c32ispunct: Likewise.
* modules/c32isspace: Likewise.
* modules/c32isupper: Likewise.
* modules/c32isxdigit: Likewise.

2 years agombrtoc32: Add comments.
Bruno Haible [Sun, 9 Apr 2023 16:02:51 +0000 (18:02 +0200)]
mbrtoc32: Add comments.

* lib/mbrtoc32.c: Add comment regarding AIX.
* m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32): Add comment regarding
GNULIB_defined_mbstate_t.

2 years agodoc: Mention a NetBSD bug.
Bruno Haible [Sun, 9 Apr 2023 21:45:43 +0000 (23:45 +0200)]
doc: Mention a NetBSD bug.

* doc/posix-functions/towlower.texi: Mention NetBSD bug 57339.
* doc/posix-functions/towupper.texi: Likewise.

2 years agovasnwprintf-posix: More details about the glibc bug.
Bruno Haible [Sun, 9 Apr 2023 18:34:48 +0000 (20:34 +0200)]
vasnwprintf-posix: More details about the glibc bug.

* doc/posix-functions/swprintf.texi: Add comment.
* m4/printf.m4 (gl_SWPRINTF_DIRECTIVE_LA): Update cross-compilation
guess.

2 years agodoc: Mention another Haiku bug.
Bruno Haible [Sat, 8 Apr 2023 16:15:07 +0000 (18:15 +0200)]
doc: Mention another Haiku bug.

* doc/posix-functions/open.texi: Mention a Haiku bug with symlinks.

2 years agoAvoid Autoconf "was expanded before it was required" warning.
Bruno Haible [Sat, 8 Apr 2023 13:26:13 +0000 (15:26 +0200)]
Avoid Autoconf "was expanded before it was required" warning.

* m4/exponentf.m4 (gl_FLOAT_EXPONENT_LOCATION): Define through
AC_DEFUN_ONCE.
* m4/exponentd.m4 (gl_DOUBLE_EXPONENT_LOCATION): Likewise.
* m4/exponentl.m4 (gl_LONG_DOUBLE_EXPONENT_LOCATION): Likewise.

2 years agostriconveh tests: Avoid test failure on glibc 2.15.
Bruno Haible [Sat, 8 Apr 2023 12:45:16 +0000 (14:45 +0200)]
striconveh tests: Avoid test failure on glibc 2.15.

* tests/test-striconveh.c (main): Skip some of the GB18030 tests on
glibc < 2.16.

2 years agovasnwprintf-posix: Really work around %La bug in glibc 2.15 and Haiku.
Bruno Haible [Sat, 8 Apr 2023 11:21:49 +0000 (13:21 +0200)]
vasnwprintf-posix: Really work around %La bug in glibc 2.15 and Haiku.

* m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Fix a copy&paste bug.

2 years agologin_tty: Fix compilation error in C++ mode on Solaris 11.4.
Bruno Haible [Sat, 8 Apr 2023 10:08:03 +0000 (12:08 +0200)]
login_tty: Fix compilation error in C++ mode on Solaris 11.4.

* m4/login_tty.m4 (gl_FUNC_LOGIN_TTY): Test whether <termios.h> exists.
Consider it when testing whether login_tty is declared.
* lib/utmp.in.h: If none of <util.h> and <libutil.h> exists, include
<termios.h> instead.
* doc/glibc-functions/login_tty.texi: Document the Solaris 11.4 problem.

2 years agotime: Fix compilation error in C++ mode on Solaris 11.
Bruno Haible [Sat, 8 Apr 2023 07:47:10 +0000 (09:47 +0200)]
time: Fix compilation error in C++ mode on Solaris 11.

* lib/time.in.h (time): Disable _GL_CXXALIASWARN invocation on non-glibc
systems.

2 years agounistdio/*: Fix test failures (regression 2023-01-28).
Bruno Haible [Sat, 8 Apr 2023 01:15:37 +0000 (03:15 +0200)]
unistdio/*: Fix test failures (regression 2023-01-28).

* modules/unistdio/*printf (configure.ac): Bump required libunistring
version number.

2 years agotrim tests: Fix link error.
Bruno Haible [Sat, 8 Apr 2023 00:19:30 +0000 (02:19 +0200)]
trim tests: Fix link error.

* modules/trim-tests (Makefile.am): Link test-trim also against libintl.

2 years agostdio: Fix the value of _PRINTF_NAN_LEN_MAX on OpenBSD.
Bruno Haible [Fri, 7 Apr 2023 22:19:35 +0000 (00:19 +0200)]
stdio: Fix the value of _PRINTF_NAN_LEN_MAX on OpenBSD.

* lib/stdio.in.h (_PRINTF_NAN_LEN_MAX): Define to 4 on OpenBSD.

2 years agovasnwprintf-posix: Work around %La bug in glibc 2.15 and Haiku.
Bruno Haible [Fri, 7 Apr 2023 21:54:24 +0000 (23:54 +0200)]
vasnwprintf-posix: Work around %La bug in glibc 2.15 and Haiku.

* m4/printf.m4 (gl_SWPRINTF_DIRECTIVE_LA): New macro.
* m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke
gl_SWPRINTF_DIRECTIVE_LA and define NEED_WPRINTF_DIRECTIVE_LA
accordingly.
* lib/vasnprintf.c: When compiling vasnwprintf, if
NEED_WPRINTF_DIRECTIVE_LA, handle the %La and %LA directives ourselves.
* doc/posix-functions/swprintf.texi: Mention the %La bug.

2 years agostdio: Fix compilation error in C++ mode on macOS.
Bruno Haible [Fri, 7 Apr 2023 21:42:41 +0000 (23:42 +0200)]
stdio: Fix compilation error in C++ mode on macOS.

* lib/stdio.in.h (getw, putw): Repeat the declaration even if the
function is already supposed to be declared.

2 years agovasnwprintf-posix tests: Avoid test failure on mingw.
Bruno Haible [Fri, 7 Apr 2023 21:23:47 +0000 (23:23 +0200)]
vasnwprintf-posix tests: Avoid test failure on mingw.

* tests/test-vasnwprintf-posix.c (test_function): For mingw, change two
expected test results.

2 years agouchar: Force inline functions to C linkage in C++ mode.
Bruno Haible [Thu, 6 Apr 2023 14:14:13 +0000 (16:14 +0200)]
uchar: Force inline functions to C linkage in C++ mode.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Put definitions of
_GL_BEGIN_C_LINKAGE, _GL_END_C_LINKAGE into config.h.
* lib/uchar.in.h: Enclose all inline functions in _GL_BEGIN_C_LINKAGE /
_GL_END_C_LINKAGE.

2 years agoalignalloc: Fix link error on glibc 2.15 systems.
Bruno Haible [Thu, 6 Apr 2023 13:06:26 +0000 (15:06 +0200)]
alignalloc: Fix link error on glibc 2.15 systems.

* lib/alignalloc.h (ALIGNALLOC_VIA_ALIGNED_ALLOC): Set to 0 on
glibc 2.15 systems.

2 years agodoc: Add references to registered Haiku bugs.
Bruno Haible [Wed, 5 Apr 2023 23:10:30 +0000 (01:10 +0200)]
doc: Add references to registered Haiku bugs.

* doc/posix-functions/call_once.texi: Mention Haiku bug.
* doc/posix-functions/duplocale.texi: Likewise.
* doc/posix-functions/freelocale.texi: Likewise.
* doc/posix-functions/getlogin_r.texi: Likewise.
* doc/posix-functions/initstate.texi: Likewise.
* doc/posix-functions/mbrtoc32.texi: Likewise.
* doc/posix-functions/strxfrm.texi: Likewise.
* doc/posix-headers/math.texi: Update.

2 years agostring-desc-quotearg tests: Avoid a test failure on Haiku.
Bruno Haible [Wed, 5 Apr 2023 22:43:39 +0000 (00:43 +0200)]
string-desc-quotearg tests: Avoid a test failure on Haiku.

* tests/test-string-desc-quotearg.c (main): For the
clocale_quoting_style, accept also the U+2018 and U+2019 characters in
UTF-8 encoding.

2 years agorandom_r: Fix compilation error on Haiku.
Bruno Haible [Wed, 5 Apr 2023 20:01:43 +0000 (22:01 +0200)]
random_r: Fix compilation error on Haiku.

* lib/stdlib.in.h: For random_r, include <stdint.h> always.
* modules/random_r (Depends-on): Depend on 'stdint' always.

2 years agoforkpty, openpty, login_tty: Fix link errors of the tests.
Bruno Haible [Wed, 5 Apr 2023 19:37:39 +0000 (21:37 +0200)]
forkpty, openpty, login_tty: Fix link errors of the tests.

* m4/pty.m4 (gl_PTY_LIB): On Haiku, set PTY_LIB to '-lbsd'.

2 years agostrerrorname_np: Fix compilation error on Haiku.
Bruno Haible [Wed, 5 Apr 2023 15:47:05 +0000 (17:47 +0200)]
strerrorname_np: Fix compilation error on Haiku.

* lib/strerrorname_np.c (strerrorname_np): Avoid conflict between
EDOOFUS and EINVAL.
* tests/test-strerrorname_np.c (main): Likewise.

2 years agouchar: Fix recent change.
Bruno Haible [Wed, 5 Apr 2023 15:46:20 +0000 (17:46 +0200)]
uchar: Fix recent change.

* lib/uchar.in.h: Include <string.h>, <wctype.h>.

2 years agolocalename tests: Work around a Haiku bug.
Bruno Haible [Wed, 5 Apr 2023 13:17:27 +0000 (15:17 +0200)]
localename tests: Work around a Haiku bug.

* tests/test-localename.c (freelocale): New macro.

2 years agolocalename: Add support for Haiku's per-thread locales.
Bruno Haible [Wed, 5 Apr 2023 13:15:00 +0000 (15:15 +0200)]
localename: Add support for Haiku's per-thread locales.

* lib/localename.c: Include <dlfcn.h>.
(gl_locale_name_thread_unsafe): Add special code for Haiku.

2 years agouchar: Work around Haiku bug.
Bruno Haible [Wed, 5 Apr 2023 12:41:51 +0000 (14:41 +0200)]
uchar: Work around Haiku bug.

* m4/uchar_h.m4 (gl_UCHAR_H, gl_TYPE_CHAR8_T, gl_TYPE_CHAR16_T,
gl_TYPE_CHAR32_T): Before including <uchar.h>, on Haiku, first include
<stdint.h>.
* m4/c32rtomb.m4 (gl_FUNC_C32RTOMB): Likewise.
* m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32, gl_CHECK_FUNC_MBRTOC32,
gl_MBRTOC32_EMPTY_INPUT, gl_MBRTOC32_C_LOCALE, gl_MBRTOC32_SANITYCHECK):
Likewise.
* lib/uchar.in.h: On Haiku, include <stdint.h> before the include_next.
* doc/posix-headers/uchar.texi: Mention the Haiku bug.

2 years agostdlib, btowc: Fix file lists.
Bruno Haible [Wed, 5 Apr 2023 10:21:33 +0000 (12:21 +0200)]
stdlib, btowc: Fix file lists.

* modules/stdlib (Files): Add m4/codeset.m4.
* modules/btowc (Files): Likewise.
* modules/c-dtoastr-tests (Files): Likewise.
* modules/c-ldtoastr-tests (Files): Likewise.
* modules/c-snprintf-tests (Files): Likewise.
* modules/c-vasprintf-tests (Files): Likewise.
* modules/c-vsnprintf-tests (Files): Likewise.
* modules/c-xvasprintf-tests (Files): Likewise.
* modules/nl_langinfo-tests (Files): Likewise.

2 years agoduplocale: Fix compilation error on Haiku (regression 2023-01-22).
Bruno Haible [Wed, 5 Apr 2023 00:36:02 +0000 (02:36 +0200)]
duplocale: Fix compilation error on Haiku (regression 2023-01-22).

* lib/locale.in.h (duplocale): If HAVE_DUPLOCALE = 0, don't declare it,
even if REPLACE_DUPLOCALE = 1.
* modules/duplocale (Depends-on, configure.ac): Don't compile a
replacement if HAVE_DUPLOCALE = 0 and REPLACE_DUPLOCALE = 1.

2 years agoc32tob, c32is*, c32rtomb, mbrtoc32: Fix file lists.
Bruno Haible [Tue, 4 Apr 2023 21:08:48 +0000 (23:08 +0200)]
c32tob, c32is*, c32rtomb, mbrtoc32: Fix file lists.

* modules/c32tob (Files): Add m4/locale-fr.m4, m4/locale-zh.m4,
m4/codeset.m4.
* modules/c32isalnum (Files): Likewise.
* modules/c32isalpha (Files): Likewise.
* modules/c32isblank (Files): Likewise.
* modules/c32iscntrl (Files): Likewise.
* modules/c32isdigit (Files): Likewise.
* modules/c32isgraph (Files): Likewise.
* modules/c32islower (Files): Likewise.
* modules/c32isprint (Files): Likewise.
* modules/c32ispunct (Files): Likewise.
* modules/c32isspace (Files): Likewise.
* modules/c32isupper (Files): Likewise.
* modules/c32isxdigit (Files): Likewise.
* modules/c32rtomb (Files): Likewise.
* modules/mbrtoc32 (Files): Likewise.

2 years agostdlib: Work around MB_CUR_MAX bug on Solaris 10.
Bruno Haible [Tue, 4 Apr 2023 11:03:53 +0000 (13:03 +0200)]
stdlib: Work around MB_CUR_MAX bug on Solaris 10.

* lib/stdlib.in.h (gl_MB_CUR_MAX): New function.
(MB_CUR_MAX, GNULIB_defined_MB_CUR_MAX): New macros.
* m4/stdlib_h.m4 (gl_STDLIB_H): Test whether MB_CUR_MAX is correct.
(gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MB_CUR_MAX.
* modules/stdlib (Files): Add m4/locale-fr.m4.
(Makefile.am): Substitute REPLACE_MB_CUR_MAX.
* doc/posix-headers/stdlib.texi: Mention the Solaris 10 bug.

2 years ago*c32*: Inline most functions on glibc and musl libc.
Bruno Haible [Tue, 4 Apr 2023 10:38:25 +0000 (12:38 +0200)]
*c32*: Inline most functions on glibc and musl libc.

* lib/uchar.in.h: Invoke _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
(btoc32): Inline if _GL_WCHAR_T_IS_UCS4.
(c32isalnum, c32isalpha, c32isblank, c32iscntrl, c32isdigit, c32isgraph,
c32islower, c32isprint, c32ispunct, c32isspace, c32isupper,
c32isxdigit): Inline if
_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t.
(c32snrtombs, c32srtombs, c32stombs, c32tob, mbsnrtoc32s, mbsrtoc32s,
mbstoc32s): Inline if _GL_WCHAR_T_IS_UCS4.
* lib/btoc32.c: Define compilation unit marker.
(btoc32): Conditionally mark as _GL_EXTERN_INLINE.
* lib/c32isalnum.c: Define compilation unit marker.
* lib/c32isalpha.c: Likewise.
* lib/c32isblank.c: Likewise.
* lib/c32iscntrl.c: Likewise.
* lib/c32isdigit.c: Likewise.
* lib/c32isgraph.c: Likewise.
* lib/c32islower.c: Likewise.
* lib/c32isprint.c: Likewise.
* lib/c32ispunct.c: Likewise.
* lib/c32isspace.c: Likewise.
* lib/c32isupper.c: Likewise.
* lib/c32isxdigit.c: Likewise.
* lib/c32is-impl.h (FUNC): Conditionally mark as _GL_EXTERN_INLINE.
* lib/c32snrtombs.c: Define compilation unit marker.
(c32snrtombs): Conditionally mark as _GL_EXTERN_INLINE.
* lib/c32srtombs.c: Define compilation unit marker.
(c32srtombs): Conditionally mark as _GL_EXTERN_INLINE.
* lib/c32stombs.c: Define compilation unit marker.
(c32stombs): Conditionally mark as _GL_EXTERN_INLINE.
* lib/c32tob.c: Define compilation unit marker.
(c32tob): Conditionally mark as _GL_EXTERN_INLINE.
* lib/mbsnrtoc32s.c: Define compilation unit marker.
(mbsnrtoc32s): Conditionally mark as _GL_EXTERN_INLINE.
* lib/mbsrtoc32s.c: Define compilation unit marker.
(mbsrtoc32s): Conditionally mark as _GL_EXTERN_INLINE.
* lib/mbstoc32s.c: Define compilation unit marker.
(mbstoc32s): Conditionally mark as _GL_EXTERN_INLINE.
* modules/uchar (Depends-on): Add extern-inline.

2 years agobackupfile: fix bug when renaming from subdirectory
Pádraig Brady [Mon, 3 Apr 2023 17:06:22 +0000 (18:06 +0100)]
backupfile: fix bug when renaming from subdirectory

* lib/backupfile.c (backup_internal): Ensure we use the
appropriate offset if operating on a subdirectory,
i.e., on an updated sdir.
Fixes https://bugs.gnu.org/62607

2 years ago*c32*: Optimize on musl libc like on glibc.
Bruno Haible [Tue, 4 Apr 2023 10:34:12 +0000 (12:34 +0200)]
*c32*: Optimize on musl libc like on glibc.

* lib/uchar.in.h (_GL_WCHAR_T_IS_UCS4): New macro.
* lib/btoc32.c (btoc32): Test _GL_WCHAR_T_IS_UCS4 instead of __GLIBC__.
* lib/mbsrtoc32s.c: Likewise.
* lib/mbsnrtoc32s.c: Likewise.
* lib/c32tob.c (c32tob): Likewise.
* lib/c32srtombs.c: Likewise.
* lib/c32snrtombs.c: Likewise.
* lib/c32is-impl.h (FUNC): Likewise.

2 years agouchar: Rename _GL_LARGE_CHAR32_T to _GL_SMALL_WCHAR_T.
Bruno Haible [Tue, 4 Apr 2023 10:31:28 +0000 (12:31 +0200)]
uchar: Rename _GL_LARGE_CHAR32_T to _GL_SMALL_WCHAR_T.

* lib/uchar.in.h (_GL_SMALL_WCHAR_T): Renamed from _GL_LARGE_CHAR32_T.
* lib/mbrtoc32.c: Update.
* lib/mbsrtoc32s.c: Update.
* lib/mbsnrtoc32s.c: Update.
* lib/c32tob.c: Update.
* lib/c32rtomb.c: Update.
* lib/c32srtombs.c: Update.
* lib/c32snrtombs.c: Update.
* lib/c32is-impl.h: Update.
* tests/test-uchar.c: Update.

2 years agoc32rtomb: Fix an autoconf test.
Bruno Haible [Tue, 4 Apr 2023 10:18:59 +0000 (12:18 +0200)]
c32rtomb: Fix an autoconf test.

* m4/c32rtomb.m4 (gl_FUNC_C32RTOMB): In a test program, include
<stddef.h>, for NULL.

2 years agoAdd extern-inline recipe to ChangeLog comment
Paul Eggert [Mon, 3 Apr 2023 20:28:40 +0000 (13:28 -0700)]
Add extern-inline recipe to ChangeLog comment

2 years agotests: Set executable bit on more tests.
Bruno Haible [Mon, 3 Apr 2023 19:57:46 +0000 (21:57 +0200)]
tests: Set executable bit on more tests.

* tests/test-c-dtoastr.sh: Make executable.
* tests/test-c-ldtoastr.sh: Likewise.
* tests/test-immutable.sh: Likewise.
* tests/test-vasnwprintf-posix2.sh: Likewise.

2 years agofix harmless ChangeLog typo
Jim Meyering [Mon, 3 Apr 2023 19:33:36 +0000 (12:33 -0700)]
fix harmless ChangeLog typo

2 years agotests: set executable bit in test-trim[1-3].sh
Jim Meyering [Mon, 3 Apr 2023 19:27:46 +0000 (12:27 -0700)]
tests: set executable bit in test-trim[1-3].sh

This avoids a test failure for each new file.
* tests/test-trim1.sh: Make this file executable.
* tests/test-trim2.sh: Likewise.
* tests/test-trim1.sh: Likewise.

2 years agoUse the 'extern-inline' module explicitly where needed.
Bruno Haible [Mon, 3 Apr 2023 18:17:34 +0000 (20:17 +0200)]
Use the 'extern-inline' module explicitly where needed.

* modules/fdutimensat (Depends-on): Add extern-inline.
* modules/file-has-acl (Depends-on): Likewise.
* modules/hamt (Depends-on): Likewise.
* modules/relocatable-prog-wrapper (Depends-on): Likewise.
* modules/safe-alloc (Depends-on): Likewise.
* modules/string-desc (Depends-on): Likewise.
* modules/string-desc-quotearg (Depends-on): Likewise.
* modules/xstring-desc (Depends-on): Likewise.
* modules/xvasprintf (Depends-on): Likewise.

2 years agovasnprintf-posix: Fix harmless mistake (regression 2023-03-24).
Bruno Haible [Mon, 3 Apr 2023 12:45:06 +0000 (14:45 +0200)]
vasnprintf-posix: Fix harmless mistake (regression 2023-03-24).

Found by Coverity.

* lib/vasnprintf.c (MAX_ROOM_NEEDED): Insert 'break;' statement.

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

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

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.