]> Savannah Git Hosting - gnulib.git/commitdiff
wctype: Work around wctype+iswctype bug on MSVC.
authorBruno Haible <bruno@clisp.org>
Wed, 26 Jul 2023 13:12:47 +0000 (15:12 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 26 Jul 2023 13:19:45 +0000 (15:19 +0200)
* m4/wctype.m4 (gl_FUNC_WCTYPE): In the test program, test also for the
MSVC bug. Update cross-compilation guess.
* doc/posix-functions/wctype.texi: Mention the MSVC bug.

ChangeLog
doc/posix-functions/wctype.texi
m4/wctype.m4

index f1e00c8b702952c3a7f47549aade0774f7c88648..180d60cbb5275d4bdc4fdd170ab03f021a5e579b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-07-26  Bruno Haible  <bruno@clisp.org>
+
+       wctype: Work around wctype+iswctype bug on MSVC.
+       * m4/wctype.m4 (gl_FUNC_WCTYPE): In the test program, test also for the
+       MSVC bug. Update cross-compilation guess.
+       * doc/posix-functions/wctype.texi: Mention the MSVC bug.
+
 2023-07-26  Bruno Haible  <bruno@clisp.org>
 
        wctype: Work around wctype bug on mingw.
index e4a2b58056c4d72358ad9908acbc2e152aa9c949..af35ed1f352c5cc59888c8d94864d6ff5a484fc4 100644 (file)
@@ -19,6 +19,11 @@ HP-UX 11.00.
 This function does not support the @code{"blank"} character class
 on some platforms:
 mingw.
+@item
+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.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index c006873d1b30b371865566331735ebb347b0eb50..321bd696fbaac5fe7f7a5ecbbb67d4e5053b53b6 100644 (file)
@@ -1,4 +1,4 @@
-# wctype.m4 serial 3
+# wctype.m4 serial 4
 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,
@@ -17,19 +17,21 @@ AC_DEFUN_ONCE([gl_FUNC_WCTYPE],
          [AC_LANG_SOURCE([[
             #include <wchar.h>
             #include <wctype.h>
-            int main () { return wctype ("blank") == (wctype_t)0; }
+            int main ()
+            {
+              /* This test fails on mingw.  */
+              if (wctype ("blank") == (wctype_t)0)
+                return 1;
+              /* This test fails on MSVC 14.  */
+              if ((! iswctype ('\t', wctype ("blank"))) != (! iswblank ('\t')))
+                return 2;
+              return 0;
+            }
          ]])],
          [gl_cv_func_wctype_works=yes], [gl_cv_func_wctype_works=no],
          [case "$host_os" in
-                    # Guess no on mingw.
-            mingw*) AC_EGREP_CPP([Problem], [
-#ifdef __MINGW32__
- Problem
-#endif
-                      ],
-                      [gl_cv_func_wctype_works="guessing no"],
-                      [gl_cv_func_wctype_works="guessing yes"])
-                    ;;
+                    # Guess no on native Windows.
+            mingw*) gl_cv_func_wctype_works="guessing no" ;;
                     # Guess yes otherwise.
             *)      gl_cv_func_wctype_works="guessing yes" ;;
           esac