[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Gnulib's alloca.h used even when there is a system header
From: |
Eli Zaretskii |
Subject: |
Re: Gnulib's alloca.h used even when there is a system header |
Date: |
Mon, 18 Feb 2019 18:59:27 +0200 |
> Cc: address@hidden
> From: Paul Eggert <address@hidden>
> Date: Sun, 17 Feb 2019 13:09:06 -0800
>
> Eli Zaretskii wrote:
> > #ifndef alloca
> > # ifdef __GNUC__
> > -# define alloca __builtin_alloca
> > +# if HAVE_ALLOCA_H
> > +# include_next <alloca.h>
> > +# else
> > +# define alloca __builtin_alloca
> > +# endif
> > # elif defined _AIX
>
> Why do the 'include_next' only for GCC? Why not do it for all compilers?
I didn't know other compilers supported include_next.
> Also, what platforms don't work with the current Gnulib alloca module, and
> why?
I bumped into this with mingw.org's MinGW, which introduced alloca.h
in its recent versions. (MinGW64 doesn't have this header.) This new
MinGW alloca.h does this:
__CRT_ALIAS void *alloca( size_t __n ){ return __builtin_alloca( __n ); }
which makes alloca an always-inline function by virtue of
# define __CRT_INLINE extern __inline__
# define __CRT_ALIAS __CRT_INLINE __attribute__((__always_inline__))
The other part of the puzzle is that stdlib.h does this:
# include "alloca.h"
so Gnulib's alloca.h is bypassed. Which causes this when compiling
Gnulib's vasnprintf.c:
In file included from vasnprintf.c:57:0:
d:\usr\include\alloca.h: In function 'vasnprintf':
./alloca.h:40:18: error: inlining failed in call to always_inline
'__builtin_alloca': function not considered for inlining
# define alloca __builtin_alloca
^
In file included from d:\usr\include\stdlib.h:499:0,
from vasnprintf.c:71:
d:\usr\include\alloca.h:62:48: note: called from here
__CRT_ALIAS void *alloca( size_t __n ){ return __builtin_alloca( __n ); }
^~~~~~~~~~~~~~~~~~~~~~~
Makefile:945: recipe for target `vasnprintf.lo' failed
- Gnulib's alloca.h used even when there is a system header, Eli Zaretskii, 2019/02/17
- Re: Gnulib's alloca.h used even when there is a system header, Paul Eggert, 2019/02/17
- Re: Gnulib's alloca.h used even when there is a system header, Eli Zaretskii, 2019/02/17
- Re: Gnulib's alloca.h used even when there is a system header, Paul Eggert, 2019/02/17
- Re: Gnulib's alloca.h used even when there is a system header, Bruno Haible, 2019/02/17
- Re: Gnulib's alloca.h used even when there is a system header,
Eli Zaretskii <=
- Re: Gnulib's alloca.h used even when there is a system header, Bruno Haible, 2019/02/18
- Re: Gnulib's alloca.h used even when there is a system header, Eli Zaretskii, 2019/02/19
- Re: Gnulib's alloca.h used even when there is a system header, Eli Zaretskii, 2019/02/28
Re: Gnulib's alloca.h used even when there is a system header, Bruno Haible, 2019/02/17