mpy-cross/main: Only accept full emit cmdline options if native enabled.

pull/5041/head
Damien George 2019-08-23 11:09:34 +10:00
rodzic 15b36aa0af
commit 8e3e05761e
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -115,7 +115,11 @@ STATIC int usage(char **argv) {
); );
int impl_opts_cnt = 0; int impl_opts_cnt = 0;
printf( printf(
#if MICROPY_EMIT_NATIVE
" emit={bytecode,native,viper} -- set the default code emitter\n" " emit={bytecode,native,viper} -- set the default code emitter\n"
#else
" emit=bytecode -- set the default code emitter\n"
#endif
); );
impl_opts_cnt++; impl_opts_cnt++;
printf( printf(
@ -140,10 +144,12 @@ STATIC void pre_process_options(int argc, char **argv) {
} }
if (strcmp(argv[a + 1], "emit=bytecode") == 0) { if (strcmp(argv[a + 1], "emit=bytecode") == 0) {
emit_opt = MP_EMIT_OPT_BYTECODE; emit_opt = MP_EMIT_OPT_BYTECODE;
#if MICROPY_EMIT_NATIVE
} else if (strcmp(argv[a + 1], "emit=native") == 0) { } else if (strcmp(argv[a + 1], "emit=native") == 0) {
emit_opt = MP_EMIT_OPT_NATIVE_PYTHON; emit_opt = MP_EMIT_OPT_NATIVE_PYTHON;
} else if (strcmp(argv[a + 1], "emit=viper") == 0) { } else if (strcmp(argv[a + 1], "emit=viper") == 0) {
emit_opt = MP_EMIT_OPT_VIPER; emit_opt = MP_EMIT_OPT_VIPER;
#endif
} else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) { } else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) {
char *end; char *end;
heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, &end, 0); heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, &end, 0);