]> Savannah Git Hosting - gnulib.git/commitdiff
alloca-opt: Fix conflict mingw's new <alloca.h> file.
authorBruno Haible <bruno@clisp.org>
Sun, 10 Mar 2019 19:39:34 +0000 (20:39 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 10 Mar 2019 19:53:24 +0000 (20:53 +0100)
Reported by Eli Zaretskii <eliz@gnu.org>.

* lib/alloca.in.h: On mingw systems that have <alloca.h>, include that.
* m4/alloca.m4 (gl_FUNC_ALLOCA): Set HAVE_ALLOCA_H.
* modules/alloca-opt (Makefile.am): Substitute HAVE_ALLOCA_H.

ChangeLog
lib/alloca.in.h
m4/alloca.m4
modules/alloca-opt

index fd5b5e0eaf5737cb7c13c86ad0d38ddf1c13fd88..b633380b5c7e90191d4e94ba58da60b582c8283a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-03-10  Bruno Haible  <bruno@clisp.org>
+
+       alloca-opt: Fix conflict mingw's new <alloca.h> file.
+       Reported by Eli Zaretskii <eliz@gnu.org>.
+       * lib/alloca.in.h: On mingw systems that have <alloca.h>, include that.
+       * m4/alloca.m4 (gl_FUNC_ALLOCA): Set HAVE_ALLOCA_H.
+       * modules/alloca-opt (Makefile.am): Substitute HAVE_ALLOCA_H.
+
 2019-03-10  Bruno Haible  <bruno@clisp.org>
 
        tests: Avoid havoc with "gcc -fcheck-pointer-bounds".
index 8aaf64dce3f311985fb0b145ddcc97fff8c48c3b..84d92e65d4c61866be6db79f7540dc287240b304 100644 (file)
 
 #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__) && @HAVE_ALLOCA_H@
+#   include_next <alloca.h>
+#  endif
 #  define alloca __builtin_alloca
 # elif defined _AIX
 #  define alloca __alloca
index 46d60f9c8c87ea15656d2dd149a7863922c30444..29bd289b02af1143455f6c129d79accf3c4f288a 100644 (file)
@@ -1,4 +1,4 @@
-# alloca.m4 serial 14
+# alloca.m4 serial 15
 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2019 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -37,6 +37,13 @@ AC_DEFUN([gl_FUNC_ALLOCA],
   fi
   AC_SUBST([ALLOCA_H])
   AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
+
+  if test $ac_cv_working_alloca_h = yes; then
+    HAVE_ALLOCA_H=1
+  else
+    HAVE_ALLOCA_H=0
+  fi
+  AC_SUBST([HAVE_ALLOCA_H])
 ])
 
 # Prerequisites of lib/alloca.c.
index d4468de5cf52bc0d3ecacd1ab9b490454181f8b4..53bb28dba80ba393d254d88dcb34bc2aee31db8a 100644 (file)
@@ -21,7 +21,7 @@ if GL_GENERATE_ALLOCA_H
 alloca.h: alloca.in.h $(top_builddir)/config.status
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/alloca.in.h; \
+         sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \
        } > $@-t && \
        mv -f $@-t $@
 else