Re: Texinfo-7.2.91 with mingw.org's MinGW: build

Bruno Haible via Gnulib discussion list <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.tex.texinfo.bugs
Organization GNU
Message-ID <11291950.80ggfzRhTf@nimes>
Eli Zaretskii wrote on 2026-02-08:
> > https://alpha.gnu.org/gnu/texinfo/texinfo-7.2.91.tar.xz
> 
> Thanks, this builds cleanly with mingw.org's MinGW, with a single
> problem in Gnulib's wctype.h.  It is the same problem as in the
> previous pretest, since this Gnulib header was not changed.  For the
> record, I fixed it locally like this:
> 
> --- ./gnulib/lib/wctype.in.h~0	2026-01-17 20:58:09.000000000 +0200
> +++ ./gnulib/lib/wctype.in.h	2026-02-08 11:45:40.995181800 +0200
> @@ -50,7 +50,7 @@
>   #error "Please include config.h first."
>  #endif
>  
> -#if @HAVE_WINT_T@
> +#if @HAVE_WINT_T@ && !defined _WCHAR_H
>  /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
>  # include <wchar.h>
>  #endif
> @@ -59,7 +59,7 @@
>     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__
> +#if defined _WIN32 && ! defined __CYGWIN__ && !defined _WCHAR_H
>  # include <ctype.h>
>  # include <wchar.h>
>  #endif

Good to know that this works. Since this is very fragile stuff, I prefer
adding an 'defined __MINGW32__' guard, so as to not affect other platforms.


2026-02-27  Bruno Haible  <[email protected]>

	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.

diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index 15f310ce91..6a3648dcd0 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -50,16 +50,19 @@
  #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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.