From: Bruno Haible Date: Sun, 10 Mar 2019 19:39:34 +0000 (+0100) Subject: alloca-opt: Fix conflict mingw's new file. X-Git-Tag: v1.0~5034 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=69c4509f33c6a6ac159f3429d4150bf119ac4d76;p=gnulib.git alloca-opt: Fix conflict mingw's new file. Reported by Eli Zaretskii . * lib/alloca.in.h: On mingw systems that have , include that. * m4/alloca.m4 (gl_FUNC_ALLOCA): Set HAVE_ALLOCA_H. * modules/alloca-opt (Makefile.am): Substitute HAVE_ALLOCA_H. --- diff --git a/ChangeLog b/ChangeLog index fd5b5e0eaf..b633380b5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-03-10 Bruno Haible + + alloca-opt: Fix conflict mingw's new file. + Reported by Eli Zaretskii . + * lib/alloca.in.h: On mingw systems that have , 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 tests: Avoid havoc with "gcc -fcheck-pointer-bounds". diff --git a/lib/alloca.in.h b/lib/alloca.in.h index 8aaf64dce3..84d92e65d4 100644 --- a/lib/alloca.in.h +++ b/lib/alloca.in.h @@ -36,6 +36,12 @@ #ifndef alloca # ifdef __GNUC__ + /* Some version of mingw have an that causes trouble when + included after 'alloca' gets defined as a macro. As a workaround, include + this first and define 'alloca' as a macro afterwards. */ +# if (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@ +# include_next +# endif # define alloca __builtin_alloca # elif defined _AIX # define alloca __alloca diff --git a/m4/alloca.m4 b/m4/alloca.m4 index 46d60f9c8c..29bd289b02 100644 --- a/m4/alloca.m4 +++ b/m4/alloca.m4 @@ -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. diff --git a/modules/alloca-opt b/modules/alloca-opt index d4468de5cf..53bb28dba8 100644 --- a/modules/alloca-opt +++ b/modules/alloca-opt @@ -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