>From 48c29e1b8c556c8546ec5756563d9f90aafa93ce Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 24 Nov 2019 20:10:56 +0100 Subject: [PATCH 3/5] 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. --- ChangeLog | 10 ++++++++++ lib/iswctype.c | 15 ++++++++++++++- lib/wctype.in.h | 13 +++++++++++-- modules/iswctype | 2 +- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6be838b..356edcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2019-11-24 Bruno Haible + 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 + windows-timedmutex: Fix errors in C++ mode on mingw. * lib/windows-timedmutex.h: Add closing brace. diff --git a/lib/iswctype.c b/lib/iswctype.c index 39d4316..75b69f0 100644 --- a/lib/iswctype.c +++ b/lib/iswctype.c @@ -20,4 +20,17 @@ /* Specification. */ #include -#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 diff --git a/lib/wctype.in.h b/lib/wctype.in.h index 4e57961..b3edb0d 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -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 diff --git a/modules/iswctype b/modules/iswctype index 2f6c8a0..9fce684 100644 --- a/modules/iswctype +++ b/modules/iswctype @@ -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]) -- 2.7.4