From c3c36de581411a1bd06a8dc4aabb78198994d563 Mon Sep 17 00:00:00 2001 From: Bruno Haible <bruno@clisp.org> Date: Thu, 2 Jan 2020 20:20:05 +0100 Subject: [PATCH] mbrtowc: Don't replace mbstate_t on MSVC. * lib/wchar.in.h (GNULIB_defined_mbstate_t): Ignore a missing mbsinit function on native Windows. --- ChangeLog | 1 + lib/wchar.in.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 143b5eb65e..a1866e0b38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ mbrtowc: Don't replace mbstate_t on MSVC. * m4/mbrtowc.m4 (gl_MBSTATE_T_BROKEN): Require AC_CANONICAL_HOST. Ignore a missing mbsinit function on native Windows. + * lib/wchar.in.h (GNULIB_defined_mbstate_t): Likewise. * m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Strengthen the test, to detect an MSVC bug. * doc/posix-functions/wcrtomb.texi: Mention the MSVC bug. diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 834b3e81f7..74cd67017f 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -141,7 +141,7 @@ typedef unsigned int rpl_wint_t; implementing mbrtowc for encodings like UTF-8. On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is large enough and overriding it would cause problems in C++ mode. */ -#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ +#if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ # if !GNULIB_defined_mbstate_t # if !(defined _AIX || defined _MSC_VER) typedef int rpl_mbstate_t; -- 2.39.5