From e63d45a5f910f0a1dc2de3aeb07b85bfe84b9051 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 15 Jun 2013 15:36:51 +0000 Subject: merge revision(s) 40759,40966,41305,41306: [Backport #8436] vm_eval.c: suppress warning * vm_eval.c (eval_string_with_cref): narrow a variable scope into the EXEC_TAG block to suppress -Wclobberd warning. * vm_eval.c (eval_string_with_cref): propagate absolute path from the binding if it is given explicitly. patch by Gat (Dawid Janczak) at [ruby-core:55123]. [Bug #8436] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_eval.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'vm_eval.c') diff --git a/vm_eval.c b/vm_eval.c index a52ab21e81..a152a6990e 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -1157,7 +1157,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char int state; VALUE result = Qundef; VALUE envval; - rb_binding_t *bind = 0; + VALUE absolute_path = Qnil; rb_thread_t *th = GET_THREAD(); rb_env_t *env = NULL; rb_block_t block, *base_block; @@ -1173,6 +1173,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char mild_compile_error = th->mild_compile_error; TH_PUSH_TAG(th); if ((state = TH_EXEC_TAG()) == 0) { + rb_binding_t *bind = 0; rb_iseq_t *iseq; volatile VALUE iseqval; @@ -1183,6 +1184,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) { file = RSTRING_PTR(bind->path); line = bind->first_lineno; + absolute_path = rb_current_realfilepath(); } } else { @@ -1210,7 +1212,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char /* make eval iseq */ th->parse_in_eval++; th->mild_compile_error++; - iseqval = rb_iseq_compile_on_base(src, rb_str_new2(file), INT2FIX(line), base_block); + iseqval = rb_iseq_compile_with_option(src, rb_str_new2(file), absolute_path, INT2FIX(line), base_block, Qnil); th->mild_compile_error--; th->parse_in_eval--; -- cgit v1.2.3