]> Savannah Git Hosting - gnulib.git/commitdiff
c32*: Optionally enforce ISO C 23 semantics of char32_t.
authorBruno Haible <bruno@clisp.org>
Tue, 27 Jun 2023 09:28:26 +0000 (11:28 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 27 Jun 2023 12:40:02 +0000 (14:40 +0200)
* lib/lc-charset-unicode.h: New file.
* lib/lc-charset-unicode.c: New file.
* modules/uchar-c23: New file.
* lib/uchar.in.h (char32_t): Add comment.
* lib/mbrtoc32.c: Include lc-charset-unicode.h.
(mbrtoc32): If char32_t is Unicode and wchar_t is not, invoke
locale_encoding_to_unicode.
* lib/btoc32.c: Include lc-charset-unicode.h.
(btoc32): If char32_t is Unicode and wchar_t is not, invoke
locale_encoding_to_unicode.
* lib/c32rtomb.c: Include lc-charset-unicode.h.
(c32rtomb): If char32_t is Unicode and wchar_t is not, invoke
unicode_to_locale_encoding.
* lib/c32tob.c: Include lc-charset-unicode.h.
(c32tob): If char32_t is Unicode and wchar_t is not, invoke
unicode_to_locale_encoding.
* lib/mbsnrtoc32s.c: If char32_t is Unicode and wchar_t is not, don't
use mbsnrtowcs.
* lib/mbsrtoc32s.c: If char32_t is Unicode and wchar_t is not, don't use
mbsrtowcs.
* lib/c32snrtombs.c: If char32_t is Unicode and wchar_t is not, don't
use wcsnrtombs.
* lib/c32srtombs.c: If char32_t is Unicode and wchar_t is not, don't use
wcsrtombs.
* lib/c32is-impl.h: Include lc-charset-unicode.h.
(FUNC): If char32_t is Unicode and wchar_t is not, use UCS_FUNC.
* lib/c32to-impl.h: Include lc-charset-unicode.h.
(FUNC): If char32_t is Unicode and wchar_t is not, use UCS_FUNC.
* lib/c32width.c: Include lc-charset-unicode.h.
(c32width): If char32_t is Unicode and wchar_t is not, use uc_width.
* tests/test-mbrtoc32.c: Include <wchar.h>.
(main): Skip GB18030 tests on NetBSD and Solaris. If
GL_CHAR32_T_IS_UNICODE, expect Unicode encoding for the char32_t values.
* tests/test-mbrtoc32-w32.c: Include <wchar.h>.
(test_one_locale): Simplify.
* tests/test-c32rtomb.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32rtomb.sh: Update.
* tests/test-mbsnrtoc32s.c: Include <wchar.h>.
(main): Skip GB18030 tests on NetBSD and Solaris.
* tests/test-mbsrtoc32s.c: Include <wchar.h>.
(main): Skip GB18030 tests on NetBSD and Solaris.
* tests/test-mbstoc32s.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32snrtombs.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32srtombs.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32stombs.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32isalnum.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32isalnum.sh: Update.
* tests/test-c32isalpha.c (main): Skip GB18030 tests on NetBSD and
Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
Solaris.
* tests/test-c32isalpha.sh: Update.
* tests/test-c32isblank.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32isblank.sh: Update.
* tests/test-c32iscntrl.c (main): Skip GB18030 tests on NetBSD and
Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
Solaris.
* tests/test-c32iscntrl.sh: Update.
* tests/test-c32isdigit.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32isdigit.sh: Update.
* tests/test-c32isgraph.c (main): Skip GB18030 tests on NetBSD and
Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
Solaris.
* tests/test-c32isgraph.sh: Update.
* tests/test-c32islower.c (main): Skip GB18030 tests on NetBSD and
Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
Solaris.
* tests/test-c32islower.sh: Update.
* tests/test-c32isprint.c (main): Skip GB18030 tests on NetBSD and
Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
Solaris.
* tests/test-c32isprint.sh: Update.
* tests/test-c32ispunct.c (main): Skip GB18030 tests on NetBSD and
Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
Solaris.
* tests/test-c32ispunct.sh: Update.
* tests/test-c32isspace.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32isspace.sh: Update.
* tests/test-c32isupper.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32isupper.sh: Update.
* tests/test-c32isxdigit.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32isxdigit.sh: Update.
* tests/test-c32tolower.c (main): Skip GB18030 tests on NetBSD and
Solaris.
* tests/test-c32tolower.sh: Update.
* tests/test-c32toupper.c (main): Skip GB18030 tests on NetBSD and
Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
Solaris.
* tests/test-c32toupper.sh: Update.
* modules/mbrtoc32 (Link): Add $(LIBUNISTRING) $(LIBC32CONV).
* modules/mbrtoc32-tests (Makefile.am): Link test-mbrtoc32 with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/btoc32 (Link): New section.
* modules/btoc32-tests (Makefile.am): Link test-btoc32 with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/c32rtomb (Link): New section.
* modules/c32rtomb-tests (Makefile.am): Link test-c32rtomb with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/c32tob (Link): New section.
* modules/mbsnrtoc32s (Link): Add $(LIBUNISTRING) $(LIBC32CONV).
* modules/mbsnrtoc32s-tests (Makefile.am): Link test-mbsnrtoc32s with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/mbsrtoc32s (Link): Add $(LIBUNISTRING) $(LIBC32CONV).
* modules/mbsrtoc32s-tests (Makefile.am): Link test-mbsrtoc32s with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/mbstoc32s (Link): Add $(LIBUNISTRING) $(LIBC32CONV).
* modules/mbstoc32s-tests (Makefile.am): Link test-mbstoc32s with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/c32snrtombs (Link): New section.
* modules/c32snrtombs-tests (Makefile.am): Link test-c32snrtombs with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/c32srtombs (Link): New section.
* modules/c32srtombs-tests (Makefile.am): Link test-c32srtombs with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/c32stombs (Link): New section.
* modules/c32stombs-tests (Makefile.am): Link test-c32stombs with
$(LIBUNISTRING) $(LIBC32CONV).
* modules/c32isalnum (Link): Add $(LIBC32CONV).
* modules/c32isalnum-tests (Makefile.am): Link test-c32isalnum with
$(LIBC32CONV).
* modules/c32isalpha (Link): Add $(LIBC32CONV).
* modules/c32isalpha-tests (Makefile.am): Link test-c32isalpha with
$(LIBC32CONV).
* modules/c32isblank (Link): Add $(LIBC32CONV).
* modules/c32isblank-tests (Makefile.am): Link test-c32isblank with
$(LIBC32CONV).
* modules/c32iscntrl (Link): Add $(LIBC32CONV).
* modules/c32iscntrl-tests (Makefile.am): Link test-c32iscntrl with
$(LIBC32CONV).
* modules/c32isdigit (Link): Add $(LIBC32CONV).
* modules/c32isdigit-tests (Makefile.am): Link test-c32isdigit with
$(LIBC32CONV).
* modules/c32isgraph (Link): Add $(LIBC32CONV).
* modules/c32isgraph-tests (Makefile.am): Link test-c32isgraph with
$(LIBC32CONV).
* modules/c32islower (Link): Add $(LIBC32CONV).
* modules/c32islower-tests (Makefile.am): Link test-c32islower with
$(LIBC32CONV).
* modules/c32isprint (Link): Add $(LIBC32CONV).
* modules/c32isprint-tests (Makefile.am): Link test-c32isprint with
$(LIBC32CONV).
* modules/c32ispunct (Link): Add $(LIBC32CONV).
* modules/c32ispunct-tests (Makefile.am): Link test-c32ispunct with
$(LIBC32CONV).
* modules/c32isspace (Link): Add $(LIBC32CONV).
* modules/c32isspace-tests (Makefile.am): Link test-c32isspace with
$(LIBC32CONV).
* modules/c32isupper (Link): Add $(LIBC32CONV).
* modules/c32isupper-tests (Makefile.am): Link test-c32isupper with
$(LIBC32CONV).
* modules/c32isxdigit (Link): Add $(LIBC32CONV).
* modules/c32isxdigit-tests (Makefile.am): Link test-c32isxdigit with
$(LIBC32CONV).
* modules/c32tolower (Link): Add $(LIBC32CONV).
* modules/c32tolower-tests (Makefile.am): Link test-c32tolower with
$(LIBC32CONV).
* modules/c32toupper (Link): Add $(LIBC32CONV).
* modules/c32toupper-tests (Makefile.am): Link test-c32toupper with
$(LIBC32CONV).
* modules/c32width (Link): Add $(LIBC32CONV).
* modules/c32width-tests (Makefile.am): Link test-c32width with
$(LIBC32CONV).
* modules/c32swidth (Link): Add $(LIBC32CONV).
* modules/c32swidth-tests (Makefile.am): Link test-c32swidth with
$(LIBC32CONV).
* modules/mbchar (Link): Add $(LIBC32CONV).
* modules/mbiter (Link): Add $(LIBC32CONV).
* modules/mbuiter (Link): Add $(LIBC32CONV).
* modules/mbfile (Link): Add $(LIBC32CONV).
* modules/mbmemcasecmp (Link): Add $(LIBC32CONV).
* modules/mbmemcasecmp-tests (Makefile.am): Link test-mbmemcasecmp with
$(LIBC32CONV).
* modules/mbscasecmp (Link): Add $(LIBC32CONV).
* modules/mbscasecmp-tests (Makefile.am): Link test-mbscasecmp with
$(LIBC32CONV).
* modules/mbscasestr (Link): Add $(LIBC32CONV).
* modules/mbscasestr-tests (Makefile.am): Link test-mbscasestr1,
test-mbscasestr2, test-mbscasestr3, test-mbscasestr4 with $(LIBC32CONV).
* modules/mbschr (Link): Add $(LIBC32CONV).
* modules/mbschr-tests (Makefile.am): Link test-mbschr with
$(LIBC32CONV).
* modules/mbscspn (Link): Add $(LIBC32CONV).
* modules/mbscspn-tests (Makefile.am): Link test-mbscspn with
$(LIBC32CONV).
* modules/mbslen (Link): Add $(LIBC32CONV).
* modules/mbsncasecmp (Link): Add $(LIBC32CONV).
* modules/mbsncasecmp-tests (Makefile.am): Link test-mbsncasecmp with
$(LIBC32CONV).
* modules/mbsnlen (Link): Add $(LIBC32CONV).
* modules/mbspbrk (Link): Add $(LIBC32CONV).
* modules/mbspbrk-tests (Makefile.am): Link test-mbspbrk with
$(LIBC32CONV).
* modules/mbspcasecmp (Link): Add $(LIBC32CONV).
* modules/mbspcasecmp-tests (Makefile.am): Link test-mbspcasecmp with
$(LIBC32CONV).
* modules/mbsrchr (Link): Add $(LIBC32CONV).
* modules/mbsrchr-tests (Makefile.am): Link test-mbsrchr with
$(LIBC32CONV).
* modules/mbssep (Link): Add $(LIBC32CONV).
* modules/mbsspn (Link): Add $(LIBC32CONV).
* modules/mbsspn-tests (Makefile.am): Link test-mbsspn with
$(LIBC32CONV).
* modules/mbsstr (Link): Add $(LIBC32CONV).
* modules/mbsstr-tests (Makefile.am): Link test-mbsstr1, test-mbsstr2,
test-mbsstr3 with $(LIBC32CONV).
* modules/mbstok_r (Link): Add $(LIBC32CONV).
* modules/propername (Link): Add $(LIBC32CONV).
* modules/regex-quote (Link): Add $(LIBC32CONV).
* modules/regex-quote-tests (Makefile.am): Link test-regex-quote with
$(LIBC32CONV).
* modules/trim (Link): Add $(LIBC32CONV).
* modules/trim-tests (Makefile.am): Link test-trim with $(LIBC32CONV).
* modules/exclude (Link): Add $(LIBC32CONV).
* modules/exclude-tests (Makefile.am): Link test-exclude with
$(LIBC32CONV).
* doc/posix-headers/uchar.texi: Mention the uchar-c23 module.
* doc/posix-functions/mbrtoc32.texi: Likewise.
* doc/strings.texi (The char32_t type): Likewise.

145 files changed:
ChangeLog
doc/posix-functions/mbrtoc32.texi
doc/posix-headers/uchar.texi
doc/strings.texi
lib/btoc32.c
lib/c32is-impl.h
lib/c32rtomb.c
lib/c32snrtombs.c
lib/c32srtombs.c
lib/c32to-impl.h
lib/c32tob.c
lib/c32width.c
lib/lc-charset-unicode.c [new file with mode: 0644]
lib/lc-charset-unicode.h [new file with mode: 0644]
lib/mbrtoc32.c
lib/mbsnrtoc32s.c
lib/mbsrtoc32s.c
lib/uchar.in.h
modules/btoc32
modules/btoc32-tests
modules/c32isalnum
modules/c32isalnum-tests
modules/c32isalpha
modules/c32isalpha-tests
modules/c32isblank
modules/c32isblank-tests
modules/c32iscntrl
modules/c32iscntrl-tests
modules/c32isdigit
modules/c32isdigit-tests
modules/c32isgraph
modules/c32isgraph-tests
modules/c32islower
modules/c32islower-tests
modules/c32isprint
modules/c32isprint-tests
modules/c32ispunct
modules/c32ispunct-tests
modules/c32isspace
modules/c32isspace-tests
modules/c32isupper
modules/c32isupper-tests
modules/c32isxdigit
modules/c32isxdigit-tests
modules/c32rtomb
modules/c32rtomb-tests
modules/c32snrtombs
modules/c32snrtombs-tests
modules/c32srtombs
modules/c32srtombs-tests
modules/c32stombs
modules/c32stombs-tests
modules/c32swidth
modules/c32swidth-tests
modules/c32tob
modules/c32tolower
modules/c32tolower-tests
modules/c32toupper
modules/c32toupper-tests
modules/c32width
modules/c32width-tests
modules/exclude
modules/exclude-tests
modules/mbchar
modules/mbfile
modules/mbiter
modules/mbmemcasecmp
modules/mbmemcasecmp-tests
modules/mbrtoc32
modules/mbrtoc32-tests
modules/mbscasecmp
modules/mbscasecmp-tests
modules/mbscasestr
modules/mbscasestr-tests
modules/mbschr
modules/mbschr-tests
modules/mbscspn
modules/mbscspn-tests
modules/mbslen
modules/mbsncasecmp
modules/mbsncasecmp-tests
modules/mbsnlen
modules/mbsnrtoc32s
modules/mbsnrtoc32s-tests
modules/mbspbrk
modules/mbspbrk-tests
modules/mbspcasecmp
modules/mbspcasecmp-tests
modules/mbsrchr
modules/mbsrchr-tests
modules/mbsrtoc32s
modules/mbsrtoc32s-tests
modules/mbssep
modules/mbsspn
modules/mbsspn-tests
modules/mbsstr
modules/mbsstr-tests
modules/mbstoc32s
modules/mbstoc32s-tests
modules/mbstok_r
modules/mbuiter
modules/propername
modules/regex-quote
modules/regex-quote-tests
modules/trim
modules/trim-tests
modules/uchar-c23 [new file with mode: 0644]
tests/test-c32isalnum.c
tests/test-c32isalnum.sh
tests/test-c32isalpha.c
tests/test-c32isalpha.sh
tests/test-c32isblank.c
tests/test-c32isblank.sh
tests/test-c32iscntrl.c
tests/test-c32iscntrl.sh
tests/test-c32isdigit.c
tests/test-c32isdigit.sh
tests/test-c32isgraph.c
tests/test-c32isgraph.sh
tests/test-c32islower.c
tests/test-c32islower.sh
tests/test-c32isprint.c
tests/test-c32isprint.sh
tests/test-c32ispunct.c
tests/test-c32ispunct.sh
tests/test-c32isspace.c
tests/test-c32isspace.sh
tests/test-c32isupper.c
tests/test-c32isupper.sh
tests/test-c32isxdigit.c
tests/test-c32isxdigit.sh
tests/test-c32rtomb.c
tests/test-c32rtomb.sh
tests/test-c32snrtombs.c
tests/test-c32srtombs.c
tests/test-c32stombs.c
tests/test-c32tolower.c
tests/test-c32tolower.sh
tests/test-c32toupper.c
tests/test-c32toupper.sh
tests/test-mbrtoc32-w32.c
tests/test-mbrtoc32.c
tests/test-mbsnrtoc32s.c
tests/test-mbsrtoc32s.c
tests/test-mbstoc32s.c

index e17c29f1dc3a4bdb8204c67bbdf205ee4bbcbaa5..820285f2d9ca74b8e226887bbc005649def16efb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,235 @@
+2023-06-27  Bruno Haible  <bruno@clisp.org>
+
+       c32*: Optionally enforce ISO C 23 semantics of char32_t.
+       * lib/lc-charset-unicode.h: New file.
+       * lib/lc-charset-unicode.c: New file.
+       * modules/uchar-c23: New file.
+       * lib/uchar.in.h (char32_t): Add comment.
+       * lib/mbrtoc32.c: Include lc-charset-unicode.h.
+       (mbrtoc32): If char32_t is Unicode and wchar_t is not, invoke
+       locale_encoding_to_unicode.
+       * lib/btoc32.c: Include lc-charset-unicode.h.
+       (btoc32): If char32_t is Unicode and wchar_t is not, invoke
+       locale_encoding_to_unicode.
+       * lib/c32rtomb.c: Include lc-charset-unicode.h.
+       (c32rtomb): If char32_t is Unicode and wchar_t is not, invoke
+       unicode_to_locale_encoding.
+       * lib/c32tob.c: Include lc-charset-unicode.h.
+       (c32tob): If char32_t is Unicode and wchar_t is not, invoke
+       unicode_to_locale_encoding.
+       * lib/mbsnrtoc32s.c: If char32_t is Unicode and wchar_t is not, don't
+       use mbsnrtowcs.
+       * lib/mbsrtoc32s.c: If char32_t is Unicode and wchar_t is not, don't use
+       mbsrtowcs.
+       * lib/c32snrtombs.c: If char32_t is Unicode and wchar_t is not, don't
+       use wcsnrtombs.
+       * lib/c32srtombs.c: If char32_t is Unicode and wchar_t is not, don't use
+       wcsrtombs.
+       * lib/c32is-impl.h: Include lc-charset-unicode.h.
+       (FUNC): If char32_t is Unicode and wchar_t is not, use UCS_FUNC.
+       * lib/c32to-impl.h: Include lc-charset-unicode.h.
+       (FUNC): If char32_t is Unicode and wchar_t is not, use UCS_FUNC.
+       * lib/c32width.c: Include lc-charset-unicode.h.
+       (c32width): If char32_t is Unicode and wchar_t is not, use uc_width.
+       * tests/test-mbrtoc32.c: Include <wchar.h>.
+       (main): Skip GB18030 tests on NetBSD and Solaris. If
+       GL_CHAR32_T_IS_UNICODE, expect Unicode encoding for the char32_t values.
+       * tests/test-mbrtoc32-w32.c: Include <wchar.h>.
+       (test_one_locale): Simplify.
+       * tests/test-c32rtomb.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32rtomb.sh: Update.
+       * tests/test-mbsnrtoc32s.c: Include <wchar.h>.
+       (main): Skip GB18030 tests on NetBSD and Solaris.
+       * tests/test-mbsrtoc32s.c: Include <wchar.h>.
+       (main): Skip GB18030 tests on NetBSD and Solaris.
+       * tests/test-mbstoc32s.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32snrtombs.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32srtombs.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32stombs.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32isalnum.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32isalnum.sh: Update.
+       * tests/test-c32isalpha.c (main): Skip GB18030 tests on NetBSD and
+       Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
+       Solaris.
+       * tests/test-c32isalpha.sh: Update.
+       * tests/test-c32isblank.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32isblank.sh: Update.
+       * tests/test-c32iscntrl.c (main): Skip GB18030 tests on NetBSD and
+       Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
+       Solaris.
+       * tests/test-c32iscntrl.sh: Update.
+       * tests/test-c32isdigit.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32isdigit.sh: Update.
+       * tests/test-c32isgraph.c (main): Skip GB18030 tests on NetBSD and
+       Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
+       Solaris.
+       * tests/test-c32isgraph.sh: Update.
+       * tests/test-c32islower.c (main): Skip GB18030 tests on NetBSD and
+       Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
+       Solaris.
+       * tests/test-c32islower.sh: Update.
+       * tests/test-c32isprint.c (main): Skip GB18030 tests on NetBSD and
+       Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
+       Solaris.
+       * tests/test-c32isprint.sh: Update.
+       * tests/test-c32ispunct.c (main): Skip GB18030 tests on NetBSD and
+       Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
+       Solaris.
+       * tests/test-c32ispunct.sh: Update.
+       * tests/test-c32isspace.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32isspace.sh: Update.
+       * tests/test-c32isupper.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32isupper.sh: Update.
+       * tests/test-c32isxdigit.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32isxdigit.sh: Update.
+       * tests/test-c32tolower.c (main): Skip GB18030 tests on NetBSD and
+       Solaris.
+       * tests/test-c32tolower.sh: Update.
+       * tests/test-c32toupper.c (main): Skip GB18030 tests on NetBSD and
+       Solaris. Disable tests that would fail on macOS, FreeBSD, NetBSD,
+       Solaris.
+       * tests/test-c32toupper.sh: Update.
+       * modules/mbrtoc32 (Link): Add $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/mbrtoc32-tests (Makefile.am): Link test-mbrtoc32 with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/btoc32 (Link): New section.
+       * modules/btoc32-tests (Makefile.am): Link test-btoc32 with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/c32rtomb (Link): New section.
+       * modules/c32rtomb-tests (Makefile.am): Link test-c32rtomb with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/c32tob (Link): New section.
+       * modules/mbsnrtoc32s (Link): Add $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/mbsnrtoc32s-tests (Makefile.am): Link test-mbsnrtoc32s with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/mbsrtoc32s (Link): Add $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/mbsrtoc32s-tests (Makefile.am): Link test-mbsrtoc32s with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/mbstoc32s (Link): Add $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/mbstoc32s-tests (Makefile.am): Link test-mbstoc32s with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/c32snrtombs (Link): New section.
+       * modules/c32snrtombs-tests (Makefile.am): Link test-c32snrtombs with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/c32srtombs (Link): New section.
+       * modules/c32srtombs-tests (Makefile.am): Link test-c32srtombs with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/c32stombs (Link): New section.
+       * modules/c32stombs-tests (Makefile.am): Link test-c32stombs with
+       $(LIBUNISTRING) $(LIBC32CONV).
+       * modules/c32isalnum (Link): Add $(LIBC32CONV).
+       * modules/c32isalnum-tests (Makefile.am): Link test-c32isalnum with
+       $(LIBC32CONV).
+       * modules/c32isalpha (Link): Add $(LIBC32CONV).
+       * modules/c32isalpha-tests (Makefile.am): Link test-c32isalpha with
+       $(LIBC32CONV).
+       * modules/c32isblank (Link): Add $(LIBC32CONV).
+       * modules/c32isblank-tests (Makefile.am): Link test-c32isblank with
+       $(LIBC32CONV).
+       * modules/c32iscntrl (Link): Add $(LIBC32CONV).
+       * modules/c32iscntrl-tests (Makefile.am): Link test-c32iscntrl with
+       $(LIBC32CONV).
+       * modules/c32isdigit (Link): Add $(LIBC32CONV).
+       * modules/c32isdigit-tests (Makefile.am): Link test-c32isdigit with
+       $(LIBC32CONV).
+       * modules/c32isgraph (Link): Add $(LIBC32CONV).
+       * modules/c32isgraph-tests (Makefile.am): Link test-c32isgraph with
+       $(LIBC32CONV).
+       * modules/c32islower (Link): Add $(LIBC32CONV).
+       * modules/c32islower-tests (Makefile.am): Link test-c32islower with
+       $(LIBC32CONV).
+       * modules/c32isprint (Link): Add $(LIBC32CONV).
+       * modules/c32isprint-tests (Makefile.am): Link test-c32isprint with
+       $(LIBC32CONV).
+       * modules/c32ispunct (Link): Add $(LIBC32CONV).
+       * modules/c32ispunct-tests (Makefile.am): Link test-c32ispunct with
+       $(LIBC32CONV).
+       * modules/c32isspace (Link): Add $(LIBC32CONV).
+       * modules/c32isspace-tests (Makefile.am): Link test-c32isspace with
+       $(LIBC32CONV).
+       * modules/c32isupper (Link): Add $(LIBC32CONV).
+       * modules/c32isupper-tests (Makefile.am): Link test-c32isupper with
+       $(LIBC32CONV).
+       * modules/c32isxdigit (Link): Add $(LIBC32CONV).
+       * modules/c32isxdigit-tests (Makefile.am): Link test-c32isxdigit with
+       $(LIBC32CONV).
+       * modules/c32tolower (Link): Add $(LIBC32CONV).
+       * modules/c32tolower-tests (Makefile.am): Link test-c32tolower with
+       $(LIBC32CONV).
+       * modules/c32toupper (Link): Add $(LIBC32CONV).
+       * modules/c32toupper-tests (Makefile.am): Link test-c32toupper with
+       $(LIBC32CONV).
+       * modules/c32width (Link): Add $(LIBC32CONV).
+       * modules/c32width-tests (Makefile.am): Link test-c32width with
+       $(LIBC32CONV).
+       * modules/c32swidth (Link): Add $(LIBC32CONV).
+       * modules/c32swidth-tests (Makefile.am): Link test-c32swidth with
+       $(LIBC32CONV).
+       * modules/mbchar (Link): Add $(LIBC32CONV).
+       * modules/mbiter (Link): Add $(LIBC32CONV).
+       * modules/mbuiter (Link): Add $(LIBC32CONV).
+       * modules/mbfile (Link): Add $(LIBC32CONV).
+       * modules/mbmemcasecmp (Link): Add $(LIBC32CONV).
+       * modules/mbmemcasecmp-tests (Makefile.am): Link test-mbmemcasecmp with
+       $(LIBC32CONV).
+       * modules/mbscasecmp (Link): Add $(LIBC32CONV).
+       * modules/mbscasecmp-tests (Makefile.am): Link test-mbscasecmp with
+       $(LIBC32CONV).
+       * modules/mbscasestr (Link): Add $(LIBC32CONV).
+       * modules/mbscasestr-tests (Makefile.am): Link test-mbscasestr1,
+       test-mbscasestr2, test-mbscasestr3, test-mbscasestr4 with $(LIBC32CONV).
+       * modules/mbschr (Link): Add $(LIBC32CONV).
+       * modules/mbschr-tests (Makefile.am): Link test-mbschr with
+       $(LIBC32CONV).
+       * modules/mbscspn (Link): Add $(LIBC32CONV).
+       * modules/mbscspn-tests (Makefile.am): Link test-mbscspn with
+       $(LIBC32CONV).
+       * modules/mbslen (Link): Add $(LIBC32CONV).
+       * modules/mbsncasecmp (Link): Add $(LIBC32CONV).
+       * modules/mbsncasecmp-tests (Makefile.am): Link test-mbsncasecmp with
+       $(LIBC32CONV).
+       * modules/mbsnlen (Link): Add $(LIBC32CONV).
+       * modules/mbspbrk (Link): Add $(LIBC32CONV).
+       * modules/mbspbrk-tests (Makefile.am): Link test-mbspbrk with
+       $(LIBC32CONV).
+       * modules/mbspcasecmp (Link): Add $(LIBC32CONV).
+       * modules/mbspcasecmp-tests (Makefile.am): Link test-mbspcasecmp with
+       $(LIBC32CONV).
+       * modules/mbsrchr (Link): Add $(LIBC32CONV).
+       * modules/mbsrchr-tests (Makefile.am): Link test-mbsrchr with
+       $(LIBC32CONV).
+       * modules/mbssep (Link): Add $(LIBC32CONV).
+       * modules/mbsspn (Link): Add $(LIBC32CONV).
+       * modules/mbsspn-tests (Makefile.am): Link test-mbsspn with
+       $(LIBC32CONV).
+       * modules/mbsstr (Link): Add $(LIBC32CONV).
+       * modules/mbsstr-tests (Makefile.am): Link test-mbsstr1, test-mbsstr2,
+       test-mbsstr3 with $(LIBC32CONV).
+       * modules/mbstok_r (Link): Add $(LIBC32CONV).
+       * modules/propername (Link): Add $(LIBC32CONV).
+       * modules/regex-quote (Link): Add $(LIBC32CONV).
+       * modules/regex-quote-tests (Makefile.am): Link test-regex-quote with
+       $(LIBC32CONV).
+       * modules/trim (Link): Add $(LIBC32CONV).
+       * modules/trim-tests (Makefile.am): Link test-trim with $(LIBC32CONV).
+       * modules/exclude (Link): Add $(LIBC32CONV).
+       * modules/exclude-tests (Makefile.am): Link test-exclude with
+       $(LIBC32CONV).
+       * doc/posix-headers/uchar.texi: Mention the uchar-c23 module.
+       * doc/posix-functions/mbrtoc32.texi: Likewise.
+       * doc/strings.texi (The char32_t type): Likewise.
+
 2023-06-27  Bruno Haible  <bruno@clisp.org>
 
        striconveh: Fix module description.
index 27700d4376f9943e7d538e22d377959559f5fd64..91f88bf86f911b39a7dff792a37cc7f44a876ea2 100644 (file)
@@ -31,3 +31,7 @@ Portability problems not fixed by Gnulib:
 This function is only defined as an inline function on some platforms:
 Haiku 2020.
 @end itemize
+
+Note: If you want the guarantee that the @code{char32_t} values returned
+by this function are Unicode code points, you also need to request the
+@code{uchar-c23} module.
index 64c8e3a8d709944d6716cba79182fc33a74b6572..60e717ff2162aa526b0e370aaf75f5e6c69cdf3a 100644 (file)
@@ -5,9 +5,9 @@ Defines the types @code{char16_t}, @code{char32_t} and declares the
 functions @code{mbrtoc16}, @code{c16rtomb}, @code{mbrtoc32},
 @code{c32rtomb}.
 
-Gnulib module: uchar
+Gnulib module: uchar or uchar-c23
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{uchar} or @code{uchar-c23}:
 @itemize
 @item
 This header file is missing on many non-glibc platforms:
@@ -21,6 +21,14 @@ This file produces compilation errors in C++ mode on some platforms:
 AIX 7.2 with xlclang++.
 @end itemize
 
+Portability problems fixed by Gnulib module @code{uchar-c23}:
+@itemize
+@item
+@code{char32_t} values may not be Unicode code points.
+This is the case in ISO C 11 compliant but not ISO C 23 compliant
+implementations.
+@end itemize
+
 Portability problems not fixed by Gnulib:
 @itemize
 @end itemize
index 7a074e404082292da95f9dc5d967ff132ce55c18..ecf92f3da4336dadca90395a477c4690745777d6 100644 (file)
@@ -703,6 +703,15 @@ values already always were 32-bit and Unicode code points.
 @code{*c32*} functions are optimized so that on glibc systems they
 immediately redirect to the corresponding @code{*wc*} functions.
 
+Gnulib implements the ISO C 23 semantics of @code{char32_t} when you
+import the @samp{uchar-c23} module.  Without this module, it implements
+only the ISO C 11 semantics; the effect is that on some platforms
+(macOS, FreeBSD, NetBSD, Solaris) a @code{char32_t} value is the same
+as a @code{wchar_t} value, not a Unicode code point.  Thus, when you
+want to pass @code{char32_t} values to GNU libunistring or to some Unicode
+centric Gnulib functions, you need the @samp{uchar-c23} module in order
+to do so without portability problems.
+
 @node The mbchar_t type
 @subsection The @code{mbchar_t} type
 
index 07fbe194b694fb9baa434621146f93685092457c..c5ed227a8be25d5a160beee5023a3a63bdefb328 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
 #if _GL_WCHAR_T_IS_UCS4
 _GL_EXTERN_INLINE
 #endif
@@ -49,6 +53,15 @@ btoc32 (int c)
 #else
   /* In all known locale encodings, unibyte characters correspond only to
      characters in the BMP.  */
-  return btowc (c);
+  wint_t wc = btowc (c);
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  if (wc != WEOF && wc != 0)
+    {
+      wc = locale_encoding_to_unicode (wc);
+      if (wc == 0)
+        return WEOF;
+    }
+# endif
+  return wc;
 #endif
 }
