summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--parse.y4
2 files changed, 10 insertions, 1 deletions
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 <naruse@ruby-lang.org>
+
+ * 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 <nobu@ruby-lang.org>
* 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]));
}
}