ruby-changes:43362
From: nobu <ko1@a...>
Date: Sat, 18 Jun 2016 10:50:53 +0900 (JST)
Subject: [ruby-changes:43362] nobu:r55436 (trunk): Suppress false warnings
nobu 2016-06-18 10:50:49 +0900 (Sat, 18 Jun 2016) New Revision: 55436 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55436 Log: Suppress false warnings * vm_eval.c (rb_eval_cmd): refactor to share common code, and suppress false maybe-uninitialized warnings by old gcc. Modified files: trunk/eval_intern.h trunk/vm_eval.c Index: vm_eval.c =================================================================== --- vm_eval.c (revision 55435) +++ vm_eval.c (revision 55436) @@ -1548,32 +1548,23 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int le https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1548 { 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(); Index: eval_intern.h =================================================================== --- eval_intern.h (revision 55435) +++ eval_intern.h (revision 55436) @@ -139,9 +139,11 @@ LONG WINAPI rb_w32_stack_overflow_handle https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L139 #if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) # define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var)) # define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var)) +# define VAR_NOCLOBBERED(var) volatile var #else # define VAR_FROM_MEMORY(var) (var) # define VAR_INITIALIZED(var) ((void)&(var)) +# define VAR_NOCLOBBERED(var) var #endif /* clear th->state, and return the value */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/