index 74278417b1d0715f47fffc31a87d93f60da32541..aadc1bc7bd499cf67622b1974d51f715021469d2 100644 (file)
 # include "streq.h"
 #endif
 
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
 #include "unictype.h"
 
 #if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
@@ -92,6 +96,10 @@ FUNC (wint_t wc)
   /* char32_t and wchar_t are equivalent.  */
   static_assert (sizeof (char32_t) == sizeof (wchar_t));
 
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  return UCS_FUNC (wc);
+# else
   return WCHAR_FUNC (wc);
+# endif
 #endif
 }
index 298c6be235162ec6b6cfad520b484cb72ab47530..1f6acc97d46fa94da2b3e46084aadafecb63cacd 100644 (file)
 #include "localcharset.h"
 #include "streq.h"
 
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
 size_t
 c32rtomb (char *s, char32_t wc, mbstate_t *ps)
 #undef c32rtomb
@@ -111,6 +115,17 @@ c32rtomb (char *s, char32_t wc, mbstate_t *ps)
 #else
 
   /* char32_t and wchar_t are equivalent.  */
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  if (wc != 0)
+    {
+      wc = unicode_to_locale_encoding (wc);
+      if (wc == 0)
+        {
+          errno = EILSEQ;
+          return (size_t)(-1);
+        }
+    }
+# endif
   return wcrtomb (s, (wchar_t) wc, ps);
 
 #endif
