Use __builtin_alloca() on compilers that have it. Keep the prototype for

the benefit of lint and non-{GNU,Intel} compilers.
This commit is contained in:
Dag-Erling Smørgrav 2003-06-15 11:01:52 +00:00
parent 070d61acdc
commit 79806b4cdc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=116397

View File

@ -222,7 +222,23 @@ extern const char *_malloc_options;
extern void (*_malloc_message)(const char *, const char *, const char *,
const char *);
void *alloca(size_t); /* built-in for gcc */
#ifndef alloca
/*
* The alloca() function can't be implemented in C, and on some
* platforms it can't be implemented at all as a callable function.
* The GNU C compiler provides a built-in alloca() which we can use;
* in all other cases, provide a prototype, mainly to pacify various
* incarnations of lint. On platforms where alloca() is not in libc,
* programs which use it will fail to link when compiled with non-GNU
* compilers.
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#define alloca(sz) __builtin_alloca(sz)
#else
void *alloca(size_t);
#endif
#endif
__uint32_t
arc4random(void);
void arc4random_addrandom(unsigned char *dat, int datlen);