Bruno Haible [Sun, 23 Jul 2023 13:26:28 +0000 (15:26 +0200)]
fnmatch: Work around bugs on FreeBSD, NetBSD, Solaris, Cygwin, Android.
* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Add three more test cases to
the test program. Reorganize its return values.
* tests/test-fnmatch.c (main): Reflect the changes done in fnmatch.m4.
* doc/posix-functions/fnmatch.texi: Move the corresponding bug
descriptions to the "fixed by Gnulib" section.
Bruno Haible [Sun, 23 Jul 2023 12:04:59 +0000 (14:04 +0200)]
fnmatch, fnmatch-gnu: Document known bugs.
* doc/posix-headers/fnmatch.texi: Mention the macros FNM_LEADING_DIR,
FNM_CASEFOLD, FNM_EXTMATCH, FNM_FILE_NAME.
* doc/posix-functions/fnmatch.texi: Reference the glibc documentation
and the Linux man page. Document the effects of the two modules and all
the known bugs in detail.
Bruno Haible [Sat, 22 Jul 2023 23:43:43 +0000 (01:43 +0200)]
fnmatch tests: Add many more test cases.
* lib/fnmatch.in.h (GNULIB_defined_fnmatch_function): New macro.
* tests/test-fnmatch.c: Add many more test cases.
* tests/test-fnmatch-1.sh: New file, based on tests/test-mbrtoc32-5.sh.
* tests/test-fnmatch-2.sh: New file, based on tests/test-mbrtoc32-1.sh.
* tests/test-fnmatch-3.sh: New file, based on tests/test-mbrtoc32-2.sh.
* tests/test-fnmatch-4.sh: New file, based on tests/test-mbrtoc32-3.sh.
* tests/test-fnmatch-5.sh: New file, based on tests/test-mbrtoc32-4.sh.
* tests/test-fnmatch-w32.c: New file, based on tests/test-mbrtoc32-w32.c
and tests/test-fnmatch.c.
* tests/test-fnmatch-w32-1.sh: New file, based on
tests/test-mbrtoc32-w32-1.sh.
* tests/test-fnmatch-w32-2.sh: New file, based on
tests/test-mbrtoc32-w32-2.sh.
* tests/test-fnmatch-w32-3.sh: New file, based on
tests/test-mbrtoc32-w32-3.sh.
* tests/test-fnmatch-w32-4.sh: New file, based on
tests/test-mbrtoc32-w32-4.sh.
* tests/test-fnmatch-w32-5.sh: New file, based on
tests/test-mbrtoc32-w32-5.sh.
* tests/test-fnmatch-w32-6.sh: New file, based on
tests/test-mbrtoc32-w32-6.sh.
* tests/test-fnmatch-w32-7.sh: New file, based on
tests/test-mbrtoc32-w32-7.sh.
* modules/fnmatch-tests: Add the new program and shell scripts.
* tests/unistr/test-pcpy.h: New file, based on tests/unistr/test-cpy.h.
* tests/unistr/test-u8-pcpy.c: New file, based on
tests/unistr/test-u8-cpy.c.
* tests/unistr/test-u16-pcpy.c: New file, based on
tests/unistr/test-u16-cpy.c.
* tests/unistr/test-u32-pcpy.c: New file, based on
tests/unistr/test-u32-cpy.c.
* modules/unistr/u8-pcpy-tests: New file, based on
modules/unistr/u8-cpy-tests.
* modules/unistr/u16-pcpy-tests: New file, based on
modules/unistr/u16-cpy-tests.
* modules/unistr/u32-pcpy-tests: New file, based on
modules/unistr/u32-cpy-tests.
Bruno Haible [Fri, 21 Jul 2023 09:16:04 +0000 (11:16 +0200)]
unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: New modules.
* lib/unistr.in.h (u8_pcpy, u16_pcpy, u32_pcpy): New declarations.
* lib/unistr/u-pcpy.h: New file, based on lib/wmempcpy.c.
* lib/unistr/u8-pcpy.c: New file, based on lib/unistr/u8-cpy.c.
* lib/unistr/u16-pcpy.c: New file, based on lib/unistr/u16-cpy.c.
* lib/unistr/u32-pcpy.c: New file, based on lib/unistr/u32-cpy.c.
* modules/unistr/u8-pcpy: New file, based on modules/unistr/u8-cpy.
* modules/unistr/u16-pcpy: New file, based on modules/unistr/u16-cpy.
* modules/unistr/u32-pcpy: New file, based on modules/unistr/u32-cpy.
Bruno Haible [Wed, 19 Jul 2023 23:35:10 +0000 (01:35 +0200)]
Document migration path for obsolescent functions.
* doc/glibc-functions/timespec_get.texi: Add reference to ISO C.
* doc/posix-functions/_tolower.texi: Recommend use of tolower.
* doc/posix-functions/_toupper.texi: Recommend use of toupper.
* doc/posix-functions/asctime.texi: Recommend use of strftime.
* doc/posix-functions/asctime_r.texi: Likewise.
* doc/posix-functions/ctime.texi: Recommend use of localtime_r and
strftime.
* doc/posix-functions/ctime_r.texi: Likewise.
* doc/posix-functions/ftw.texi: Recommend use of fts.
* doc/posix-functions/getitimer.texi: Recommend use of timer_gettime.
* doc/posix-functions/gets.texi: Recommend use of fgets.
* doc/posix-functions/gettimeofday.texi: Recommend use of gettime or
timespec_get.
* doc/posix-functions/inet_addr.texi: Recommend use of inet_pton.
* doc/posix-functions/inet_ntoa.texi: Recommend use of inet_ntop.
* doc/posix-functions/pthread_getconcurrency.texi: Recommend no-op.
* doc/posix-functions/pthread_setconcurrency.texi: Recommend no-op.
* doc/posix-functions/rand_r.texi: Recommend use of random_r.
* doc/posix-functions/setitimer.texi: Recommend use of timer_create and
timer_settime.
* doc/posix-functions/setpgrp.texi: Recommend use of setpgid or setsid.
* doc/posix-functions/sighold.texi: Recommend use of sigprocmask.
* doc/posix-functions/sigignore.texi: Recommend use of sigaction.
* doc/posix-functions/siginterrupt.texi: Recommend use of sigaction.
* doc/posix-functions/sigpause.texi: Recommend use of sigsuspend.
* doc/posix-functions/sigrelse.texi: Recommend use of sigprocmask.
* doc/posix-functions/sigset.texi: Recommend use of sigaction.
* doc/posix-functions/tempnam.texi: Recommend use of mkstemp.
* doc/posix-functions/ulimit.texi: Recommend use of getrlimit and
setrlimit.
* doc/posix-functions/utime.texi: Recommend use of utimens.
Paul Eggert [Wed, 19 Jul 2023 20:51:55 +0000 (13:51 -0700)]
Don’t worry about Version 7 tolower
Some code ported back to pre-C89 libraries where tolower (C) had
undefined behavior if C is not an upper case character.
Nowadays that function is _tolower which is itself obsolete,
and much Gnulib code already assumes this part of C89 anyway.
Assume C89 or better tolower, which simplifies the code
and should improve performance slightly.
* lib/mbmemcasecmp.c, lib/mbmemcasecoll.c, lib/mbscasecmp.c:
* lib/mbscasestr.c, lib/mbsncasecmp.c, lib/mbspcasecmp.c:
* lib/strcasecmp.c, lib/strcasestr.c, lib/strncasecmp.c:
(TOLOWER): Remove. All uses replaced by tolower.
Paul Eggert [Wed, 19 Jul 2023 03:33:41 +0000 (20:33 -0700)]
mbiterf, mbuiterf: port to strict C17
I ran into this problem on NetBSD 9.3.
* lib/mbiterf.h (mbiterf_next) [!GNULIB_MBRTOC32_REGULAR]:
* lib/mbuiterf.h (mbuiterf_next) [!GNULIB_MBRTOC32_REGULAR]:
Don’t label a declaration.
Bruno Haible [Tue, 18 Jul 2023 11:24:35 +0000 (13:24 +0200)]
mbuiterf: New module.
* lib/mbuiterf.h: New file, based on lib/mbuiter.h.
* lib/mbuiterf.c: New file, based on lib/mbuiter.c.
* modules/mbuiterf: New file, based on modules/mbuiter.
Bruno Haible [Tue, 18 Jul 2023 10:13:57 +0000 (12:13 +0200)]
mbiterf: New module.
* lib/mbiterf.h: New file, based on lib/mbiter.h.
* lib/mbiterf.c: New file, based on lib/mbiter.c.
* modules/mbiterf: New file, based on modules/mbiter.
Bruno Haible [Mon, 17 Jul 2023 18:50:30 +0000 (20:50 +0200)]
mbuiter: Optimize.
* lib/mbuiter.h (struct mbuiter_multi): Add cur_max field.
(mbui_init): Initialize it.
(mbuiter_multi_next): Use it instead of MB_CUR_MAX.
(mbuiter_multi_copy): Update.
Bruno Haible [Mon, 17 Jul 2023 17:11:38 +0000 (19:11 +0200)]
mbchar: Reduce size of 'struct mbchar'.
* modules/mbfile (configure.ac): Define GNULIB_MBFILE as an indicator.
* lib/mbchar.h (MBCHAR_BUF_SIZE): Set to 4.
(struct mbchar): Disable member 'buf' if the module 'mbfile' is not in
use.
Bruno Haible [Mon, 17 Jul 2023 16:00:24 +0000 (18:00 +0200)]
mbszero: Source code tweaks.
Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00084.html>.
* lib/wchar.in.h: Comment changes.
(_GL_MBSTATE_INIT_SIZE): Don't define on NetBSD, Solaris, native
Windows. Use a safe default at the end.
(_GL_MBSTATE_ZERO_SIZE): Don't define on AIX, IRIX, Solaris, native
Windows. Use a safe default at the end.
* lib/mbrtoc16.c: Update comments accordingly.
Bruno Haible [Thu, 13 Jul 2023 20:59:48 +0000 (22:59 +0200)]
localcharset: Clean up locale encodings used by glibc.
* lib/localcharset.h: Remove VISCII from the list, since never supported
in glibc/localedata/SUPPORTED. JOHAB is not supported by glibc any more
since 2000-09-25. TCVN5712-1 is not supported by glibc any more since
2012-05-21.
Bruno Haible [Thu, 13 Jul 2023 09:15:04 +0000 (11:15 +0200)]
c32_get_mapping: New module.
* lib/uchar.in.h (c32_mapping_t): New type.
(c32_get_mapping): New declaration.
* lib/c32_get_mapping.c: New file, based on lib/wctrans-impl.h.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32_GET_MAPPING.
* modules/uchar (Makefile.am): Substitute GNULIB_C32_GET_MAPPING.
* modules/c32_get_mapping: New file.
Bruno Haible [Wed, 12 Jul 2023 20:44:52 +0000 (22:44 +0200)]
c32_get_type_test: New module.
* lib/uchar.in.h (c32_type_test_t): New type.
(c32_get_type_test): New declaration.
* lib/c32_get_type_test.c: New file, based on lib/wctype-impl.h.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32_GET_TYPE_TEST.
* modules/uchar (Makefile.am): Substitute GNULIB_C32_GET_TYPE_TEST.
* modules/c32_get_type_test: New file.
Gavin Smith [Wed, 12 Jul 2023 14:00:40 +0000 (16:00 +0200)]
gendocs: support chapter- and section-level split
* doc/gendocs_template: Add lines to mark parts of file to output
only when splitting HTML by node.
Remove obsolete comment about ranges of years in copyright notice
(as per Karl).
* build-aux/gendocs.sh
[!texi2html]: Strip out parts of the template depending on --split.
[texi2html] Include all of the template as before.
Paul Eggert [Tue, 11 Jul 2023 14:54:01 +0000 (07:54 -0700)]
More than one initial mbstate_t
In commentary, say "an initial state" rather than
"the initial state" for mbstate_t, as it is possible
and indeed common for there to be more than one
initial state. POSIX routinely says "an initial state".
Bruno Haible [Mon, 10 Jul 2023 22:52:23 +0000 (00:52 +0200)]
dfa: Overcome wchar_t limitations.
* lib/localeinfo.h: Include <uchar.h>. Add special definitions for GAWK.
(case_folded_counterparts): Change array element type to char32_t.
* lib/localeinfo.c: Include <uchar.h>. Add special definitions for GAWK.
(is_using_utf8, init_localeinfo): Use mbrtoc32 instead of mbrtowc.
(lonesome_lower): Change element type to 'unsigned short'.
(case_folded_counterparts): Change array element type to char32_t. Use
c32toupper instead of towupper. Use c32tolower instead of towlower.
* lib/dfa.c: Include <uchar.h>. Add special definitions for GAWK.
(struct mb_char_classes): Change element type of 'chars' to char32_t.
(mbs_to_wchar): Use mbrtoc32 instead of mbrtowc.
(setbit_wc): Change type of first argument to char32_t. Use c32tob
instead of wctob.
(parse_bracket_exp): Update.
(lex): Use c32isprint instead of iswprint. Use c32isspace instead of
iswspace. Use c32rtomb instead of a %lc directive.
(addtok_wc): Use c32rtomb instead of wcrtomb.
(atom): Update.
* modules/dfa (Depends-on): Remove wctype-h. Add uchar,
mbrtoc32-regular, c32rtomb, c32tob, c32tolower, c32toupper, c32isprint,
c32isspace.
(Link): Add $(LIBUNISTRING) $(LIBC32CONV).
* modules/dfa-tests (Makefile.am): Link test-dfa-match-aux with
$(LIBUNISTRING) $(LIBC32CONV).
* NEWS: Mention the change.