]> Savannah Git Hosting - gnulib.git/commitdiff
mbrtoc32 tests: Add comment.
authorBruno Haible <bruno@clisp.org>
Mon, 3 Apr 2023 12:24:37 +0000 (14:24 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 3 Apr 2023 12:24:37 +0000 (14:24 +0200)
* m4/mbrtowc.m4 (gl_MBRTOWC_C_LOCALE): Add comment.
* m4/mbrtoc32.m4 (gl_MBRTOC32_C_LOCALE): Add comment.
* tests/test-mbrtoc32.c: Add comment.
* tests/test-mbrtoc32-5.sh: Use symmetric coding style.
* doc/posix-functions/mbrtoc32.texi: Update.

ChangeLog
doc/posix-functions/mbrtoc32.texi
m4/mbrtoc32.m4
m4/mbrtowc.m4
tests/test-mbrtoc32-5.sh
tests/test-mbrtoc32.c

index 2993b1561f88ecd67d39427e4d335a0bdf344bb3..7bc1a008f1c41f4560cfeb6b099df03e9a00da48 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-04-03  Bruno Haible  <bruno@clisp.org>
+
+       mbrtoc32 tests: Add comment.
+       * m4/mbrtowc.m4 (gl_MBRTOWC_C_LOCALE): Add comment.
+       * m4/mbrtoc32.m4 (gl_MBRTOC32_C_LOCALE): Add comment.
+       * tests/test-mbrtoc32.c: Add comment.
+       * tests/test-mbrtoc32-5.sh: Use symmetric coding style.
+       * doc/posix-functions/mbrtoc32.texi: Update.
+
 2023-04-02  Bruno Haible  <bruno@clisp.org>
 
        trim: Fix trim_trailing result in multibyte locales.
index d95c6702005ebbddd0c67b778c4c129440621678..7c3d6c294a7c80e24030baa2034f051a38143214 100644 (file)
@@ -12,7 +12,7 @@ glibc 2.15, macOS 11.1, FreeBSD 6.4, NetBSD 9.0, OpenBSD 6.7, Minix 3.1.8, AIX 7
 @item
 In the C or POSIX locales, this function can return @code{(size_t) -1}
 and set @code{errno} to @code{EILSEQ}:
-glibc 2.23.
+glibc 2.35.
 @item
 This function returns 0 instead of @code{(size_t) -2} when the input
 is empty:
index f2de33aff64a36cf28bc0aa5c0b526f57fb400c8..d6401fe2e46bfb0152f323612a455a9c0442843b 100644 (file)
@@ -1,4 +1,4 @@
-# mbrtoc32.m4 serial 10
+# mbrtoc32.m4 serial 11
 dnl Copyright (C) 2014-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -101,6 +101,11 @@ changequote([,])dnl
     ])
 ])
 
+dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html>
+dnl POSIX:2018 says regarding mbrtowc: "In the POSIX locale an [EILSEQ] error
+dnl cannot occur since all byte values are valid characters."  It is reasonable
+dnl to expect mbrtoc32 to behave in the same way.
+
 AC_DEFUN([gl_MBRTOC32_C_LOCALE],
 [
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
index 4bf91bec3b4e3440cee6819892733600073b8ce0..0c7a8bae69f768888fa47d1744a0355e3d4d8525 100644 (file)
@@ -712,6 +712,10 @@ dnl Test whether mbrtowc reports encoding errors in the C locale.
 dnl Although POSIX was never intended to allow this, the GNU C Library
 dnl and other implementations do it.  See:
 dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932
+dnl POSIX has now clarified it:
+dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html>
+dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte
+dnl values are valid characters."
 
 AC_DEFUN([gl_MBRTOWC_C_LOCALE],
 [
index cd000fb3c72027e80d4ce67ec2f41e75952b12e8..42137722721004ddba98a58bea8f67230f0cb212 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
+
 # Test whether the POSIX locale has encoding errors.
 LC_ALL=C \
-${CHECKER} ./test-mbrtoc32${EXEEXT} 5 || exit
+${CHECKER} ./test-mbrtoc32${EXEEXT} 5 || exit 1
 LC_ALL=POSIX \
-${CHECKER} ./test-mbrtoc32${EXEEXT} 5
+${CHECKER} ./test-mbrtoc32${EXEEXT} 5 || exit 1
+
+exit 0
index 0d75c3db14b07c6e342ee976a75688e0663080d4..a40309004ee012ff60f69a5a973510af589cd77a 100644 (file)
@@ -386,6 +386,10 @@ main (int argc, char *argv[])
 
                 wc = (char32_t) 0xBADFACE;
                 ret = mbrtoc32 (&wc, buf, 1, &state);
+                /* POSIX:2018 says regarding mbrtowc: "In the POSIX locale an
+                   [EILSEQ] error cannot occur since all byte values are valid
+                   characters."  It is reasonable to expect mbrtoc32 to behave
+                   in the same way.  */
                 ASSERT (ret == 1);
                 if (c < 0x80)
                   /* c is an ASCII character.  */