about summary refs log tree commit diff
path: root/include/alloca.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-09 15:06:58 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-09 15:06:58 -0400
commitd71d0805f9ad4010529bb94092a2e378b4edac9a (patch)
tree593db067508acc9ee26e75ae5a62e5e1f52107b0 /include/alloca.h
parent5bd0ab8af66829af74ed80cac767ce1c041fd767 (diff)
downloadmusl-d71d0805f9ad4010529bb94092a2e378b4edac9a.tar.gz
musl-d71d0805f9ad4010529bb94092a2e378b4edac9a.tar.xz
musl-d71d0805f9ad4010529bb94092a2e378b4edac9a.zip
alloca cannot be a function. #define it to the gcc builtin if possible
gcc makes this mapping by default anyway, but it will be disabled by
-fno-builtin (and presumably by -std=c99 or similar). for the main
program the error will be reported by the linker, and the issue can
easily be fixed, but for dynamic-loaded so files, the error cannot be
detected until dlopen time, at which point it has become very obscure.
Diffstat (limited to 'include/alloca.h')
-rw-r--r--include/alloca.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/alloca.h b/include/alloca.h
index f61b817a..d2e6f1c6 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -10,6 +10,10 @@ extern "C" {
 
 void *alloca(size_t);
 
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#endif
+
 #ifdef __cplusplus
 }
 #endif