index e47df6bf8edec751f6d1ee5bfbd0f7a62c8005c2..1e0bee42f17dd887c81f5b4b5f45f93754ba6731 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <wchar.h>
 
-#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || _GL_SMALL_WCHAR_T
+#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || (GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION) || _GL_SMALL_WCHAR_T
 /* The char32_t encoding of a multibyte character may be different than its
    wchar_t encoding, or char32_t is wider than wchar_t.  */
 
index 306c75ae439ec0a3f601b0a802acd7a4c1f6d1c4..cc3796100fb0a52bc2c93347a1384196d3008488 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <wchar.h>
 
-#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || _GL_SMALL_WCHAR_T
+#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || (GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION) || _GL_SMALL_WCHAR_T
 /* The char32_t encoding of a multibyte character may be different than its
    wchar_t encoding, or char32_t is wider than wchar_t.  */
 
index 923825589b684dbc9fe4e6c7e36339b1c539930c..e3e6ad163164ec5fed0376791bc4e6cbe80689db 100644 (file)
 # include "streq.h"
 #endif
 
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
 #include "unicase.h"
 
 #if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
@@ -79,6 +83,10 @@ FUNC (wint_t wc)
   /* char32_t and wchar_t are equivalent.  */
   static_assert (sizeof (char32_t) == sizeof (wchar_t));
 
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  return UCS_FUNC (wc);
+# else
   return WCHAR_FUNC (wc);
+# endif
 #endif
 }
index 7b164352c542f277d9c756cfba052ad00ab4da8d..f0e0c35ef91af54389df433dbb9cd083fa97989c 100644 (file)
 #include <string.h>
 #include <wchar.h>
 
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
 #if _GL_WCHAR_T_IS_UCS4
 _GL_EXTERN_INLINE
 #endif
@@ -53,6 +57,14 @@ c32tob (wint_t wc)
   else
     return EOF;
 #else
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  if (wc != 0)
+    {
+      wc = unicode_to_locale_encoding (wc);
+      if (wc == 0)
+        return EOF;
+    }
+# endif
   return wctob (wc);
 #endif
 }
index 76371ac741928cd7f54fbfe7df69217adf2090b4..16ed595278eeba76e6a08cf978effb96b3940e3b 100644 (file)
 #endif
 
 #include "localcharset.h"
+
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
 #include "uniwidth.h"
 
 #if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
@@ -89,6 +94,9 @@ c32width (char32_t wc)
   /* char32_t and wchar_t are equivalent.  */
   static_assert (sizeof (char32_t) == sizeof (wchar_t));
 
+# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  return uc_width (wc, locale_charset ());
+# endif
   return wcwidth (wc);
 #endif
 }
