From 79806b4cdce0d63988737fec89cf7c083fb036c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 15 Jun 2003 11:01:52 +0000 Subject: [PATCH] Use __builtin_alloca() on compilers that have it. Keep the prototype for the benefit of lint and non-{GNU,Intel} compilers. --- include/stdlib.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/include/stdlib.h b/include/stdlib.h index b5537442d26d..4bbd43860125 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -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);