mpy-cross/main: Exit with error if arch not specified with emit=native.
Currently, mpy-cross will crash if called as:
mpy-cross -X emit=native foo.py
because it tries to use the native emitter with no target architecture set.
Fix that by checking that an architecture is set when `-X emit=native` or
`-X emit=viper` is used.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -350,6 +350,15 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
#if MICROPY_EMIT_NATIVE
|
||||
if ((MP_STATE_VM(default_emit_opt) == MP_EMIT_OPT_NATIVE_PYTHON
|
||||
|| MP_STATE_VM(default_emit_opt) == MP_EMIT_OPT_VIPER)
|
||||
&& mp_dynamic_compiler.native_arch == MP_NATIVE_ARCH_NONE) {
|
||||
mp_printf(&mp_stderr_print, "arch not specified\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (input_file == NULL) {
|
||||
mp_printf(&mp_stderr_print, "no input file\n");
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user