aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-24 08:25:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-24 08:25:44 +0000
commit26984290eb4f20a4a2db2b8d461cd36a4a5b0e49 (patch)
treeb241540453b9f4cc72076850b3ca95287252d770 /parse.y
parent8cda3cbb5678bad7a3fae3f9502bf882ac0d689b (diff)
downloadruby-26984290eb4f20a4a2db2b8d461cd36a4a5b0e49.tar.gz
preserve source file name encoding
* compile.c (append_compile_error), parse.y (compile_error): preserve encoding of source file name in exceptions. * error.c (rb_compile_error_str, rb_compile_bug_str): add. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 5 insertions, 5 deletions
diff --git a/parse.y b/parse.y
index c77b7a558d..59614b6936 100644
--- a/parse.y
+++ b/parse.y
@@ -741,15 +741,15 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
# define WARN_S(s) s
# define WARN_I(i) i
# define PRIsWARN PRIsVALUE
-# define WARN_ARGS(fmt,n) ruby_sourcefile, ruby_sourceline, (fmt)
+# define WARN_ARGS(fmt,n) WARN_ARGS_L(ruby_sourceline,fmt,n)
# define WARN_ARGS_L(l,fmt,n) ruby_sourcefile, (l), (fmt)
# define WARN_CALL rb_compile_warn
# define WARNING_ARGS(fmt,n) WARN_ARGS(fmt,n)
# define WARNING_ARGS_L(l,fmt,n) WARN_ARGS_L(l,fmt,n)
# define WARNING_CALL rb_compile_warning
-# define rb_compile_error rb_compile_error_with_enc
-# define compile_error (parser->error_p = 1),rb_compile_error_with_enc
-# define PARSER_ARG ruby_sourcefile, ruby_sourceline, (void *)current_enc,
+# define rb_compile_error rb_compile_error_str
+# define compile_error (parser->error_p = 1),rb_compile_error_str
+# define PARSER_ARG ruby_sourcefile_string, ruby_sourceline, (void *)current_enc,
#endif
/* Older versions of Yacc set YYMAXDEPTH to a very low value by default (150,
@@ -7020,7 +7020,7 @@ parser_set_encode(struct parser_params *parser, const char *name)
error:
excargs[0] = rb_eArgError;
excargs[2] = rb_make_backtrace();
- rb_ary_unshift(excargs[2], rb_sprintf("%s:%d", ruby_sourcefile, ruby_sourceline));
+ rb_ary_unshift(excargs[2], rb_sprintf("%"PRIsVALUE":%d", ruby_sourcefile_string, ruby_sourceline));
rb_exc_raise(rb_make_exception(3, excargs));
}
enc = rb_enc_from_index(idx);