summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ruby.c6
-rw-r--r--test/ruby/test_rubyoptions.rb1
2 files changed, 5 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index 2e586c4..0a39bfb 100644
--- a/ruby.c
+++ b/ruby.c
@@ -832,6 +832,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
{
long n, argc0 = argc;
const char *s;
+ int warning = opt->warning;
if (argc == 0)
return 0;
@@ -881,7 +882,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
opt->verbose = 1;
case 'w':
if (!opt->warning) {
- opt->warning = 1;
+ warning = 1;
ruby_verbose = Qtrue;
}
s++;
@@ -911,7 +912,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
break;
}
}
- opt->warning = 1;
+ warning = 1;
}
goto reswitch;
@@ -1234,6 +1235,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
}
switch_end:
+ if (warning) opt->warning = warning;
return argc0 - argc;
}
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 95d60d9..ba74be5 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -64,6 +64,7 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(%w(-W1 -e) + ['p $-W'], "", %w(1), [])
assert_in_out_err(%w(-Wx -e) + ['p $-W'], "", %w(1), [])
assert_in_out_err(%w(-W -e) + ['p $-W'], "", %w(2), [])
+ assert_in_out_err(%w(-w -W0 -e) + ['p $-W'], "", %w(0), [])
ensure
ENV['RUBYOPT'] = save_rubyopt
end