summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-29 10:39:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-29 10:39:53 +0000
commit1eafb3dd4b8f7f7ece5a53f767de85f959d4e25e (patch)
treedbcd53ea7612ee04cd92383b5ccb7154add57955 /ruby.c
parent66fe2c0dd9f30efe785ce5f7411d9386fbcfeadc (diff)
ruby.c: parse -W option
* ruby.c (proc_options): parse and skip '-W' option and its argument even if ignored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/ruby.c b/ruby.c
index cb74a00855..2e586c40dc 100644
--- a/ruby.c
+++ b/ruby.c
@@ -888,28 +888,30 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
goto reswitch;
case 'W':
- if (!opt->warning) {
+ {
size_t numlen;
int v = 2; /* -W as -W2 */
- opt->warning = 1;
if (*++s) {
v = scan_oct(s, 1, &numlen);
if (numlen == 0)
v = 1;
s += numlen;
}
- switch (v) {
- case 0:
- ruby_verbose = Qnil;
- break;
- case 1:
- ruby_verbose = Qfalse;
- break;
- default:
- ruby_verbose = Qtrue;
- break;
+ if (!opt->warning) {
+ switch (v) {
+ case 0:
+ ruby_verbose = Qnil;
+ break;
+ case 1:
+ ruby_verbose = Qfalse;
+ break;
+ default:
+ ruby_verbose = Qtrue;
+ break;
+ }
}
+ opt->warning = 1;
}
goto reswitch;