diff options
Diffstat (limited to 'py')
-rw-r--r-- | py/mpconfig.h | 5 | ||||
-rw-r--r-- | py/persistentcode.c | 9 |
2 files changed, 7 insertions, 7 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 1df2e8fe9..518bddd6c 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -283,6 +283,11 @@ #define MICROPY_PERSISTENT_CODE_SAVE (0) #endif +// Whether to support saving persistent code to a file via mp_raw_code_save_file +#ifndef MICROPY_PERSISTENT_CODE_SAVE_FILE +#define MICROPY_PERSISTENT_CODE_SAVE_FILE (0) +#endif + // Whether generated code can persist independently of the VM/runtime instance // This is enabled automatically when needed by other features #ifndef MICROPY_PERSISTENT_CODE 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 |