]> Savannah Git Hosting - gnulib.git/commitdiff
wctype: Rely on module iswpunct.
authorBruno Haible <bruno@clisp.org>
Wed, 30 Aug 2023 00:19:01 +0000 (02:19 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 30 Aug 2023 00:28:02 +0000 (02:28 +0200)
* m4/wctype.m4 (gl_FUNC_WCTYPE): Also test whether the "punct" class
works.
* modules/wctype (Depends-on): Add iswpunct.
* tests/test-iswctype.c (main): Add more tests of the "punct" class.
* doc/posix-functions/wctype.texi: Mention the Android problem.

ChangeLog
doc/posix-functions/wctype.texi
m4/wctype.m4
modules/wctype
tests/test-iswctype.c

index ae888b304a5884ccc43bcc56558854f7ee715b49..a83960083966ab1cc103bae530cb73ba3237ae4c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2023-08-29  Bruno Haible  <bruno@clisp.org>
 
+       wctype: Rely on module iswpunct.
+       * m4/wctype.m4 (gl_FUNC_WCTYPE): Also test whether the "punct" class
+       works.
+       * modules/wctype (Depends-on): Add iswpunct.
+       * tests/test-iswctype.c (main): Add more tests of the "punct" class.
+       * doc/posix-functions/wctype.texi: Mention the Android problem.
+
        c32ispunct: Rely on module iswpunct.
        * modules/c32ispunct (Depends-on): Add iswpunct.
        * tests/test-c32ispunct.c (main): Add a few more tests in the "C"
index 957403ccee3ee7e3e861ad20246f96e5038f7d72..6346703b6011b837c746b8e2a4e689d372c7bf05 100644 (file)
@@ -24,6 +24,10 @@ The object returned by this function for the @code{"blank"} character class
 is inconsistent with the @code{iswblank} and @code{isblank} functions
 on some platforms:
 MSVC 14.
+@item
+The object returned by this function for the @code{"punct"} character class
+is inconsistent with the @code{ispunct} function on some platforms:
+Android 11.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index ad78c8b166988ed22c29d52692b134cb2ee756db..4f3a836dc5480601b1405ae1111b956dcab24ff9 100644 (file)
@@ -1,4 +1,4 @@
-# wctype.m4 serial 5
+# wctype.m4 serial 6
 dnl Copyright (C) 2011-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,
@@ -11,10 +11,11 @@ AC_DEFUN_ONCE([gl_FUNC_WCTYPE],
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   HAVE_WCTYPE=$HAVE_WCTYPE_T
   if test $HAVE_WCTYPE = 1; then
-    AC_CACHE_CHECK([whether wctype supports the "blank" character class],
+    AC_CACHE_CHECK([whether wctype supports the "blank" and "punct" character classes],
       [gl_cv_func_wctype_works],
       [AC_RUN_IFELSE(
          [AC_LANG_SOURCE([[
+            #include <ctype.h>
             #include <wchar.h>
             #include <wctype.h>
             int main ()
@@ -25,6 +26,9 @@ AC_DEFUN_ONCE([gl_FUNC_WCTYPE],
               /* This test fails on MSVC 14.  */
               if ((! iswctype ('\t', wctype ("blank"))) != (! iswblank ('\t')))
                 return 2;
+              /* This test fails on Android 11.  */
+              if ((! iswctype ('\`', wctype ("punct"))) != (! ispunct ('\`')))
+                return 4;
               return 0;
             }
          ]])],
@@ -32,6 +36,8 @@ AC_DEFUN_ONCE([gl_FUNC_WCTYPE],
          [case "$host_os" in
                                # Guess no on native Windows.
             mingw* | windows*) gl_cv_func_wctype_works="guessing no" ;;
+                               # Guess no on Android.
+            android*)          gl_cv_func_wctype_works="guessing no" ;;
                                # Guess yes otherwise.
             *)                 gl_cv_func_wctype_works="guessing yes" ;;
           esac
index f3e449938b807e1ba51db415056022ee7403e0fe..69f2deb608c020796ac45b3a16548148bb7c1b63 100644 (file)
@@ -10,6 +10,7 @@ Depends-on:
 wctype-h
 iswblank        [test $HAVE_WCTYPE = 0 || test $REPLACE_WCTYPE = 1]
 iswdigit        [test $HAVE_WCTYPE = 0 || test $REPLACE_WCTYPE = 1]
+iswpunct        [test $HAVE_WCTYPE = 0 || test $REPLACE_WCTYPE = 1]
 iswxdigit       [test $HAVE_WCTYPE = 0 || test $REPLACE_WCTYPE = 1]
 # When we override wctype_t, we also need to override iswctype().
 iswctype        [test $REPLACE_WCTYPE = 1]
index a500f53fa2de0413d4ac0a50042704481d2758b9..fabd1b6a31e3178fc35280228f3f8132e066f940 100644 (file)
@@ -53,10 +53,38 @@ main (int argc, char *argv[])
 
   desc = wctype ("punct");
   ASSERT (desc != (wctype_t) 0);
+  ASSERT (iswctype (L'!', desc));
+  ASSERT (iswctype (L'"', desc));
+  ASSERT (iswctype (L'#', desc));
   ASSERT (iswctype (L'$', desc));
+  ASSERT (iswctype (L'%', desc));
+  ASSERT (iswctype (L'&', desc));
+  ASSERT (iswctype (L'\'', desc));
+  ASSERT (iswctype (L'(', desc));
+  ASSERT (iswctype (L')', desc));
+  ASSERT (iswctype (L'*', desc));
+  ASSERT (iswctype (L'+', desc));
+  ASSERT (iswctype (L',', desc));
+  ASSERT (iswctype (L'-', desc));
   ASSERT (iswctype (L'.', desc));
+  ASSERT (iswctype (L'/', desc));
+  ASSERT (iswctype (L':', desc));
+  ASSERT (iswctype (L';', desc));
   ASSERT (iswctype (L'<', desc));
+  ASSERT (iswctype (L'=', desc));
   ASSERT (iswctype (L'>', desc));
+  ASSERT (iswctype (L'?', desc));
+  ASSERT (iswctype (L'@', desc));
+  ASSERT (iswctype (L'[', desc));
+  ASSERT (iswctype (L'\\', desc));
+  ASSERT (iswctype (L']', desc));
+  ASSERT (iswctype (L'^', desc));
+  ASSERT (iswctype (L'_', desc));
+  ASSERT (iswctype (L'`', desc));
+  ASSERT (iswctype (L'{', desc));
+  ASSERT (iswctype (L'|', desc));
+  ASSERT (iswctype (L'}', desc));
+  ASSERT (iswctype (L'~', desc));
   ASSERT (! iswctype (L' ', desc));
   ASSERT (! iswctype (L'a', desc));
   ASSERT (! iswctype (L'1', desc));