aboutsummaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2021-02-20 17:29:32 +0900
committernagachika <nagachika@ruby-lang.org>2021-02-20 17:29:32 +0900
commit14823c2d7c20dba288025749b4d55c02d8729871 (patch)
tree2b542bf52642231d92b71f40c3f42e192789ecdc /ruby.c
parent69d01653f831052acdc803aad0b78690ad61ca86 (diff)
downloadruby-14823c2d7c20dba288025749b4d55c02d8729871.tar.gz
merge revision(s) 6f6dfdcc685077f0f85dcdd63843ecfc0f6fbfb6: [Backport #17523]
Make warning values consistent [Bug #17523] They should be affected, as well as `$VERBOSE`, by `-w`/`-W` options, not only in the main script but in scripts loaded by `-r` option too. --- ruby.c | 4 ++-- test/ruby/test_rubyoptions.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index 96d8f75a56..7d8d8e38f5 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1771,6 +1771,9 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
rb_ary_replace(vm->load_path_snapshot, load_path);
}
}
+
+ rb_warning_category_update(opt->warn.mask, opt->warn.set);
+
Init_ext(); /* load statically linked extensions before rubygems */
if (opt->features.set & FEATURE_BIT(gems)) {
rb_define_module("Gem");
@@ -1819,7 +1822,6 @@ process_options(int argc, char **argv, 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);
- rb_warning_category_update(opt->warn.mask, opt->warn.set);
ast = rb_parser_compile_string(parser, opt->script, opt->e_script, 1);
}
else {
@@ -2058,7 +2060,6 @@ load_file_internal(VALUE argp_v)
}
rb_parser_set_options(parser, opt->do_print, opt->do_loop,
opt->do_line, opt->do_split);
- rb_warning_category_update(opt->warn.mask, opt->warn.set);
if (NIL_P(f)) {
f = rb_str_new(0, 0);
rb_enc_associate(f, enc);