diff options
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 73 |
1 files changed, 32 insertions, 41 deletions
@@ -1436,6 +1436,16 @@ proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char ** set_source_encoding_once(opt, s, 0); } #endif +#if defined(USE_SHARED_GC) && USE_SHARED_GC + else if (is_option_with_arg("gc-library", Qfalse, Qfalse)) { + // no-op + // Handled by ruby_load_external_gc_from_argv + + if (!dln_supported_p()) { + rb_warn("--gc-library is ignored because this executable file can't load extension libraries"); + } + } +#endif else if (strcmp("version", s) == 0) { if (envopt) goto noenvopt_long; opt->dump |= DUMP_BIT(version); @@ -1779,7 +1789,7 @@ ruby_opt_init(ruby_cmdline_options_t *opt) } if (getenv("RUBY_FREE_AT_EXIT")) { - rb_warn("Free at exit is experimental and may be unstable"); + rb_category_warn(RB_WARN_CATEGORY_EXPERIMENTAL, "Free at exit is experimental and may be unstable"); rb_free_at_exit = true; } @@ -2060,7 +2070,7 @@ static VALUE process_script(ruby_cmdline_options_t *opt) { rb_ast_t *ast; - VALUE vast; + VALUE ast_value; VALUE parser = rb_parser_new(); const unsigned int dump = opt->dump; @@ -2080,7 +2090,7 @@ process_script(ruby_cmdline_options_t *opt) ruby_set_script_name(progname); rb_parser_set_options(parser, opt->do_print, opt->do_loop, opt->do_line, opt->do_split); - vast = rb_parser_compile_string(parser, opt->script, opt->e_script, 1); + ast_value = rb_parser_compile_string(parser, opt->script, opt->e_script, 1); } else { VALUE f; @@ -2088,35 +2098,14 @@ process_script(ruby_cmdline_options_t *opt) f = open_load_file(opt->script_name, &xflag); opt->xflag = xflag != 0; rb_parser_set_context(parser, 0, f == rb_stdin); - vast = load_file(parser, opt->script_name, f, 1, opt); + ast_value = load_file(parser, opt->script_name, f, 1, opt); } - ast = rb_ruby_ast_data_get(vast); + ast = rb_ruby_ast_data_get(ast_value); if (!ast->body.root) { rb_ast_dispose(ast); return Qnil; } - return vast; -} - -/** - * Call ruby_opt_init to set up the global state based on the command line - * options, and then warn if prism is enabled and the experimental warning - * category is enabled. - */ -static void -prism_opt_init(ruby_cmdline_options_t *opt) -{ - ruby_opt_init(opt); - - if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL)) { - rb_category_warn( - RB_WARN_CATEGORY_EXPERIMENTAL, - "The compiler based on the Prism parser is currently experimental " - "and compatibility with the compiler based on parse.y is not yet " - "complete. Please report any issues you find on the `ruby/prism` " - "issue tracker." - ); - } + return ast_value; } /** @@ -2147,14 +2136,15 @@ prism_script(ruby_cmdline_options_t *opt, pm_parse_result_t *result) pm_options_command_line_set(options, command_line); pm_options_filepath_set(options, "-"); - prism_opt_init(opt); + ruby_opt_init(opt); error = pm_parse_stdin(result); } else if (opt->e_script) { command_line |= PM_OPTIONS_COMMAND_LINE_E; pm_options_command_line_set(options, command_line); - prism_opt_init(opt); + ruby_opt_init(opt); + result->node.coverage_enabled = 0; error = pm_parse_string(result, opt->e_script, rb_str_new2("-e")); } else { @@ -2165,7 +2155,7 @@ prism_script(ruby_cmdline_options_t *opt, pm_parse_result_t *result) // line options. We do it in this order so that if the main script fails // to load, it doesn't require files required by -r. if (NIL_P(error)) { - prism_opt_init(opt); + ruby_opt_init(opt); error = pm_parse_file(result, opt->script_name); } @@ -2239,7 +2229,7 @@ process_options_global_setup(const ruby_cmdline_options_t *opt, const rb_iseq_t static VALUE process_options(int argc, char **argv, ruby_cmdline_options_t *opt) { - VALUE vast = Qnil; + VALUE ast_value = Qnil; struct { rb_ast_t *ast; pm_parse_result_t prism; @@ -2301,7 +2291,8 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) #endif #if USE_YJIT if (FEATURE_SET_P(opt->features, yjit)) { - opt->yjit = true; // set opt->yjit for Init_ruby_description() and calling rb_yjit_init() + bool rb_yjit_option_disable(void); + opt->yjit = !rb_yjit_option_disable(); // set opt->yjit for Init_ruby_description() and calling rb_yjit_init() } #endif @@ -2474,8 +2465,8 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) } if (!(*rb_ruby_prism_ptr())) { - vast = process_script(opt); - if (!(result.ast = rb_ruby_ast_data_get(vast))) return Qfalse; + ast_value = process_script(opt); + if (!(result.ast = rb_ruby_ast_data_get(ast_value))) return Qfalse; } else { prism_script(opt, &result.prism); @@ -2557,7 +2548,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) } else { rb_ast_t *ast = result.ast; - iseq = rb_iseq_new_main(vast, opt->script_name, path, parent, optimize); + iseq = rb_iseq_new_main(ast_value, opt->script_name, path, parent, optimize); rb_ast_dispose(ast); } } @@ -2608,7 +2599,7 @@ load_file_internal(VALUE argp_v) ruby_cmdline_options_t *opt = argp->opt; VALUE f = argp->f; int line_start = 1; - VALUE vast = Qnil; + VALUE ast_value = Qnil; rb_encoding *enc; ID set_encoding; @@ -2709,7 +2700,7 @@ load_file_internal(VALUE argp_v) return rb_parser_compile_string_path(parser, orig_fname, f, line_start); } rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-")); - vast = rb_parser_compile_file_path(parser, orig_fname, f, line_start); + ast_value = rb_parser_compile_file_path(parser, orig_fname, f, line_start); rb_funcall(f, set_encoding, 1, rb_parser_encoding(parser)); if (script && rb_parser_end_seen_p(parser)) { /* @@ -2727,7 +2718,7 @@ load_file_internal(VALUE argp_v) rb_define_global_const("DATA", f); argp->f = Qnil; } - return vast; + return ast_value; } /* disabling O_NONBLOCK, and returns 0 on success, otherwise errno */ @@ -2859,9 +2850,9 @@ rb_load_file(const char *fname) void * rb_load_file_str(VALUE fname_v) { - VALUE vast; - vast = rb_parser_load_file(rb_parser_new(), fname_v); - return (void *)rb_ruby_ast_data_get(vast); + VALUE ast_value; + ast_value = rb_parser_load_file(rb_parser_new(), fname_v); + return (void *)rb_ruby_ast_data_get(ast_value); } VALUE |