From 406f6a23d5f2f5bb8a454038b3e2100a9da44a5b Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 5 Sep 2012 06:23:20 +0000 Subject: [PATCH] * parse.y (rb_warn4): added as a rb_warn variant to warn with explicit source file name and line in parse.y. * parse.y (warn_unused_var): use rb_warn4 to suppress warning on ripper. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ parse.y | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6cf62f9427..431da630a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Sep 5 15:21:12 2012 NARUSE, Yui + + * parse.y (rb_warn4): added as a rb_warn variant to warn with explicit + source file name and line in parse.y. + + * parse.y (warn_unused_var): use rb_warn4 to suppress warning on ripper. + Wed Sep 5 13:30:04 2012 Nobuyoshi Nakada * dir.c (glob_make_pattern): names under recursive need to be single diff --git a/parse.y b/parse.y index 67bd7108be..230faa3dc9 100644 --- a/parse.y +++ b/parse.y @@ -596,12 +596,14 @@ new_args_tail_gen(struct parser_params *parser, VALUE k, VALUE kr, VALUE b) # define rb_warn0(fmt) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt)) # define rb_warnI(fmt,a) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt), (a)) # define rb_warnS(fmt,a) rb_compile_warn(ruby_sourcefile, ruby_sourceline, (fmt), (a)) +# define rb_warn4(file,line,fmt,a) rb_compile_warn((file), (line), (fmt), (a)) # define rb_warning0(fmt) rb_compile_warning(ruby_sourcefile, ruby_sourceline, (fmt)) # define rb_warningS(fmt,a) rb_compile_warning(ruby_sourcefile, ruby_sourceline, (fmt), (a)) #else # define rb_warn0(fmt) ripper_warn0(parser, (fmt)) # define rb_warnI(fmt,a) ripper_warnI(parser, (fmt), (a)) # define rb_warnS(fmt,a) ripper_warnS(parser, (fmt), (a)) +# define rb_warn4(file,line,fmt,a) ripper_warnI(parser, (fmt), (a)) # define rb_warning0(fmt) ripper_warning0(parser, (fmt)) # define rb_warningS(fmt,a) ripper_warningS(parser, (fmt), (a)) static void ripper_warn0(struct parser_params*, const char*); @@ -9446,7 +9448,7 @@ warn_unused_var(struct parser_params *parser, struct local_vars *local) for (i = 0; i < cnt; ++i) { if (!v[i] || (u[i] & LVAR_USED)) continue; if (is_private_local_id(v[i])) continue; - rb_compile_warn(ruby_sourcefile, (int)u[i], "assigned but unused variable - %s", rb_id2name(v[i])); + rb_warn4(ruby_sourcefile, (int)u[i], "assigned but unused variable - %s", rb_id2name(v[i])); } }