summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-12-18 12:35:44 +0000
committerDamien George <damien.p.george@gmail.com>2015-12-18 12:35:44 +0000
commitdd5353a4054024a411aa343a22ffcd16195a16ad (patch)
treefaa3f91ab3a37f1b2f3469e01a9228e83853dc7b /py/mpconfig.h
parentab8012bd8098e155e38ef6dead62bca8a200e613 (diff)
py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts.
MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler, which is useful when only loading of pre-compiled bytecode is supported. It is enabled by default. MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin functions. By default they are only included if MICROPY_ENABLE_COMPILER is enabled. Disabling both options saves about 40k of code size on 32-bit x86.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index c05f33c45..58aa2ce0c 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -278,6 +278,11 @@
/*****************************************************************************/
/* Compiler configuration */
+// Whether to include the compiler
+#ifndef MICROPY_ENABLE_COMPILER
+#define MICROPY_ENABLE_COMPILER (1)
+#endif
+
// Whether to enable constant folding; eg 1+2 rewritten as 3
#ifndef MICROPY_COMP_CONST_FOLDING
#define MICROPY_COMP_CONST_FOLDING (1)
@@ -590,6 +595,12 @@ typedef double mp_float_t;
#define MICROPY_PY_BUILTINS_ENUMERATE (1)
#endif
+// Whether to support eval and exec functions
+// By default they are supported if the compiler is enabled
+#ifndef MICROPY_PY_BUILTINS_EVAL_EXEC
+#define MICROPY_PY_BUILTINS_EVAL_EXEC (MICROPY_ENABLE_COMPILER)
+#endif
+
// Whether to support the Python 2 execfile function
#ifndef MICROPY_PY_BUILTINS_EXECFILE
#define MICROPY_PY_BUILTINS_EXECFILE (0)