diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-18 01:50:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-18 01:50:49 +0000 |
commit | d8db69e68301594360db3a4bc923b263c9909ff7 (patch) | |
tree | 7a5ca4b5199a177b9b57cad5283637ae217c74d9 /vm_eval.c | |
parent | d0b92e798feb650cbb912d3b4bc4546a1caac6ad (diff) | |
download | ruby-d8db69e68301594360db3a4bc923b263c9909ff7.tar.gz |
Suppress false warnings
* vm_eval.c (rb_eval_cmd): refactor to share common code, and
suppress false maybe-uninitialized warnings by old gcc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r-- | vm_eval.c | 27 |
1 files changed, 9 insertions, 18 deletions
@@ -1548,32 +1548,23 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int level) { int state; volatile VALUE val = Qnil; /* OK */ - volatile int safe = rb_safe_level(); - rb_thread_t *th = GET_THREAD(); + const int VAR_NOCLOBBERED(safe) = rb_safe_level(); + rb_thread_t *const VAR_NOCLOBBERED(th) = GET_THREAD(); if (OBJ_TAINTED(cmd)) { level = RUBY_SAFE_LEVEL_MAX; } - if (!RB_TYPE_P(cmd, T_STRING)) { - TH_PUSH_TAG(th); - rb_set_safe_level_force(level); - if ((state = TH_EXEC_TAG()) == 0) { + TH_PUSH_TAG(th); + rb_set_safe_level_force(level); + if ((state = TH_EXEC_TAG()) == 0) { + if (!RB_TYPE_P(cmd, T_STRING)) { val = rb_funcall2(cmd, idCall, RARRAY_LENINT(arg), RARRAY_CONST_PTR(arg)); } - TH_POP_TAG(); - - rb_set_safe_level_force(safe); - - if (state) - TH_JUMP_TAG(th, state); - return val; - } - - TH_PUSH_TAG(th); - if ((state = TH_EXEC_TAG()) == 0) { - val = eval_string(rb_vm_top_self(), cmd, Qnil, 0, 0); + else { + val = eval_string(rb_vm_top_self(), cmd, Qnil, 0, 0); + } } TH_POP_TAG(); |