diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-11-25 23:22:31 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-11-25 23:24:51 +0200 |
commit | f32020ef3df62ff4716b070a8bb2abbbe9678012 (patch) | |
tree | 8645cc3c782f5b69930f01913a4fe622c6944077 /py | |
parent | f0fbab7ca790f4f316bc2a9a44dc3a83f442664d (diff) |
py/mpconfig.h: Allow to build without alloca() for ANSI C compliance.
Define MICROPY_NO_ALLOCA=1 and memory will be allocated from heap instead
and freed by garbage collection.
Diffstat (limited to 'py')
-rw-r--r-- | py/mpconfig.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 686f90c25..01956f63f 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -189,6 +189,16 @@ #define MICROPY_STACKLESS_STRICT (0) #endif +// Don't use alloca calls. As alloca() is not part of ANSI C, this +// workaround option is provided for compilers lacking this de-facto +// standard function. The way it works is allocating from heap, and +// relying on garbage collection to free it eventually. This is of +// course much less optimal than real alloca(). +#if defined(MICROPY_NO_ALLOCA) && MICROPY_NO_ALLOCA +#undef alloca +#define alloca(x) m_malloc(x) +#endif + /*****************************************************************************/ /* Micro Python emitters */ |