diff --git a/lib/lc-charset-unicode.c b/lib/lc-charset-unicode.c
new file mode 100644 (file)
index 0000000..afbc188
--- /dev/null
@@ -0,0 +1,266 @@
+/* Conversion between the current locale's character encoding and Unicode.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "lc-charset-unicode.h"
+
+#if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+
+/* We use iconv() to convert between a 'wchar_t' value and a Unicode code point.
+   For performance reasons, we don't allocate an iconv_t for each conversion,
+   but instead cache it for subsequent conversions.  Since an iconv_t descriptor
+   can only be used in a single thread at a time, this cache must be
+   per-thread.  */
+
+# include <iconv.h>
+# include <stdlib.h>
+# include <string.h>
+# include <wchar.h>
+
+# include "localcharset.h"
+# include "streq.h"
+# include "glthread/lock.h"
+# include "glthread/tls.h"
+# include "unistr.h"
+
+/* Maximum length of encoding.  Attained for "ISO-8859-15".  */
+# define MAX_ENCODING_LEN 11
+
+struct converters
+{
+  iconv_t cd_locale_to_utf8;
+  iconv_t cd_utf8_to_locale;
+  /* NUL-terminated encoding name.  */
+  char encoding[MAX_ENCODING_LEN + 1];
+};
+
+static gl_tls_key_t converters_key; /* TLS key for a 'struct converters *' */
+
+/* Frees a 'struct converters *', for example when a thread terminates.  */
+static void
+free_converters (void *p)
+{
+  if (p != NULL)
+    {
+      struct converters *conv = p;
+      iconv_close (conv->cd_locale_to_utf8);
+      iconv_close (conv->cd_utf8_to_locale);
+      free (conv);
+    }
+}
+
+static void
+key_init (void)
+{
+  gl_tls_key_init (converters_key, free_converters);
+  /* The per-thread initial value is NULL.  */
+}
+
+/* Ensure that key_init is called once only.  */
+gl_once_define(static, key_init_once)
+
+/* Returns the per-thread 'struct converters *' that contains converters for the
+   given encoding.  Returns NULL upon failure.  */
+static struct converters *
+get_converters (const char *encoding)
+{
+  if (strlen (encoding) > MAX_ENCODING_LEN)
+    /* If this happens, increase MAX_ENCODING_LEN.  */
+    return NULL;
+
+  gl_once (key_init_once, key_init);
+  struct converters *conv = gl_tls_get (converters_key);
+  if (conv == NULL)
+    {
+      conv = (struct converters *) malloc (sizeof (struct converters));
+      if (conv == NULL)
+        /* Out of memory.  */
+        return NULL;
+      conv->cd_locale_to_utf8 = iconv_open ("UTF-8", encoding);
+      conv->cd_utf8_to_locale = iconv_open (encoding, "UTF-8");
+      if (conv->cd_locale_to_utf8 == (iconv_t)(-1)
+          || conv->cd_utf8_to_locale == (iconv_t)(-1))
+        {
+          /* iconv does not support this encoding.  */
+          if (conv->cd_locale_to_utf8 != (iconv_t)(-1))
+            iconv_close (conv->cd_locale_to_utf8);
+          if (conv->cd_utf8_to_locale != (iconv_t)(-1))
+            iconv_close (conv->cd_utf8_to_locale);
+          free (conv);
+          return NULL;
+        }
+      strcpy (conv->encoding, encoding);
+    }
+  else if (strcmp (conv->encoding, encoding) != 0)
+    {
+      /* The locale encoding of this thread changed.  */
+      iconv_t new_cd_locale_to_utf8 = iconv_open ("UTF-8", encoding);
+      iconv_t new_cd_utf8_to_locale = iconv_open (encoding, "UTF-8");
+      if (new_cd_locale_to_utf8 == (iconv_t)(-1)
+          || new_cd_utf8_to_locale == (iconv_t)(-1))
+        {
+          /* iconv does not support this encoding.  */
+          if (new_cd_locale_to_utf8 != (iconv_t)(-1))
+            iconv_close (new_cd_locale_to_utf8);
+          if (new_cd_utf8_to_locale != (iconv_t)(-1))
+            iconv_close (new_cd_utf8_to_locale);
+          return NULL;
+        }
+      iconv_close (conv->cd_locale_to_utf8);
+      iconv_close (conv->cd_utf8_to_locale);
+      conv->cd_locale_to_utf8 = new_cd_locale_to_utf8;
+      conv->cd_utf8_to_locale = new_cd_utf8_to_locale;
+      strcpy (conv->encoding, encoding);
+    }
+  return conv;
+}
+
+char32_t
+locale_encoding_to_unicode (wchar_t wc)
+{
+  /* This function is like a simplified variant of u32_conv_from_encoding,
+     that uses a cached per-thread iconv_t instead of allocating an iconv_t
+     at each call.  */
+  if (wc == 0)
+    /* Invalid argument.  */
+    abort ();
+
+  const char *encoding = locale_charset ();
+  if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+    /* Assume that if the locale encoding is UTF-8, the wchar_t encoding is
+       Unicode.  */
+    return wc;
+  if (STREQ_OPT (encoding, "ASCII", 'A', 'S', 'C', 'I', 'I', 0, 0, 0, 0))
+    /* In the POSIX locale, avoid conversion errors.  */
+    return wc;
+
+  struct converters *conv = get_converters (encoding);
+  if (conv == NULL)
+    return 0;
+
+  char mbbuf[64];
+  size_t mbcnt;
+  {
+    mbstate_t state = { 0 };
+    mbcnt = wcrtomb (mbbuf, wc, &state);
+    if (mbcnt > sizeof (mbbuf))
+      /* wcrtomb did not recognize the wide character wc.  */
+      abort ();
+  }
+
+  char utf8buf[6];
+  size_t utf8cnt;
+  {
+    char *mbptr = mbbuf;
+    size_t mbsize = mbcnt;
+    char *utf8ptr = utf8buf;
+    size_t utf8size = sizeof (utf8buf);
+    size_t ret = iconv (conv->cd_locale_to_utf8,
+                        &mbptr, &mbsize,
+                        &utf8ptr, &utf8size);
+    if (ret == (size_t)(-1))
+      /* Conversion error.  */
+      return 0;
+    if (mbsize != 0)
+      /* The input was not entirely converted.  */
+      return 0;
+    utf8cnt = sizeof (utf8buf) - utf8size; /* = utf8ptr - utf8buf */
+    if (utf8cnt == 0)
+      /* The conversion produced no output.  */
+      return 0;
+  }
+
+  ucs4_t uc;
+  if (u8_mbtouc (&uc, (const uint8_t *) utf8buf, utf8cnt) != utf8cnt)
+    /* iconv produced an invalid UTF-8 byte sequence.  */
+    abort ();
+
+  return uc;
+}
+
+wchar_t
+unicode_to_locale_encoding (char32_t uc)
+{
+  if (uc == 0)
+    /* Invalid argument.  */
+    abort ();
+
+  /* This function is like a simplified variant of u32_conv_to_encoding
+     that uses a cached per-thread iconv_t instead of allocating an iconv_t
+     at each call.  */
+  const char *encoding = locale_charset ();
+  if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+    /* Assume that if the locale encoding is UTF-8, the wchar_t encoding is
+       Unicode.  */
+    return uc;
+  if (STREQ_OPT (encoding, "ASCII", 'A', 'S', 'C', 'I', 'I', 0, 0, 0, 0))
+    /* In the POSIX locale, avoid conversion errors.  */
+    return uc;
+
+  struct converters *conv = get_converters (encoding);
+  if (conv == NULL)
+    return 0;
+
+  char utf8buf[6];
+  int utf8cnt = u8_uctomb ((uint8_t *) utf8buf, uc, sizeof (utf8buf));
+  if (utf8cnt < 0)
+    /* Out-of-range Unicode character.  */
+    return 0;
+
+  char mbbuf[64];
+  size_t mbcnt;
+  {
+    char *utf8ptr = utf8buf;
+    size_t utf8size = utf8cnt;
+    char *mbptr = mbbuf;
+    size_t mbsize = sizeof (mbbuf);
+    size_t ret = iconv (conv->cd_utf8_to_locale,
+                        &utf8ptr, &utf8size,
+                        &mbptr, &mbsize);
+    if (ret == (size_t)(-1))
+      /* Conversion error.  */
+      return 0;
+    if (utf8size != 0)
+      /* The input was not entirely converted.  */
+      return 0;
+    mbcnt = sizeof (mbbuf) - mbsize; /* = mbptr - mbbuf */
+    if (mbcnt == 0)
+      /* The conversion produced no output.  */
+      return 0;
+  }
+
+  wchar_t wc;
+  {
+    mbstate_t state = { 0 };
+    if (mbrtowc (&wc, mbbuf, mbcnt, &state) != mbcnt)
+      /* iconv produced an invalid multibyte sequence.  */
+      return 0;
+  }
+
+  return wc;
+}
+
+#else
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#endif
diff --git a/lib/lc-charset-unicode.h b/lib/lc-charset-unicode.h
new file mode 100644 (file)
index 0000000..f5a9ba9
--- /dev/null
@@ -0,0 +1,33 @@
+/* Conversion between the current locale's character encoding and Unicode.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2023.  */
+
+/* This facility is only needed on specific platforms.  */
+#if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+
+# include <wchar.h>
+# include <uchar.h>
+
+/* Returns WC (must be != 0) as a Unicode character,
+   or 0 in case it cannot be converted.  */
+extern char32_t locale_encoding_to_unicode (wchar_t wc);
+
+/* Returns UC (must be != 0) as a wide character,
+   or 0 in case it cannot be converted.  */
+extern wchar_t unicode_to_locale_encoding (char32_t uc);
+
+#endif
index 2dca9e1e5075114644f6d5ea6bf3e41fd80a2435..6a56d93a4b28502936c0ac7784c6dd73d6c459d7 100644 (file)
 #include <errno.h>
 #include <stdlib.h>
 
+#if GL_CHAR32_T_IS_UNICODE
+# include "lc-charset-unicode.h"
+#endif
+
 #if GNULIB_defined_mbstate_t /* AIX, IRIX */
 /* Implement mbrtoc32() on top of mbtowc() for the non-UTF-8 locales
    and directly for the UTF-8 locales.  */
@@ -242,6 +246,17 @@ mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
   /* char32_t and wchar_t are equivalent.  Use mbrtowc().  */
   wchar_t wc;
   size_t ret = mbrtowc (&wc, s, n, ps);
+#  if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
+  if (ret < (size_t) -2 && wc != 0)
+    {
+      wc = locale_encoding_to_unicode (wc);
+      if (wc == 0)
+        {
+          ret = (size_t) -1;
+          errno = EILSEQ;
+        }
+    }
+#  endif
   if (ret < (size_t) -2 && pwc != NULL)
     *pwc = wc;
   return ret;
index d52e9934e07235ee4a5fc4b967917b313db4df5e..5baa08fd4eda9328ceebf444f0c87af10e4eb5e2 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <wchar.h>
 
-#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || _GL_SMALL_WCHAR_T
+#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || (GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION) || _GL_SMALL_WCHAR_T
 /* The char32_t encoding of a multibyte character may be different than its
    wchar_t encoding, or char32_t is wider than wchar_t.  */
 
index 32306a50e7697a1b5b1986dd46dcca097dff90d3..d37e67056b579cb050cac49d9e1a9ac30204d8a0 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <wchar.h>
 
-#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || _GL_SMALL_WCHAR_T
+#if (HAVE_WORKING_MBRTOC32 && !_GL_WCHAR_T_IS_UCS4) || (GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION) || _GL_SMALL_WCHAR_T
 /* The char32_t encoding of a multibyte character may be different than its
    wchar_t encoding, or char32_t is wider than wchar_t.  */
 
index f46551d910316f09c6ded242d481eb9b5d2bb49a..acf730c8ca114d640213951017307f2004ddcd46 100644 (file)
@@ -110,7 +110,9 @@ typedef uint_least16_t gl_char16_t;
 /* A 32-bit variant of wchar_t.
    Note: This type is only mandated by ISO C 11 or newer.  In ISO C 23
    and newer, it denotes UTF-32 code points; in older versions of ISO C
-   it did so only on platforms on which __STDC_UTF_32__ was defined.  */
+   it did so only on platforms on which __STDC_UTF_32__ was defined.
+   In gnulib, we guarantee that it denotes UTF-32 code points if and
+   only if the module 'uchar-c23' is in use.  */
 typedef uint_least32_t char32_t;
 
 #elif @GNULIBHEADERS_OVERRIDE_CHAR32_T@
index caf36d346bbe0644ed5ecb6073bb2f6ba2ee7fe7..1a532a9eb3b0096c9d31eb9170dcc90ad23bb8d9 100644 (file)
@@ -18,6 +18,10 @@ lib_SOURCES += btoc32.c
 Include:
 <uchar.h>
 
+Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
+
 License:
 LGPLv2+
 
index b9d14eefd1c73e32ebd09ff4f1bccbc705b7f52f..a5ff796d3ec304ee03df65173855162cf928c85c 100644 (file)
@@ -19,4 +19,4 @@ Makefile.am:
 TESTS += test-btoc32-1.sh test-btoc32-2.sh test-btoc32-3.sh
 TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-btoc32
