]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
wctype-h: Try to fix error regarding mbstate_t on very old mingw.
authorBruno Haible <bruno@clisp.org>
Fri, 27 Feb 2026 10:47:19 +0000 (11:47 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 27 Feb 2026 10:47:19 +0000 (11:47 +0100)
Reported by Eli Zaretskii, see
<https://lists.gnu.org/archive/html/bug-gnulib/2026-01/msg00206.html>.
Based on proposed patch at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00043.html>.

* lib/wctype.in.h: Don't include <wchar.h> on mingw when it has already
been at least partially processed.

ChangeLog
lib/wctype.in.h

index f31e19cb4b1d6df7303a5cf0de446a5f67583a03..09d45eb6aea75564ea7464995acf53c7be80c391 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-02-27  Bruno Haible  <bruno@clisp.org>
+
+       wctype-h: Try to fix error regarding mbstate_t on very old mingw.
+       Reported by Eli Zaretskii, see
+       <https://lists.gnu.org/archive/html/bug-gnulib/2026-01/msg00206.html>.
+       Based on proposed patch at
+       <https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00043.html>.
+       * lib/wctype.in.h: Don't include <wchar.h> on mingw when it has already
+       been at least partially processed.
+
 2026-02-27  Bruno Haible  <bruno@clisp.org>
 
        mbs_startswith: Add tests.
index 15f310ce91c396653171d3e34f0a850838cf092e..6a3648dcd0c786492e0ae0d6ec20e4e7d6de41e8 100644 (file)
  #error "Please include config.h first."
 #endif
 
-#if @HAVE_WINT_T@
-/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
+   But don't do it in very old mingw, when <wchar.h> is already partially
+   processed.  */
+#if @HAVE_WINT_T@ && !(defined __MINGW32__ && defined _WCHAR_H)
 # include <wchar.h>
 #endif
 
 /* Native Windows (mingw, MSVC) have declarations of towupper, towlower, and
    isw* functions in <ctype.h>, <wchar.h> as well as in <wctype.h>.  Include
    <ctype.h>, <wchar.h> in advance to avoid rpl_ prefix being added to the
-   declarations.  */
-#if defined _WIN32 && ! defined __CYGWIN__
+   declarations.  But don't do it in very old mingw, when <wchar.h> is already
+   partially processed.  */
+#if defined _WIN32 && !defined __CYGWIN__ && !(defined __MINGW32__ && defined _WCHAR_H)
 # include <ctype.h>
 # include <wchar.h>
 #endif