diff options
author | Sean Burton <Sean.Burton@thalesesecurity.com> | 2018-12-13 12:10:35 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-01-27 11:08:25 +1100 |
commit | e33bc59712aa484107dc1cd4009dd8ab2da6dcb2 (patch) | |
tree | 5f15864a4926e76e8a4882f14d18b4835052d4bf /py/mpconfig.h | |
parent | 35687a87ec3fc28654933d7d37bfb82cb04f5227 (diff) |
py: Remove calls to file reader functions when these are disabled.
If MICROPY_PERSISTENT_CODE_LOAD or MICROPY_ENABLE_COMPILER are enabled then
code gets enabled that calls file reading functions which may be disabled
if no readers have been implemented.
To fix this, introduce a MICROPY_HAS_FILE_READER variable, which is
automatically set if MICROPY_READER_POSIX or MICROPY_READER_VFS is set but
can also be manually set if a custom reader is being implemented. Then
disable the file reading calls if this is not set.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r-- | py/mpconfig.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index ce1a8cbfc..68a855f19 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -464,6 +464,11 @@ #define MICROPY_READER_VFS (0) #endif +// Whether any readers have been defined +#ifndef MICROPY_HAS_FILE_READER +#define MICROPY_HAS_FILE_READER (MICROPY_READER_POSIX || MICROPY_READER_VFS) +#endif + // Hook for the VM at the start of the opcode loop (can contain variable // definitions usable by the other hook functions) #ifndef MICROPY_VM_HOOK_INIT |