summaryrefslogtreecommitdiff
path: root/py/persistentcode.c
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2021-01-16 20:48:19 +0000
committerDamien George <damien@micropython.org>2021-01-30 15:13:24 +1100
commitcb30928ac8da931f905d1c14468498d21108933a (patch)
tree336741629540e297f51e132380dde126702b504d /py/persistentcode.c
parentcb8e2f02ab34b49e5bd42012f3bc9adf61607b25 (diff)
py/persistentcode: Introduce MICROPY_PERSISTENT_CODE_SAVE_FILE option.
This should be enabled when the mp_raw_code_save_file function is needed. It is enabled for mpy-cross, and a check for defined(__APPLE__) is added to cover Mac M1 systems.
Diffstat (limited to 'py/persistentcode.c')
-rw-r--r--py/persistentcode.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/py/persistentcode.c b/py/persistentcode.c
index da3234a5f..084632a60 100644
--- a/py/persistentcode.c
+++ b/py/persistentcode.c
@@ -825,10 +825,7 @@ void mp_raw_code_save(mp_raw_code_t *rc, mp_print_t *print) {
save_raw_code(print, rc, &qw);
}
-// here we define mp_raw_code_save_file depending on the port
-// TODO abstract this away properly
-
-#if defined(__i386__) || defined(__x86_64__) || defined(_WIN32) || defined(__unix__)
+#if MICROPY_PERSISTENT_CODE_SAVE_FILE
#include <unistd.h>
#include <sys/stat.h>
@@ -853,8 +850,6 @@ void mp_raw_code_save_file(mp_raw_code_t *rc, const char *filename) {
MP_THREAD_GIL_ENTER();
}
-#else
-#error mp_raw_code_save_file not implemented for this platform
-#endif
+#endif // MICROPY_PERSISTENT_CODE_SAVE_FILE
#endif // MICROPY_PERSISTENT_CODE_SAVE