tech-userlevel archive

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

Re: alloca() declaration

In article <>,
Anders Magnusson  <> wrote:
>I noticed that there is a difference between whether alloca() is in libc 
>or not for our ports.
>arm, i386, m68k, vax, amd64 has the functions, others not.
>Also, the stuff in is not correct either:
>#if defined(alloca) && (alloca == __builtin_alloca) && \
>     defined(__GNUC__) && (__GNUC__ < 2)
>void    *alloca(int);     /* built-in for gcc */
>#elif defined(__PCC__) && !defined(__GNUC__)
>#define alloca(size) __builtin_alloca(size)
>void    *alloca(size_t);
>#endif /* __GNUC__ */
>besides the fact that string comparison is not possible in cpp this 
>would in fact usually just end up in declaring alloca().
>This means that alloca won't be available if using gcc -std=c99 on a 
>bunch of ports, which is not the desired behavior.
>One way to solve this would be to replace the stuff above with:
>#if defined(__GNUC__)
>#define alloca(size) __builtin_alloca(size)
>so that gcc always uses the builtin alloca.

That will break gcc-1.x, but we don't support it :-)
Please go ahead and simplify it. Don't you need a #else
void *alloca(size_t)?


Home | Main Index | Thread Index | Old Index