-test_btoc32_LDADD = $(LDADD) $(SETLOCALE_LIB)
+test_btoc32_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(LIBC32CONV)
index f9806022187d788f54fdc0d3ba875d737644bf86..f202a37cf0a2c8675c5ac487f3b2166e90e83579 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 3c9036cb961fba4607042d5d84f9493bba72efb2..3c8c52a5a9384657c8cb3269b004c987993c27eb 100644 (file)
@@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isalnum
-test_c32isalnum_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isalnum_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index ed1e2163074dd0e9162e68a2eea49723ac284acc..1fc1ee58dea3439930796c231c314d4cfddb605c 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 2748fee325a1e41d22562e5474216bab8763029c..22efbd68423875ce18f52c63b9086467f1fde6b5 100644 (file)
@@ -28,4 +28,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isalpha
-test_c32isalpha_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isalpha_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 531cc6e8060d6f9c05104ff8f39701541ea1fe44..ad1e7c139fddb13bce48ce81b809f3ac54fbb973 100644 (file)
@@ -37,6 +37,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 9f19076407668957a5b111ac020a2568e3684bc6..ffcab15a9a2c5738ecb931a4c590d769c314e066 100644 (file)
@@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isblank
-test_c32isblank_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isblank_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index f84937850a23daa880f22ebf873971a1d85af884..2d423795e91b3da0b75a5edd08f81882a29fd0e5 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 98a0cb8452c972d12f8abec1e979426fde9ef19f..9a25ba93605f5730a74647e4db3425688db548c5 100644 (file)
@@ -28,4 +28,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32iscntrl
-test_c32iscntrl_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32iscntrl_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index a05a5f142944d93d04115b3b73e103e8fddd64b5..631f50f9174e63deb07ab6b13328854a195a9f5a 100644 (file)
@@ -37,6 +37,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index fe83e357ed353c1a2c51452fcaed8840f17e9df4..bbb70cd352cc2224b67db8b15d683a9153ed7775 100644 (file)
@@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isdigit
-test_c32isdigit_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isdigit_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 62e6832883f04ff929f15a5649d69e7cb1c85f53..48b5e7b10ad078d4943b0bec35c40028fac724f0 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 236d456323daa48a37e35ee54e77773f0eed7230..af717306e075c492ea8e9bf505bc493cd59e678a 100644 (file)
@@ -28,4 +28,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isgraph
-test_c32isgraph_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isgraph_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index b349f3524b274cf06120cda469c39a4e02ebf552..40563f6f0acb9e5c729c7a26157d0ffb67f6e2f7 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 2f9aa1600df3c6fcf70b1ceaabd0c77bcfa3a065..e3dac1d2d962b7677346b726f23ef221df82972a 100644 (file)
@@ -28,4 +28,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32islower
-test_c32islower_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32islower_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 799ca51b93c73165ef2fe98d650c7e3727fc8722..1fc5d22a6597d1e9ac0e0c54f089480539f455f5 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 410d4544b331d08b45bfff3f0795153dbef69e5f..f421f1b9d5ebdd1afed8c85425c8f4672db27d11 100644 (file)
@@ -28,4 +28,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isprint
-test_c32isprint_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isprint_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 640c8c27a67e15be54adbbf3643d507d0881f29e..bb78c9ea6a4fafb99ccef1cca6ac44e106a68b26 100644 (file)
@@ -37,6 +37,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 7475e3bd76fb6b45a36d0e175625005655b345df..15297210b72eb23bc366d96fc53741f9cb0505f6 100644 (file)
@@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32ispunct
-test_c32ispunct_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32ispunct_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index c8ae10569e13e50b66594f116773b34d71d3581a..1b519e42ce2a37f6edce1e602288afe3d92f2fc6 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 51988a7a48fc2dc63641c29c744bae297cc63d6a..6df45cd9972a3e56745c9bb9fdf27fea63ebcfb6 100644 (file)
@@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isspace
-test_c32isspace_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isspace_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 0139fe870203e51bfce60126e3c83797fe3c38da..08838dcecf85590e35cbb798fa0afe41d871418b 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index db5783c181d16de98b5fbd410e723d2f7d1d2d99..e3584c8bd5d2fb93271954f85874ea211d0aecc6 100644 (file)
@@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isupper
-test_c32isupper_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isupper_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 40ce6bcd0053b5e51b713ab47ee7aea0727c50f6..e145ce36ce17940837610a99799e08240632f4f0 100644 (file)
@@ -38,6 +38,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 3c986916b7a1485dd49d67f10388d1796598320a..7d119dbfe157dc0552116b8bcab6229bc1edb58b 100644 (file)
@@ -26,4 +26,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32isxdigit
-test_c32isxdigit_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32isxdigit_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index f343595004f301f47530e6d1c60302fbde07221b..1662333e8dd9e80b03d4ed3a70b7e25063076889 100644 (file)
@@ -31,6 +31,10 @@ endif
 Include:
 <uchar.h>
 
+Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
+
 License:
 LGPLv2+
 
index f1f83ae45c361d0f43be69bb8cad467f9bfb7c9d..9a1e0dcedeb0b605fec05a4237793401fd1709d7 100644 (file)
@@ -40,4 +40,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32rtomb test-c32rtomb-w32
-test_c32rtomb_LDADD = $(LDADD) $(SETLOCALE_LIB)
+test_c32rtomb_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(LIBC32CONV)
index 6edf7174ed6e313f3d054b33daee72cdd1e37521..e1bd41470d5e1733f1447252e5a66ab8f98c025b 100644 (file)
@@ -24,6 +24,10 @@ lib_SOURCES += c32snrtombs.c
 Include:
 <uchar.h>
 
+Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
+
 License:
 LGPL
 
index d6e578d07d2954826eb2ada2352c8323c1d9476a..a201a83a7e00b28424b4852d6706f0051749aa77 100644 (file)
@@ -29,4 +29,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32snrtombs
-test_c32snrtombs_LDADD = $(LDADD) $(SETLOCALE_LIB)
+test_c32snrtombs_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(LIBC32CONV)
index 4d82ab7bdc9ad2d3f4a5aa67267739b1943deee4..ac1aaa7a0bba72fd1902cda463fd59c4a3f03465 100644 (file)
@@ -24,6 +24,10 @@ lib_SOURCES += c32srtombs.c
 Include:
 <uchar.h>
 
+Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
+
 License:
 LGPL
 
index bb12d4140b3880574f584860a9189b93e8acf12c..3d6678e9344c21821c16cf26020a64274d136204 100644 (file)
@@ -29,4 +29,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32srtombs
-test_c32srtombs_LDADD = $(LDADD) $(SETLOCALE_LIB)
+test_c32srtombs_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(LIBC32CONV)
index 274187778b50353aeca4dbc4909624017ccbffbd..1067c433af5b52c998970bd4fbbe3842c08ccb67 100644 (file)
@@ -18,6 +18,10 @@ lib_SOURCES += c32stombs.c
 Include:
 <uchar.h>
 
+Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
+
 License:
 LGPL
 
index 92389ba29e8871ed094bba421e9f0f6559cbcc68..63ac2074b44dc7a8952776cb4caf2e0dd690d1e6 100644 (file)
@@ -29,4 +29,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32stombs
-test_c32stombs_LDADD = $(LDADD) $(SETLOCALE_LIB)
+test_c32stombs_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(LIBC32CONV)
index df60f6b4730108cc2b7b9bbe4ab06f57a3ba6b36..4861b548debba8eeceed41f9e01a91607579f9a3 100644 (file)
@@ -28,6 +28,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index e591b9109f8d0980ffcaa896c641ea271f62257a..4ab0b00279ea617505eea3f16c8ddb086286b8e8 100644 (file)
@@ -12,4 +12,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-c32swidth
 check_PROGRAMS += test-c32swidth
-test_c32swidth_LDADD = $(LDADD) $(SETLOCALE_LIB) $(LIBUNISTRING)
+test_c32swidth_LDADD = $(LDADD) $(SETLOCALE_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 655986d9d296477e0374d1433924adfebc387b60..51b1d803597fc63c0f6eed2f0da7ebd685863be9 100644 (file)
@@ -23,6 +23,10 @@ lib_SOURCES += c32tob.c
 Include:
 <uchar.h>
 
+Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
+
 License:
 LGPL
 
index 601b0134422d77c781c94545ba359b917609355a..25579f54551a9d8cb8e0e589501a86f7470d531f 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 1153eabadc2a09f45d29f91347c364c1186d6a6f..48f53e42cfa6af5688b7a43e3ee3b0b94b5f1f3e 100644 (file)
@@ -27,4 +27,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32tolower
-test_c32tolower_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32tolower_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 54c79a6b36fd01373d7966df200c224cafea9e9f..792df3a096d122ad431d099b9e4cdb39788779a6 100644 (file)
@@ -36,6 +36,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 3de9a9da0d29fa6699d42caa71deeb48868f495b..701acc1c2e1a0fa9a09199e3158212d8e7767913 100644 (file)
@@ -29,4 +29,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-c32toupper
-test_c32toupper_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING)
+test_c32toupper_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 22c38841a9e608f371efb7d3fabc9c50eb42bef5..aeee6856e501b6435e38d086f6a390a39f0813f3 100644 (file)
@@ -33,6 +33,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index caa18b362da6d269bd93f2f8322d61b14a36bd4f..84faadf447445e546ff173512ca1e07ace0b25c2 100644 (file)
@@ -13,4 +13,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-c32width
 check_PROGRAMS += test-c32width
-test_c32width_LDADD = $(LDADD) $(SETLOCALE_LIB) $(LIBUNISTRING)
+test_c32width_LDADD = $(LDADD) $(SETLOCALE_LIB) $(LIBUNISTRING) $(LIBC32CONV)
index 93bfdaf4cfd3a140fbeff495f36ef8b6414562e5..bef926307f12d7cdcbf311f624a52dfdb3db5c5c 100644 (file)
@@ -30,6 +30,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 GPL
index 1c3b0ab67382200c01c1e1aad6616b4ee0df9af0..1fc34016726a7fefde6f1cc24cb11069cd145b70 100644 (file)
@@ -26,4 +26,4 @@ TESTS += \
  test-exclude8.sh
 
 check_PROGRAMS += test-exclude
-test_exclude_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ $(MBRTOWC_LIB) $(LIBTHREAD)
+test_exclude_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ $(MBRTOWC_LIB) $(LIBTHREAD) $(LIBC32CONV)
index 51a1c8e1b9b329bc89cc7d274e4febb12698bb9f..7d4c8f6cec2ac0a9e3de07621539ff2e72266484 100644 (file)
@@ -38,6 +38,7 @@ Include:
 
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index f7a0dc633891dac5c21dbe9b87b4c1638fe8cd69..c446e37e178e1ed830741876bfa9622c27ecfed8 100644 (file)
@@ -27,6 +27,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 082afd42f206687ce83980292e44b481ef34c534..1d50d1148e07f15ba27b4566b2e3fd9899f6e32a 100644 (file)
@@ -27,6 +27,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index cb290adabb9bea81b6a8fd6a803eb8c039bca4c4..52db8d34eedb542532c38af7a5a58e244bc1183d 100644 (file)
@@ -19,6 +19,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index bb2c4e623140f00950dc769bafef8a3afa93fdc0..50e9d683667620006490580d43a96316ca2ea652 100644 (file)
@@ -25,4 +25,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-mbmemcasecmp
-test_mbmemcasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbmemcasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 6e74fd375650510941237a57a2bf28edbce105ee..061e8a7aecb7ecc7ab860e188421ac770d65af4e 100644 (file)
@@ -52,7 +52,9 @@ Include:
 <uchar.h>
 
 Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 95cc4750bd56510fab6b575504f9759dd80a3234..3408f0c8e96e844309588bafce7bab97d473c40e 100644 (file)
@@ -46,4 +46,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbrtoc32 test-mbrtoc32-w32
-test_mbrtoc32_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbrtoc32_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index b1f7c0d4a9f890369edbee0f008c1bec5a28cd49..d0dcdf6d294caf982b098213c024b339c0628323 100644 (file)
@@ -20,6 +20,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index cd974fab2078016db761577120abc3b57ff71064..61282af8624ae22c11ac2b1fa0a2142a39f70435 100644 (file)
@@ -15,4 +15,4 @@ Makefile.am:
 TESTS += test-mbscasecmp.sh
 TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-mbscasecmp
-test_mbscasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbscasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 672cac8960188f24a6377eaffa101cee53315f84..15e925d6e19c29dc31bf3068b4237ff588cfaa4b 100644 (file)
@@ -26,6 +26,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 40f0944dbacf8146cf162fcb3b33a2c36d411767..867d2153e4908581e12e6da75cc96fea69c04183 100644 (file)
@@ -24,7 +24,7 @@ Makefile.am:
 TESTS += test-mbscasestr1 test-mbscasestr2.sh test-mbscasestr3.sh test-mbscasestr4.sh
 TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbscasestr1 test-mbscasestr2 test-mbscasestr3 test-mbscasestr4
-test_mbscasestr1_LDADD = $(LDADD) $(LIBUNISTRING) $(MBRTOWC_LIB)
-test_mbscasestr2_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
-test_mbscasestr3_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
-test_mbscasestr4_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbscasestr1_LDADD = $(LDADD) $(LIBUNISTRING) $(MBRTOWC_LIB) $(LIBC32CONV)
+test_mbscasestr2_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
+test_mbscasestr3_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
+test_mbscasestr4_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 1a68a3c93da615955f2de70b4544ec3fc431d377..e3382e08b48aaa21958e2748d0b7c5ba12353547 100644 (file)
@@ -20,6 +20,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 5ba4550d70b6be931b309fa5da201c50cfcd1b66..ef26e7336332c56e1b0c81347b622e2efe159ffa 100644 (file)
@@ -15,4 +15,4 @@ Makefile.am:
 TESTS += test-mbschr.sh
 TESTS_ENVIRONMENT += LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbschr
