zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

alloca.h (947B) - Raw


      1 #ifndef _ALLOCA_H
      2 
      3 #include <stdlib/alloca.h>
      4 
      5 # ifndef _ISOMAC
      6 
      7 #include <stackinfo.h>
      8 
      9 #undef	__alloca
     10 
     11 /* Now define the internal interfaces.  */
     12 extern void *__alloca (size_t __size);
     13 
     14 #ifdef	__GNUC__
     15 # define __alloca(size)	__builtin_alloca (size)
     16 #endif /* GCC.  */
     17 
     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)
     21 
     22 #define __MAX_ALLOCA_CUTOFF	65536
     23 
     24 #include <allocalim.h>
     25 
     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
     38 
     39 # endif /* !_ISOMAC */
     40 #endif