bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gnulib's alloca.h and MinGW


From: Eli Zaretskii
Subject: Gnulib's alloca.h and MinGW
Date: Mon, 29 Jun 2020 20:27:18 +0300

A recent MinGW runtime changed its definition of alloca from  an
inline function to a macro.  As result, there's a warning when
compiling Gnulib's malloca.c:

       CC       malloca.o
     In file included from malloca.h:21,
                      from malloca.c:22:
     ./alloca.h:46: warning: "alloca" redefined
        46 | #  define alloca __builtin_alloca
           |
     In file included from ./alloca.h:44,
                      from malloca.h:21,
                      from malloca.c:22:
     d:\usr\include\alloca.h:81: note: this is the location of the previous 
definition
        81 | #define alloca( __request )  __builtin_alloca( __request )
           |

Proposed patch is below.  Thanks.


--- alloca.h~0  2020-06-29 18:22:39.421875000 +0300
+++ alloca.h    2020-06-29 19:21:42.468750000 +0300
@@ -36,10 +36,16 @@
  */
 
 #ifndef alloca
+/* Some version of mingw have an <alloca.h> that causes trouble when
+   included after 'alloca' gets defined as a macro.  As a workaround,
+   include this <alloca.h> first and define 'alloca' as a macro
+   afterwards if needed.  */
+# if (defined __GNUC__ && defined _WIN32 && ! defined __CYGWIN__) && 1
+#  include_next <alloca.h>
+# endif
+#endif
+#ifndef alloca
 # ifdef __GNUC__
-   /* Some version of mingw have an <alloca.h> that causes trouble when
-      included after 'alloca' gets defined as a macro.  As a workaround, 
include
-      this <alloca.h> first and define 'alloca' as a macro afterwards.  */
 #  if (defined _WIN32 && ! defined __CYGWIN__) && 1
 #   include_next <alloca.h>
 #  endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]