summary refs log tree commit diff
path: root/include/alloca.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/alloca.h')
-rw-r--r--include/alloca.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/alloca.h b/include/alloca.h
index 563d7868bd..7d243fd4ac 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -46,4 +46,17 @@ extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
   __alloca (((len) = (newlen)))
 #endif
 
+#if defined stackinfo_get_sp && defined stackinfo_sub_sp
+# define alloca_account(size, avar) \
+  ({ void *old__ = stackinfo_get_sp ();			\
+     void *m__ = __alloca (size);			\
+     avar += stackinfo_sub_sp (old__);			\
+     m__; })
+#else
+# define alloca_account(size, avar) \
+  ({ size_t s__ = (size);		    \
+     avar += size__;			    \
+     __alloca (size__); })
+#endif
+
 #endif