diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-24 08:25:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-24 08:25:44 +0000 |
commit | 22742411548d8b8fad25c272aed0781e3218042a (patch) | |
tree | b241540453b9f4cc72076850b3ca95287252d770 /parse.y | |
parent | 843386848571da72c696b255551c612fe1d9b4ec (diff) | |
download | ruby-22742411548d8b8fad25c272aed0781e3218042a.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.y | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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); |