-test_mbschr_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbschr_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 4b2350c3240b2994eed16dbfd2e0f26a7bb107b8..76f5748f12971156b7e03408a9a3088d46a3fb30 100644 (file)
@@ -22,6 +22,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 3763e1ce3eef1546d406109ffc633a9b15f04c90..4d8cb013ea6fd8537b9d86874cd52ab54b9b4565 100644 (file)
@@ -15,4 +15,4 @@ Makefile.am:
 TESTS += test-mbscspn.sh
 TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-mbscspn
-test_mbscspn_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbscspn_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index a643fb8bcbeb9bf449d797c3241a6cdb7a536bec..55993aa59c763ad85429d1a4a53b9888ea8b1430 100644 (file)
@@ -22,6 +22,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 25b8624f1b76256aceebbd5ed843d63047d818bb..6f4300d3b72a950fc96adcedf9c73f70c16c3d71 100644 (file)
@@ -20,6 +20,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 079fedb69171cb2c35b8e691dd30f1d7f4fbf290..5ed84188ea8bc75e5800df4e4d8b97296e883b5d 100644 (file)
@@ -15,4 +15,4 @@ Makefile.am:
 TESTS += test-mbsncasecmp.sh
 TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-mbsncasecmp
-test_mbsncasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbsncasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 2dc0222cfebfe68b45fdf1e8ceedddab66de798d..307b6c34b2c2ea27a4509d71aa93be8d4c640f32 100644 (file)
@@ -20,6 +20,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 996e8a1d8f9faafbfea23a4dfee763193032d969..4134968a94cfa4979989c4a2aaf890746f108738 100644 (file)
@@ -27,7 +27,9 @@ Include:
 <uchar.h>
 
 Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index c7af163045626d6d9c6b97b8526c994a41d22c88..bb02c10852e1857aaac075ef6f8d4ccc3c7a2c9e 100644 (file)
@@ -35,4 +35,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbsnrtoc32s
-test_mbsnrtoc32s_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbsnrtoc32s_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 5570a07f1beed0ee5cc09f9107ac889296709abd..28417213125bb257fdac642f79f27869b184f044 100644 (file)
@@ -22,6 +22,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 7fa86d9a9bd9b7af0a0375d5ceca6dc41ba650e1..9ca44124cb09e5e7e999ff451a279b4458df450d 100644 (file)
@@ -15,4 +15,4 @@ Makefile.am:
 TESTS += test-mbspbrk.sh
 TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-mbspbrk
-test_mbspbrk_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbspbrk_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 20b53c41a68d53897737378cf9c63d1b536b8d9c..32f95024f80eb38f6ba848bf9e77c31171333bb6 100644 (file)
@@ -20,6 +20,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index a7d5ad6aefa6a07d30917fc40f3b8c5f8f07710b..e82a37eb23dde0b6b68675991b8366f3c66fb5dc 100644 (file)
@@ -15,4 +15,4 @@ Makefile.am:
 TESTS += test-mbspcasecmp.sh
 TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-mbspcasecmp
-test_mbspcasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbspcasecmp_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 9b660b8036058f375bba014977371fa310141fb4..fcf568186409ec4c6c87e6b1ef5668b40c0145e0 100644 (file)
@@ -20,6 +20,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 18589a3be6bbc147d10d57f1151c72ca2048b201..dba14707894b0b6f8c43f73dc032dbe9b9b1fb1a 100644 (file)
@@ -15,4 +15,4 @@ Makefile.am:
 TESTS += test-mbsrchr.sh
 TESTS_ENVIRONMENT += LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbsrchr
-test_mbsrchr_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbsrchr_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 0fec6bb042901d83702228b415c0746d21e5ac5a..816ce046d345916c7c065c7afbc4674e27a31101 100644 (file)
@@ -26,7 +26,9 @@ Include:
 <uchar.h>
 
 Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 0adc62368ed7e820fa2eb3e438046abbe0e202df..08518675187d07dbea76989fecf98dfcda4dbf2e 100644 (file)
@@ -35,4 +35,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbsrtoc32s
-test_mbsrtoc32s_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbsrtoc32s_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index 0a93cf0c7e457318bb41982481d81ef2f84cd6b7..a79538e21e06d1c22b6b4b7ef64097867111d290 100644 (file)
@@ -22,6 +22,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 650c1f4de45c5e48e04996182517d38f36fb6b56..5cc407299e35f89c8edaaa6f913a5df52b7e9897 100644 (file)
@@ -21,6 +21,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index d2cc24c206dcb2928cc1bd230cd257b843117732..d720e47bd9df82400fd454cddafe9d35650fa805 100644 (file)
@@ -15,4 +15,4 @@ Makefile.am:
 TESTS += test-mbsspn.sh
 TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
 check_PROGRAMS += test-mbsspn
-test_mbsspn_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbsspn_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index c417f6bc3fcb492940acca333d540437e479f9d3..654760cfbe529a58d343a06d812b738f0ea50880 100644 (file)
@@ -25,6 +25,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 826ad32f83a0dd247125bf404f6d647862cb705a..34d6fa89b6a5145c4c03f1c6b0c909f9708b4605 100644 (file)
@@ -20,6 +20,6 @@ Makefile.am:
 TESTS += test-mbsstr1 test-mbsstr2.sh test-mbsstr3.sh
 TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbsstr1 test-mbsstr2 test-mbsstr3
-test_mbsstr1_LDADD = $(LDADD) $(LIBUNISTRING) $(MBRTOWC_LIB)
-test_mbsstr2_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
-test_mbsstr3_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbsstr1_LDADD = $(LDADD) $(LIBUNISTRING) $(MBRTOWC_LIB) $(LIBC32CONV)
+test_mbsstr2_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
+test_mbsstr3_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index c32a4df683f076a341f247f4b79b5d25ca340a97..1c554202c9e7718eb15a910f27a25b399c61084b 100644 (file)
@@ -19,7 +19,9 @@ Include:
 <uchar.h>
 
 Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPLv2+
index 9e6dd61d267598e3cb28240e9e90405553bfb1a5..f7f6af8aa51d3b3eafd87951a48e66cf3ef31ab7 100644 (file)
@@ -33,4 +33,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_JA='@LOCALE_JA@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-mbstoc32s
-test_mbstoc32s_LDADD = $(LDADD) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
+test_mbstoc32s_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV)
index cc420ca19655627120a5171487069c6fe25230a9..6656bbad72a94edf8cc050b6543d1cbdfa8f5cba 100644 (file)
@@ -23,6 +23,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 63a11ff2f5d6a7daddc4902d3e12aba7104e05d4..23b1b20d04ff46f8992ac193550ff690057681e8 100644 (file)
@@ -28,6 +28,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 LGPL
index 2a63a0eaf022cce4cbbeae5086d32afa64b81cba..8ee9c5e32051d3682021d8b63af851a5ec564b55 100644 (file)
@@ -32,6 +32,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 GPL
index 43ddc49707eedde99bf29d522938eb4312203d06..c88d14f95a08a76a1a33608fbf639393351ac20b 100644 (file)
@@ -22,6 +22,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 GPL
index 85739b57e9ac35b821205cf5fe28fb31a5b023c8..9c5091970fe53683605a969b29c02de654610da3 100644 (file)
@@ -11,4 +11,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-regex-quote
 check_PROGRAMS += test-regex-quote
-test_regex_quote_LDADD = $(LDADD) $(LIBUNISTRING) $(LIBINTL) $(MBRTOWC_LIB) $(LIBTHREAD)
+test_regex_quote_LDADD = $(LDADD) $(LIBUNISTRING) $(LIBINTL) $(MBRTOWC_LIB) $(LIBC32CONV) $(LIBTHREAD)
index a4483c2f65e45ea0f0455bafc1088e7cb940694f..2de4d6fb011c801be39bff554275981fc00764ff 100644 (file)
@@ -23,6 +23,7 @@ Include:
 Link:
 $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
 $(MBRTOWC_LIB)
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
 
 License:
 GPL
index ece746d2df2a62ed2eb292dfbec41ba71dd4abef..12c12cba7bdc705028fc1ae5eb6eeafd7183ca97 100644 (file)
@@ -19,4 +19,4 @@ TESTS_ENVIRONMENT += \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
   LOCALE_ZH_CN='@LOCALE_ZH_CN@'
 check_PROGRAMS += test-trim
-test_trim_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ $(MBRTOWC_LIB)
+test_trim_LDADD = $(LDADD) $(LIBUNISTRING) @LIBINTL@ $(MBRTOWC_LIB) $(LIBC32CONV)
diff --git a/modules/uchar-c23 b/modules/uchar-c23
new file mode 100644 (file)
index 0000000..11e0865
--- /dev/null
@@ -0,0 +1,57 @@
+Description:
+A <uchar.h> in which the char32_t values are always Unicode code points.
+
+Files:
+lib/lc-charset-unicode.h
+lib/lc-charset-unicode.c
+
+Depends-on:
+uchar
+wchar
+iconv
+localcharset
+streq
+lock
+tls
+wcrtomb
+unistr/u8-mbtouc
+unistr/u8-uctomb
+mbrtowc
+
+configure.ac:
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AM_ICONV])
+AC_DEFINE([GL_CHAR32_T_IS_UNICODE], [1],
+  [Define if gnulib's char32_t values are always Unicode code points.])
+dnl On macOS, FreeBSD, NetBSD, Solaris, the functions mbrtoc32 and c32rtomb
+dnl need to convert between the wchar_t encoding and Unicode.
+case "$host_os" in
+  darwin* | freebsd* | dragonfly* | netbsd* | solaris*)
+    AC_DEFINE([GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION], [1],
+      [Define if gnulib needs to convert between the wchar_t encoding and Unicode.])
+    LIBC32CONV="$LIBICONV"
+    LTLIBC32CONV="$LTLIBICONV"
+    ;;
+  *)
+    LIBC32CONV=
+    LTLIBC32CONV=
+    ;;
+esac
+AC_SUBST([LIBC32CONV])
+AC_SUBST([LTLIBC32CONV])
+
+Makefile.am:
+lib_SOURCES += lc-charset-unicode.c
+
+Include:
+<uchar.h>
+
+Link:
+$(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
+$(LTLIBC32CONV) when linking with libtool, $(LIBC32CONV) otherwise
+
+License:
+LGPLv2+
+
+Maintainer:
+all
index 1d43fe261f69c2c50f0f3b9aee8866c506c7b304..9805c1331f32ff01f62eed545ea11a8687f85c6f 100644 (file)
@@ -212,6 +212,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00D7 MULTIPLICATION SIGN */
           is = for_character ("\241\301", 2);
index 9c8ec4223bfb388b2116fb12ff0bdd93494f026d..df94aaded01e2eee52faa6538c49063cc1ff46a5 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isalnum${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isalnum${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 90f79192a05fccca437fc9b805424d249fb6539d..31c98bb76f10281efc33fb2b29d50ea63ff37303 100644 (file)
@@ -158,7 +158,7 @@ main (int argc, char *argv[])
           /* U+3001 IDEOGRAPHIC COMMA */
           is = for_character ("\241\242", 2);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined __CYGWIN__)
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__)
           /* U+FF11 FULLWIDTH DIGIT ONE */
           is = for_character ("\243\261", 2);
           ASSERT (is == 0);
@@ -186,7 +186,7 @@ main (int argc, char *argv[])
           /* U+3001 IDEOGRAPHIC COMMA */
           is = for_character ("\343\200\201", 3);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX || defined __sun || defined __CYGWIN__)
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
           /* U+FF11 FULLWIDTH DIGIT ONE */
           is = for_character ("\357\274\221", 3);
           ASSERT (is == 0);
@@ -210,6 +210,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00D7 MULTIPLICATION SIGN */
           is = for_character ("\241\301", 2);
@@ -225,7 +229,7 @@ main (int argc, char *argv[])
           /* U+3001 IDEOGRAPHIC COMMA */
           is = for_character ("\241\242", 2);
           ASSERT (is == 0);
-        #if !defined __GLIBC__
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
           /* U+FF11 FULLWIDTH DIGIT ONE */
           is = for_character ("\243\261", 2);
           ASSERT (is == 0);
