Building GNU m4 on mingw, I get this error:

  CC       eval.o
In file included from ../lib/error.h:28,
                 from ../../src/m4.h:46,
                 from ../../src/eval.c:27:
../../src/eval.c:50:5: error: expected identifier before numeric constant
   50 |     NO_ERROR,
      |     ^~~~~~~~

The cause is that mingw has an <error.h> that is unrelated to glibc's <error.h>
and contains many macro definitions that are redundant with <winerorr.h>.
https://raw.githubusercontent.com/mingw-w64/mingw-w64/master/mingw-w64-headers/include/error.h

This patch fixes the compilation error.


2024-05-11  Bruno Haible  <br...@clisp.org>

        error-h: Avoid namespace pollution on mingw.
        * lib/error.in.h: Don't include mingw's <error.h>.

diff --git a/lib/error.in.h b/lib/error.in.h
index 51f8cafd10..1ba066a863 100644
--- a/lib/error.in.h
+++ b/lib/error.in.h
@@ -23,7 +23,7 @@
    or error_at_line(...) invocations.  */
 
 /* The include_next requires a split double-inclusion guard.  */
-#if @HAVE_ERROR_H@
+#if @HAVE_ERROR_H@ && !defined __MINGW32__
 # @INCLUDE_NEXT@ @NEXT_ERROR_H@
 #endif
 




Reply via email to