unix/main: Only accept full emit cmd-line options if native enabled.

This commit is contained in:
Damien George 2019-08-23 11:08:20 +10:00
parent 5789558d60
commit 15b36aa0af

View File

@ -313,7 +313,11 @@ STATIC int usage(char **argv) {
int impl_opts_cnt = 0;
printf(
" compile-only -- parse and compile only\n"
#if MICROPY_EMIT_NATIVE
" emit={bytecode,native,viper} -- set the default code emitter\n"
#else
" emit=bytecode -- set the default code emitter\n"
#endif
);
impl_opts_cnt++;
#if MICROPY_ENABLE_GC
@ -343,10 +347,12 @@ STATIC void pre_process_options(int argc, char **argv) {
compile_only = true;
} else if (strcmp(argv[a + 1], "emit=bytecode") == 0) {
emit_opt = MP_EMIT_OPT_BYTECODE;
#if MICROPY_EMIT_NATIVE
} else if (strcmp(argv[a + 1], "emit=native") == 0) {
emit_opt = MP_EMIT_OPT_NATIVE_PYTHON;
} else if (strcmp(argv[a + 1], "emit=viper") == 0) {
emit_opt = MP_EMIT_OPT_VIPER;
#endif
#if MICROPY_ENABLE_GC
} else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) {
char *end;