index 994ac3d8aac65dd944c3d5466d0344cce852e132..11c896fa60bd9d77c8e005400e48a914acdb7959 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isalpha${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isalpha${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 1f5a7747cb6e6b20dc0067f1eea05e40127127af..ac6f4251eb68e2e8c183d77d334309ea41f0fb90 100644 (file)
@@ -169,6 +169,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
         #if defined __GLIBC__
           /* U+00A0 NO-BREAK SPACE */
index 023dfc4829da995b0014a9613bcdd0ecfb74c84a..fe5f9b86bfd1989ab161a5b8a7f2e6b7dd56ca57 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isblank${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isblank${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index dd935ac8c1765974d591a025548352626a7d87f7..b47f936134b69aa320fb6bdcd8ae2d4b99e6d40c 100644 (file)
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
           /* U+00A0 NO-BREAK SPACE */
           is = for_character ("\302\240", 2);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined __FreeBSD__ || defined __DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__)
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
           /* U+202E RIGHT-TO-LEFT OVERRIDE */
           is = for_character ("\342\200\256", 3);
           ASSERT (is != 0);
@@ -153,7 +153,7 @@ main (int argc, char *argv[])
           /* U+3000 IDEOGRAPHIC SPACE */
           is = for_character ("\343\200\200", 3);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined __FreeBSD__ || defined __DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__)
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
           /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
           is = for_character ("\357\273\277", 3);
           ASSERT (is != 0);
@@ -161,7 +161,7 @@ main (int argc, char *argv[])
           /* U+20000 <CJK Ideograph> */
           is = for_character ("\360\240\200\200", 4);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined __FreeBSD__ || defined __DragonFly__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
           /* U+E0001 LANGUAGE TAG */
           is = for_character ("\363\240\200\201", 4);
           ASSERT (is != 0);
@@ -171,6 +171,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+007F <control> */
           is = for_character ("\177", 1);
@@ -178,7 +182,7 @@ main (int argc, char *argv[])
           /* U+00A0 NO-BREAK SPACE */
           is = for_character ("\201\060\204\062", 4);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
           /* U+202E RIGHT-TO-LEFT OVERRIDE */
           is = for_character ("\201\066\247\061", 4);
           ASSERT (is != 0);
@@ -186,7 +190,7 @@ main (int argc, char *argv[])
           /* U+3000 IDEOGRAPHIC SPACE */
           is = for_character ("\241\241", 2);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
           /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
           is = for_character ("\204\061\225\063", 4);
           ASSERT (is != 0);
index 555b4de63237fad22b0791907cf5ceb6b7e7dace..b27747c726fc5544efd561e4be6e5f0fceb8e0c3 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32iscntrl${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32iscntrl${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 73df34b24a3d9c307dcc7ff287cb582f5b31d978..a2a4ab1623422c8f86d3cc1a3f66944e08d52c43 100644 (file)
@@ -183,6 +183,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00B2 SUPERSCRIPT TWO */
           is = for_character ("\201\060\205\065", 4);
index 6033defc9848e5b35a76a253cddb0ce3524e6ac8..158d36287281588aa773b9510452323ad55dc4d4 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isdigit${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isdigit${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 5edf44d46552966013df3724854b4b66fda09bff..6ee7a1c8667ad4613bd83cd41fec40a5dc10ad8f 100644 (file)
@@ -166,7 +166,7 @@ main (int argc, char *argv[])
           /* U+2002 EN SPACE */
           is = for_character ("\342\200\202", 3);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX || defined __sun || defined __CYGWIN__)
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
           /* U+202E RIGHT-TO-LEFT OVERRIDE */
           is = for_character ("\342\200\256", 3);
           ASSERT (is == 0);
@@ -174,7 +174,7 @@ main (int argc, char *argv[])
           /* U+3000 IDEOGRAPHIC SPACE */
           is = for_character ("\343\200\200", 3);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX || defined __sun || defined __CYGWIN__)
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
           /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
           is = for_character ("\357\273\277", 3);
           ASSERT (is == 0);
@@ -184,7 +184,7 @@ main (int argc, char *argv[])
           is = for_character ("\360\240\200\200", 4);
           ASSERT (is != 0);
         #endif
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
           /* U+E0001 LANGUAGE TAG */
           is = for_character ("\363\240\200\201", 4);
           ASSERT (is == 0);
@@ -194,6 +194,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+007F <control> */
           is = for_character ("\177", 1);
@@ -211,7 +215,7 @@ main (int argc, char *argv[])
           /* U+2002 EN SPACE */
           is = for_character ("\201\066\243\070", 4);
           ASSERT (is == 0);
-        #if !defined __GLIBC__
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
           /* U+202E RIGHT-TO-LEFT OVERRIDE */
           is = for_character ("\201\066\247\061", 4);
           ASSERT (is == 0);
@@ -219,7 +223,7 @@ main (int argc, char *argv[])
           /* U+3000 IDEOGRAPHIC SPACE */
           is = for_character ("\241\241", 2);
           ASSERT (is == 0);
-        #if !defined __GLIBC__
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
           /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
           is = for_character ("\204\061\225\063", 4);
           ASSERT (is == 0);
@@ -229,7 +233,7 @@ main (int argc, char *argv[])
           is = for_character ("\225\062\202\066", 4);
           ASSERT (is != 0);
         #endif
-        #if !defined __GLIBC__
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
           /* U+E0001 LANGUAGE TAG */
           is = for_character ("\323\066\225\071", 4);
           ASSERT (is == 0);
index 4541aee263277c0db72a4be6b1e054679293936a..be760fb2f37e8c58a9d9ee2b4bb949760e00baab 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isgraph${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isgraph${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 6d4e222bc3abcc7900f6810e31eb5a2297e1c814..41e0e27cb6efb0cdba1590bea4287180b6584d70 100644 (file)
@@ -128,7 +128,7 @@ main (int argc, char *argv[])
           /* U+00B2 SUPERSCRIPT TWO */
           is = for_character ("\262", 1);
           ASSERT (is == 0);
-        #if !(defined __GLIBC__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
           /* U+00B5 MICRO SIGN */
           is = for_character ("\265", 1);
           ASSERT (is == 0);
@@ -267,6 +267,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00B2 SUPERSCRIPT TWO */
           is = for_character ("\201\060\205\065", 4);
index a88602ad5a2cdcbce925fb27a8eb9993371bb731..f8b9840ce021995f4411602f47e7edd811073d30 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32islower${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32islower${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 538c371f16382951bab6f3a277e3803f08cb0085..b7617ee105e056dba9ba0005e250dad1ad72ad2d 100644 (file)
@@ -169,7 +169,7 @@ main (int argc, char *argv[])
           is = for_character ("\342\200\202", 3);
           ASSERT (is != 0);
         #endif
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX || defined __sun || defined __CYGWIN__)
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__)
           /* U+202E RIGHT-TO-LEFT OVERRIDE */
           is = for_character ("\342\200\256", 3);
           ASSERT (is == 0);
@@ -179,7 +179,7 @@ main (int argc, char *argv[])
           is = for_character ("\343\200\200", 3);
           ASSERT (is != 0);
         #endif
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
           /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
           is = for_character ("\357\273\277", 3);
           ASSERT (is == 0);
@@ -189,7 +189,7 @@ main (int argc, char *argv[])
           is = for_character ("\360\240\200\200", 4);
           ASSERT (is != 0);
         #endif
-        #if !(defined __GLIBC__ || defined MUSL_LIBC || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+        #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
           /* U+E0001 LANGUAGE TAG */
           is = for_character ("\363\240\200\201", 4);
           ASSERT (is == 0);
@@ -199,6 +199,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+007F <control> */
           is = for_character ("\177", 1);
@@ -214,7 +218,7 @@ main (int argc, char *argv[])
           is = for_character ("\201\066\243\070", 4);
           ASSERT (is != 0);
         #endif
-        #if !defined __GLIBC__
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
           /* U+202E RIGHT-TO-LEFT OVERRIDE */
           is = for_character ("\201\066\247\061", 4);
           ASSERT (is == 0);
@@ -224,7 +228,7 @@ main (int argc, char *argv[])
           is = for_character ("\241\241", 2);
           ASSERT (is != 0);
         #endif
-        #if !defined __GLIBC__
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
           /* U+FEFF ZERO WIDTH NO-BREAK SPACE */
           is = for_character ("\204\061\225\063", 4);
           ASSERT (is == 0);
@@ -234,7 +238,7 @@ main (int argc, char *argv[])
           is = for_character ("\225\062\202\066", 4);
           ASSERT (is != 0);
         #endif
-        #if !defined __GLIBC__
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
           /* U+E0001 LANGUAGE TAG */
           is = for_character ("\323\066\225\071", 4);
           ASSERT (is == 0);
index 1d8d455d753928bddabc8f30d864070028971bd5..d455413ba3c31ef40940faa2d166da8fe0f20347 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isprint${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isprint${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 168ad283b95ae7ce6b4882e26c869dc333f09570..c655b6317a9d1e92c2069762dd8e10a1595d7f19 100644 (file)
@@ -246,7 +246,7 @@ main (int argc, char *argv[])
           is = for_character ("\360\235\204\200", 4);
           ASSERT (is != 0);
         #endif
-        #if !(defined __GLIBC__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
           /* U+E003A TAG COLON */
           is = for_character ("\363\240\200\272", 4);
           ASSERT (is == 0);
@@ -256,6 +256,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
         #if !(defined __FreeBSD__ || defined __DragonFly__ || defined __sun)
           /* U+00BF INVERTED QUESTION MARK */
@@ -303,7 +307,7 @@ main (int argc, char *argv[])
           is = for_character ("\224\062\273\064", 4);
           ASSERT (is != 0);
         #endif
-        #if !defined __GLIBC__
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__)
           /* U+E003A TAG COLON */
           is = for_character ("\323\066\233\066", 4);
           ASSERT (is == 0);
index b0a58709598556446c198453d031941f2d9f6e68..d818bcf7341ff71a5e5a3a96186e825a53cf0346 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32ispunct${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32ispunct${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 86170d9edc5872444a3cc2fb2e0e6d21aa7fc1fd..da6335802cbe1fb49348a654422293012f436d7a 100644 (file)
@@ -165,6 +165,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00B7 MIDDLE DOT */
           is = for_character ("\241\244", 2);
index 730b9b72532638f364734d6d1e98488bfe5026ad..a704d86bfca1255e1c53f304a2b0a8274574f84a 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isspace${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isspace${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 465a54466402bc7c22e7625bda76267f174ffc38..31daad64c0320fa158d1404dad73e9a63cb33cad 100644 (file)
@@ -259,6 +259,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00B2 SUPERSCRIPT TWO */
           is = for_character ("\201\060\205\065", 4);
index da5fcab22a236175054885d4332b6b58b5cc41b6..ea3efcb845246c06567e6c19a6c12b7e5e9d1afd 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isupper${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isupper${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index e4359f779f1985920dbfb118bd7306f9795dd0d2..0fec8a4a4bc6276d09f4aecd0debdb57b1e812aa 100644 (file)
@@ -200,6 +200,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00B2 SUPERSCRIPT TWO */
           is = for_character ("\201\060\205\065", 4);
index e78109bdb4ed4733f179ce31911247ba5bf4e683..48f8efa7320ea3662b1a25322cad581ff605ff34 100755 (executable)
@@ -32,8 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32isxdigit${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32isxdigit${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index bb4b4bec0bd9f0978f2070962878acde59bc358c..896987318178368f3bbf81a0a3f84f1d7642c7d1 100644 (file)
@@ -152,6 +152,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           const char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
 
index d2b091968beef01f7d3ff12e45c7536c2404a7bf..3239935332bec56655358ac484a074d8ea9bb0a9 100755 (executable)
@@ -28,8 +28,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32rtomb${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32rtomb${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 # Test in the POSIX locale.
index 3e397882f36b358b7326117fa4a786c94290d536..ef096795243efc6c3f65e8d2505f810e5fa20826 100644 (file)
@@ -160,6 +160,10 @@ main (int argc, char *argv[])
 
         case '4':
           /* Locale encoding is GB18030.  */
+          #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+          fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+          return 77;
+          #endif
           {
             const char original[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
 
index 1b856a992c7a4382329fa37b53a87918eb139858..3d5c67a77f9d7faae345d7299313f828462189e6 100644 (file)
@@ -160,6 +160,10 @@ main (int argc, char *argv[])
 
         case '4':
           /* Locale encoding is GB18030.  */
+          #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+          fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+          return 77;
+          #endif
           {
             const char original[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
 
index d54bc37802ffaaf39d724a66eeb26661f29f98a1..53339d1fef26eceefc7a2ba588fad33230451f1f 100644 (file)
@@ -139,6 +139,10 @@ main (int argc, char *argv[])
 
         case '4':
           /* Locale encoding is GB18030.  */
+          #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+          fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+          return 77;
+          #endif
           {
             const char original[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
 
index 30fe9b58487170cf48eae90bba315abcfee14972..1d35abb2bc0e2f2a8f9754a982bb112f5968fa32 100644 (file)
@@ -336,6 +336,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00B2 SUPERSCRIPT TWO */
           mb = for_character ("\201\060\205\065", 4);
index a0859a900e91bc40f10bfeb4ba5b564a7b5f48e2..02f3e5f655e49e2c6a879184292bc3c398d6e52b 100755 (executable)
@@ -35,8 +35,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32tolower${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32tolower${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index af27bbca09d31587727474d99df1be7fbe491f70..4ec64313714d5045fe31ff992d901243278d3f3d 100644 (file)
@@ -163,7 +163,7 @@ main (int argc, char *argv[])
           mb = for_character ("\262", 1);
           ASSERT (mb.nbytes == 1);
           ASSERT (memcmp (mb.buf, "\262", 1) == 0);
-        #if !(defined __GLIBC__ || defined __sun || defined __CYGWIN__)
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__)
           /* U+00B5 MICRO SIGN */
           mb = for_character ("\265", 1);
           ASSERT (mb.nbytes == 1);
@@ -181,7 +181,7 @@ main (int argc, char *argv[])
           mb = for_character ("\351", 1);
           ASSERT (mb.nbytes == 1);
           ASSERT (memcmp (mb.buf, "\311", 1) == 0);
-        #if !(defined __GLIBC__ || defined __DragonFly__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
+        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__))
           /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
           mb = for_character ("\377", 1);
           ASSERT (mb.nbytes == 1);
@@ -348,12 +348,16 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           /* U+00B2 SUPERSCRIPT TWO */
           mb = for_character ("\201\060\205\065", 4);
           ASSERT (mb.nbytes == 4);
           ASSERT (memcmp (mb.buf, "\201\060\205\065", 4) == 0);
-        #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __NetBSD__)
+        #if !(defined __GLIBC__ || defined __FreeBSD__ || (defined __APPLE__ && defined __MACH__) || defined __NetBSD__)
           /* U+00B5 MICRO SIGN */
           mb = for_character ("\201\060\205\070", 4);
           ASSERT (mb.nbytes == 4);
index 1c253e5460322e1f7b26120ee18125621c0c03e2..6eed37d908a1e03dafda1015f0e39388e042f999 100755 (executable)
@@ -35,8 +35,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32toupper${EXEEXT} 4 \
-  || exit 1
+  ${CHECKER} ./test-c32toupper${EXEEXT} 4
+  case $? in
+    0 | 77) ;;
+    *) exit 1 ;;
+  esac
 fi
 
 exit 0
index 403ab69ba292746a98410413e43c6f66c66218d5..686d501ed79e633cb99c62c37bf87820ac11d56f 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <wchar.h>
 
 #include "localcharset.h"
 #include "macros.h"
@@ -90,10 +91,7 @@ test_one_locale (const char *name, int codepage)
     memset (&state, '\0', sizeof (mbstate_t));
     wc = (char32_t) 0xBADFACE;
     ret = mbrtoc32 (&wc, "x", 0, &state);
-    /* gnulib's implementation returns (size_t)(-2).
-       The AIX 5.1 implementation returns (size_t)(-1).
-       glibc's implementation returns 0.  */
-    ASSERT (ret == (size_t)(-2) || ret == (size_t)(-1) || ret == 0);
+    ASSERT (ret == (size_t)(-2));
     ASSERT (mbsinit (&state));
   }
 
@@ -183,7 +181,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 1, 1, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == (unsigned char) '\374');
-        ASSERT (wc == 0x00FC);
+        ASSERT (wc == 0x00FC); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[1] = '\0';
 
@@ -196,7 +194,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 2, 3, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == (unsigned char) '\337');
-        ASSERT (wc == 0x00DF);
+        ASSERT (wc == 0x00DF); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[2] = '\0';
 
@@ -232,7 +230,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 1, 1, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == (unsigned char) '\302');
-        ASSERT (wc == 0x0622);
+        ASSERT (wc == 0x0622); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[1] = '\0';
 
@@ -245,7 +243,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 2, 3, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == (unsigned char) '\341');
-        ASSERT (wc == 0x0644);
+        ASSERT (wc == 0x0644); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[2] = '\0';
 
@@ -253,7 +251,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 3, 2, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == (unsigned char) '\346');
-        ASSERT (wc == 0x0648);
+        ASSERT (wc == 0x0648); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[3] = '\0';
 
@@ -282,7 +280,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 1, 2, &state);
         ASSERT (ret == 2);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x65E5);
+        ASSERT (wc == 0x65E5); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[1] = '\0';
         input[2] = '\0';
@@ -298,7 +296,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 4, 4, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x672C);
+        ASSERT (wc == 0x672C); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[4] = '\0';
 
@@ -311,7 +309,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 5, 3, &state);
         ASSERT (ret == 2);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x8A9E);
+        ASSERT (wc == 0x8A9E); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[5] = '\0';
         input[6] = '\0';
@@ -352,7 +350,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 1, 2, &state);
         ASSERT (ret == 2);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x65E5);
+        ASSERT (wc == 0x65E5); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[1] = '\0';
         input[2] = '\0';
@@ -368,7 +366,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 4, 4, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x672C);
+        ASSERT (wc == 0x672C); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[4] = '\0';
 
@@ -381,7 +379,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 5, 3, &state);
         ASSERT (ret == 2);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x8A9E);
+        ASSERT (wc == 0x8A9E); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[5] = '\0';
         input[6] = '\0';
@@ -422,7 +420,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 1, 2, &state);
         ASSERT (ret == 2);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x65E5);
+        ASSERT (wc == 0x65E5); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[1] = '\0';
         input[2] = '\0';
@@ -438,7 +436,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 4, 4, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x672C);
+        ASSERT (wc == 0x672C); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[4] = '\0';
 
@@ -451,7 +449,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 5, 3, &state);
         ASSERT (ret == 2);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x8A9E);
