diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2003-06-15 11:01:52 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2003-06-15 11:01:52 +0000 |
commit | 79806b4cdce0d63988737fec89cf7c083fb036c5 (patch) | |
tree | 0f9873860d2ca4f753ac7b3426a2279c58d29f87 /include | |
parent | 070d61acdc67533c6c7bbf43db9b6e85bc857a54 (diff) | |
download | src-79806b4cdce0d63988737fec89cf7c083fb036c5.tar.gz src-79806b4cdce0d63988737fec89cf7c083fb036c5.zip |
Use __builtin_alloca() on compilers that have it. Keep the prototype for
the benefit of lint and non-{GNU,Intel} compilers.
Notes
Notes:
svn path=/head/; revision=116397
Diffstat (limited to 'include')
-rw-r--r-- | include/stdlib.h | 18 |
1 files changed, 17 insertions, 1 deletions
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); |