Skip to content

Commit

Permalink
py/compile: Check that arch is set when compiling native, viper or asm.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgeorge committed Mar 14, 2019
1 parent 55fcb83 commit 5a6026c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions py/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,18 @@ STATIC bool compile_built_in_decorator(compiler_t *comp, int name_len, mp_parse_
compile_syntax_error(comp, name_nodes[1], "invalid micropython decorator");
}

#if MICROPY_DYNAMIC_COMPILER
if (*emit_options == MP_EMIT_OPT_NATIVE_PYTHON || *emit_options == MP_EMIT_OPT_VIPER) {
if (emit_native_table[mp_dynamic_compiler.native_arch] == NULL) {
compile_syntax_error(comp, name_nodes[1], "invalid arch");
}
} else if (*emit_options == MP_EMIT_OPT_ASM) {
if (emit_asm_table[mp_dynamic_compiler.native_arch] == NULL) {
compile_syntax_error(comp, name_nodes[1], "invalid arch");
}
}
#endif

return true;
}

Expand Down

0 comments on commit 5a6026c

Please sign in to comment.