ruby-changes:49826
From: shyouhei <ko1@a...>
Date: Fri, 19 Jan 2018 12:59:18 +0900 (JST)
Subject: [ruby-changes:49826] shyouhei:r61944 (trunk): avoid goto
shyouhei 2018-01-19 12:59:13 +0900 (Fri, 19 Jan 2018) New Revision: 61944 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61944 Log: avoid goto gcc -Wjump-misses-init warns this goto. That is a false alert. However why on earth do we need to use goto here? Modified files: trunk/vm_insnhelper.c Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 61943) +++ vm_insnhelper.c (revision 61944) @@ -940,14 +940,6 @@ vm_getivar(VALUE obj, ID id, IC ic, stru https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L940 if (LIKELY(index < ROBJECT_NUMIV(obj))) { val = ROBJECT_IVPTR(obj)[index]; } - undef_check: - if (UNLIKELY(val == Qundef)) { - if (!is_attr && RTEST(ruby_verbose)) - rb_warning("instance variable %"PRIsVALUE" not initialized", QUOTE_ID(id)); - val = Qnil; - } - RB_DEBUG_COUNTER_INC(ivar_get_ic_hit); - return val; } else { st_data_t index; @@ -967,8 +959,14 @@ vm_getivar(VALUE obj, ID id, IC ic, stru https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L959 } } } - goto undef_check; } + if (UNLIKELY(val == Qundef)) { + if (!is_attr && RTEST(ruby_verbose)) + rb_warning("instance variable %"PRIsVALUE" not initialized", QUOTE_ID(id)); + val = Qnil; + } + RB_DEBUG_COUNTER_INC(ivar_get_ic_hit); + return val; } else { RB_DEBUG_COUNTER_INC(ivar_get_ic_miss_noobject); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/