iswctype: Fix errors in C++ mode on mingw.
authorBruno Haible <bruno@clisp.org>
Sun, 24 Nov 2019 19:10:56 +0000 (20:10 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 24 Nov 2019 19:10:56 +0000 (20:10 +0100)
* lib/wctype.in.h (rpl_iswctype): Override if GNULIB_OVERRIDES_WINT_T
is 1.
* lib/iswctype.c (iswctype): Add another implementation, for the
GNULIB_defined_wint_t case.
* modules/iswctype (configure.ac): Compile iswctype.c also if
GNULIB_OVERRIDES_WINT_T is 1.

ChangeLog
lib/iswctype.c
lib/wctype.in.h
modules/iswctype

index 6be838ba162c318af43c2e9e4fe6383bdfa54d7e..356edcbb83e6850b21e4262bd74fa63dc116fa1d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-11-24  Bruno Haible  <bruno@clisp.org>
+
+       iswctype: Fix errors in C++ mode on mingw.
+       * lib/wctype.in.h (rpl_iswctype): Override if GNULIB_OVERRIDES_WINT_T
+       is 1.
+       * lib/iswctype.c (iswctype): Add another implementation, for the
+       GNULIB_defined_wint_t case.
+       * modules/iswctype (configure.ac): Compile iswctype.c also if
+       GNULIB_OVERRIDES_WINT_T is 1.
+
 2019-11-24  Bruno Haible  <bruno@clisp.org>
 
        windows-timedmutex: Fix errors in C++ mode on mingw.
index 39d4316349bb34e09c0c546249e2eab562a00358..75b69f01bb3917227deec3ea6a42029506623cbc 100644 (file)
 /* Specification.  */
 #include <wctype.h>
 
-#include "iswctype-impl.h"
+#if GNULIB_defined_wint_t
+
+int
+iswctype (wint_t wc, wctype_t desc)
+# undef iswctype
+{
+  return ((wchar_t) wc == wc ? iswctype ((wchar_t) wc, desc) : 0);
+}
+
+#else
+
+# include "iswctype-impl.h"
+
+#endif
index 4e57961a36b9d335ba514a09e15586bc7248670a..b3edb0d9840077a44d26065ff940aade57224372 100644 (file)
@@ -589,10 +589,19 @@ _GL_WARN_ON_USE (wctype, "wctype is unportable - "
    The argument WC must be either a wchar_t value or WEOF.
    The argument DESC must have been returned by the wctype() function.  */
 #if @GNULIB_ISWCTYPE@
-# if !@HAVE_WCTYPE_T@
+# if @GNULIB_OVERRIDES_WINT_T@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef iswctype
+#   define iswctype rpl_iswctype
+#  endif
+_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc));
+_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
+# else
+#  if !@HAVE_WCTYPE_T@
 _GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
+# endif
 _GL_CXXALIASWARN (iswctype);
 #elif defined GNULIB_POSIXCHECK
 # undef iswctype
index 2f6c8a0b288e901418e2520e08d643e20cf59ba5..9fce6842980512951692c1541578a66545373a09 100644 (file)
@@ -17,7 +17,7 @@ wctype-h
 
 configure.ac:
 gl_FUNC_ISWCTYPE
-if test $HAVE_WCTYPE_T = 0; then
+if test $HAVE_WCTYPE_T = 0 || test $GNULIB_OVERRIDES_WINT_T = 1; then
   AC_LIBOBJ([iswctype])
 fi
 gl_WCTYPE_MODULE_INDICATOR([iswctype])