Skip to content

Commit

Permalink
Update warning flags before dump
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Feb 20, 2024
1 parent bcfcdae commit 835fa98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ruby.c
Expand Up @@ -1739,6 +1739,8 @@ Init_extra_exts(void)
static void
ruby_opt_init(ruby_cmdline_options_t *opt)
{
rb_warning_category_update(opt->warn.mask, opt->warn.set);

if (opt->dump & dump_exit_bits) return;

if (FEATURE_SET_P(opt->features, gems)) {
Expand All @@ -1754,8 +1756,6 @@ ruby_opt_init(ruby_cmdline_options_t *opt)
}
}

rb_warning_category_update(opt->warn.mask, opt->warn.set);

/* [Feature #19785] Warning for removed GC environment variable.
* Remove this in Ruby 3.4. */
if (getenv("RUBY_GC_HEAP_INIT_SLOTS")) {
Expand Down
2 changes: 2 additions & 0 deletions test/ruby/test_rubyoptions.rb
Expand Up @@ -296,6 +296,8 @@ def test_parser_flag
warning = /compiler based on the Prism parser is currently experimental/

assert_in_out_err(%w(--parser=prism -e) + ["puts :hi"], "", %w(hi), warning)
assert_in_out_err(%w(--parser=prism -W:no-experimental -e) + ["puts :hi"], "", %w(hi), [])
assert_in_out_err(%w(--parser=prism -W:no-experimental --dump=parsetree -e :hi), "", /"hi"/, [])

assert_in_out_err(%w(--parser=parse.y -e) + ["puts :hi"], "", %w(hi), [])
assert_norun_with_rflag('--parser=parse.y', '--version', "")
Expand Down

0 comments on commit 835fa98

Please sign in to comment.