diff options
| author | dearblue <[email protected]> | 2021-12-17 23:02:04 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2021-12-17 23:02:04 +0900 |
| commit | 6b8582c95d64b75837e6778c712d705e07edad17 (patch) | |
| tree | 8db635b5dd92ebc46218ebcb383239b4f96ec838 /mrbgems/mruby-bin-mrbc | |
| parent | 9b65d0dc861f4a5d1605fa7fccb56f1758a2bd6f (diff) | |
| download | mruby-6b8582c95d64b75837e6778c712d705e07edad17.tar.gz mruby-6b8582c95d64b75837e6778c712d705e07edad17.zip | |
Add `bin/mrbc --no-ext-ops` switch
Print an error if `OP_EXT[123]` is needed when generating mruby binary.
This may be useful for mruby/c.
Inspired by #5590.
Diffstat (limited to 'mrbgems/mruby-bin-mrbc')
| -rw-r--r-- | mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c b/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c index e17f32a2e..8b0b6dc57 100644 --- a/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +++ b/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c @@ -24,6 +24,7 @@ struct mrbc_args { mrb_bool check_syntax : 1; mrb_bool verbose : 1; mrb_bool remove_lv : 1; + mrb_bool no_ext_ops : 1; uint8_t flags : 4; }; @@ -40,6 +41,7 @@ usage(const char *name) "-S dump C struct (requires -B)", "-s define <symbol> as static variable", "--remove-lv remove local variables", + "--no-ext-ops prohibit using OP_EXTs", "--verbose run at verbose mode", "--version print the version", "--copyright print the copyright", @@ -163,6 +165,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args) args->remove_lv = TRUE; break; } + else if (strcmp(argv[i] + 2, "no-ext-ops") == 0) { + args->no_ext_ops = TRUE; + break; + } return -1; default: return i; @@ -217,6 +223,7 @@ load_file(mrb_state *mrb, struct mrbc_args *args) if (args->verbose) c->dump_result = TRUE; c->no_exec = TRUE; + c->no_ext_ops = args->no_ext_ops; if (input[0] == '-' && input[1] == '\0') { infile = stdin; } |
