Add tests for errno after sin/cos calls with ±Inf.
[glibc/history.git] / include / alloca.h
blob9a4b5c7da0377c8e40c9d43791579f7bcacaa88e
1 #ifndef _ALLOCA_H
3 #include <stdlib/alloca.h>
4 #include <stackinfo.h>
6 #undef __alloca
8 /* Now define the internal interfaces. */
9 extern void *__alloca (size_t __size);
11 #ifdef __GNUC__
12 # define __alloca(size) __builtin_alloca (size)
13 #endif /* GCC. */
15 extern int __libc_use_alloca (size_t size) __attribute__ ((const));
16 extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
18 #define __MAX_ALLOCA_CUTOFF 65536
20 #include <allocalim.h>
22 #if _STACK_GROWS_DOWN
23 # define extend_alloca(buf, len, newlen) \
24 (__typeof (buf)) ({ size_t __newlen = (newlen); \
25 char *__newbuf = __alloca (__newlen); \
26 if (__newbuf + __newlen == (char *) buf) \
27 len += __newlen; \
28 else \
29 len = __newlen; \
30 __newbuf; })
31 #elif _STACK_GROWS_UP
32 # define extend_alloca(buf, len, newlen) \
33 (__typeof (buf)) ({ size_t __newlen = (newlen); \
34 char *__newbuf = __alloca (__newlen); \
35 char *__buf = (buf); \
36 if (__buf + __newlen == __newbuf) \
37 { \
38 len += __newlen; \
39 __newbuf = __buf; \
40 } \
41 else \
42 len = __newlen; \
43 __newbuf; })
44 #else
45 # define extend_alloca(buf, len, newlen) \
46 __alloca (((len) = (newlen)))
47 #endif
49 #if defined stackinfo_get_sp && defined stackinfo_sub_sp
50 # define alloca_account(size, avar) \
51 ({ void *old__ = stackinfo_get_sp (); \
52 void *m__ = __alloca (size); \
53 avar += stackinfo_sub_sp (old__); \
54 m__; })
55 #else
56 # define alloca_account(size, avar) \
57 ({ size_t s__ = (size); \
58 avar += s__; \
59 __alloca (s__); })
60 #endif
62 #endif