+        ASSERT (wc == 0x8A9E); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[5] = '\0';
         input[6] = '\0';
@@ -501,7 +499,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 2, 9, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x00FC);
+        ASSERT (wc == 0x00FC); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[2] = '\0';
 
@@ -514,7 +512,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 3, 8, &state);
         ASSERT (ret == 4);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x00DF);
+        ASSERT (wc == 0x00DF); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[3] = '\0';
         input[4] = '\0';
@@ -530,7 +528,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 7, 4, &state);
         ASSERT (ret == 4);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x1F60B);
+        ASSERT (wc == 0x1F60B); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[7] = '\0';
         input[8] = '\0';
@@ -608,7 +606,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 2, 7, &state);
         ASSERT (ret == 1);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x00FC);
+        ASSERT (wc == 0x00FC); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[2] = '\0';
 
@@ -621,7 +619,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 3, 6, &state);
         ASSERT (ret == 2);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x00DF);
+        ASSERT (wc == 0x00DF); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[3] = '\0';
         input[4] = '\0';
@@ -635,7 +633,7 @@ test_one_locale (const char *name, int codepage)
         ret = mbrtoc32 (&wc, input + 5, 4, &state);
         ASSERT (ret == 4);
         ASSERT (c32tob (wc) == EOF);
-        ASSERT (wc == 0x1F60B);
+        ASSERT (wc == 0x1F60B); /* expect Unicode encoding */
         ASSERT (mbsinit (&state));
         input[5] = '\0';
         input[6] = '\0';
index ecde031f3600ce59fee78e294d7d16ec7562c351..f5a51ef34eb6285cbfbb528012ba0a5bef779088 100644 (file)
@@ -28,6 +28,7 @@ SIGNATURE_CHECK (mbrtoc32, size_t,
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <wchar.h>
 
 #include "macros.h"
 
@@ -154,6 +155,9 @@ main (int argc, char *argv[])
           ret = mbrtoc32 (&wc, input + 1, 1, &state);
           ASSERT (ret == 1);
           ASSERT (c32tob (wc) == (unsigned char) '\374');
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x00FC); /* expect Unicode encoding */
+          #endif
           ASSERT (mbsinit (&state));
           input[1] = '\0';
 
@@ -166,6 +170,9 @@ main (int argc, char *argv[])
           ret = mbrtoc32 (&wc, input + 2, 3, &state);
           ASSERT (ret == 1);
           ASSERT (c32tob (wc) == (unsigned char) '\337');
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x00DF); /* expect Unicode encoding */
+          #endif
           ASSERT (mbsinit (&state));
           input[2] = '\0';
 
@@ -267,6 +274,9 @@ main (int argc, char *argv[])
           ret = mbrtoc32 (&wc, input + 1, 2, &state);
           ASSERT (ret == 2);
           ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x65E5); /* expect Unicode encoding */
+          #endif
           ASSERT (mbsinit (&state));
           input[1] = '\0';
           input[2] = '\0';
@@ -282,6 +292,9 @@ main (int argc, char *argv[])
           ret = mbrtoc32 (&wc, input + 4, 4, &state);
           ASSERT (ret == 1);
           ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x672C); /* expect Unicode encoding */
+          #endif
           ASSERT (mbsinit (&state));
           input[4] = '\0';
 
@@ -294,6 +307,9 @@ main (int argc, char *argv[])
           ret = mbrtoc32 (&wc, input + 5, 3, &state);
           ASSERT (ret == 2);
           ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x8A9E); /* expect Unicode encoding */
+          #endif
           ASSERT (mbsinit (&state));
           input[5] = '\0';
           input[6] = '\0';
@@ -308,6 +324,10 @@ main (int argc, char *argv[])
 
       case '4':
         /* Locale encoding is GB18030.  */
+        #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+        fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+        return 77;
+        #endif
         {
           char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
           memset (&state, '\0', sizeof (mbstate_t));
@@ -330,6 +350,9 @@ main (int argc, char *argv[])
           ret = mbrtoc32 (&wc, input + 2, 9, &state);
           ASSERT (ret == 1);
           ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x00FC); /* expect Unicode encoding */
+          #endif
           ASSERT (mbsinit (&state));
           input[2] = '\0';
 
@@ -342,6 +365,9 @@ main (int argc, char *argv[])
           ret = mbrtoc32 (&wc, input + 3, 8, &state);
           ASSERT (ret == 4);
           ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x00DF); /* expect Unicode encoding */
+          #endif
           ASSERT (mbsinit (&state));
           input[3] = '\0';
           input[4] = '\0';
@@ -357,6 +383,9 @@ main (int argc, char *argv[])
           ret = mbrtoc32 (&wc, input + 7, 4, &state);
           ASSERT (ret == 4);
           ASSERT (c32tob (wc) == EOF);
+          #if GL_CHAR32_T_IS_UNICODE
+          ASSERT (wc == 0x1F60B); /* expect Unicode encoding */
+          #endif
           ASSERT (mbsinit (&state));
           input[7] = '\0';
           input[8] = '\0';
index c18b66ab06d889d124258fe9d565768bc821f057..342626d2a2419c0c5ec7cc83ba4abb932516233b 100644 (file)
@@ -27,6 +27,7 @@ SIGNATURE_CHECK (mbsnrtoc32s, size_t,
 #include <locale.h>
 #include <stdio.h>
 #include <string.h>
+#include <wchar.h>
 
 #include "macros.h"
 
@@ -246,6 +247,10 @@ main (int argc, char *argv[])
 
             case '4':
               /* Locale encoding is GB18030.  */
+              #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+              fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+              return 77;
+              #endif
               {
                 char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
                 memset (&state, '\0', sizeof (mbstate_t));
index aed9d7b2fbffed55b9d6db3e3185ddafc037897a..b1576d8da5700e73ed4def0a63bd247188f3c644 100644 (file)
@@ -27,6 +27,7 @@ SIGNATURE_CHECK (mbsrtoc32s, size_t,
 #include <locale.h>
 #include <stdio.h>
 #include <string.h>
+#include <wchar.h>
 
 #include "macros.h"
 
@@ -246,6 +247,10 @@ main (int argc, char *argv[])
 
             case '4':
               /* Locale encoding is GB18030.  */
+              #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+              fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+              return 77;
+              #endif
               {
                 char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */
                 memset (&state, '\0', sizeof (mbstate_t));
index e638999bb6d7c46edecbbd6cd95f592ba5c29abb..09a1e072cf4b7fb5e17568b8ff9548f417a41304 100644 (file)
@@ -206,6 +206,10 @@ main (int argc, char *argv[])
 
             case '4':
               /* Locale encoding is GB18030.  */
+              #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
+              fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
+              return 77;
+              #endif
               {
                 char input[] = "s\250\271\201\060\211\070\224\071\375\067!"; /* "süß😋!" */