Open master branch for glibc 2.38 development
[glibc.git] / include / alloca.h
blobc0b83954436ed4c1e7c3246e914bc36ac1606dd9
1 #ifndef _ALLOCA_H
3 #include <stdlib/alloca.h>
5 # ifndef _ISOMAC
7 #include <stackinfo.h>
9 #undef __alloca
11 /* Now define the internal interfaces. */
12 extern void *__alloca (size_t __size);
14 #ifdef __GNUC__
15 # define __alloca(size) __builtin_alloca (size)
16 #endif /* GCC. */
18 extern int __libc_use_alloca (size_t size) __attribute__ ((const));
19 extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
20 libc_hidden_proto (__libc_alloca_cutoff)
22 #define __MAX_ALLOCA_CUTOFF 65536
24 #include <allocalim.h>
26 #if defined stackinfo_get_sp && defined stackinfo_sub_sp
27 # define alloca_account(size, avar) \
28 ({ void *old__ = stackinfo_get_sp (); \
29 void *m__ = __alloca (size); \
30 avar += stackinfo_sub_sp (old__); \
31 m__; })
32 #else
33 # define alloca_account(size, avar) \
34 ({ size_t s__ = (size); \
35 avar += s__; \
36 __alloca (s__); })
37 #endif
39 # endif /* !_ISOMAC */
40 #endif