1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* variable.c (trace_ev): Removed "not reached" comment as this line is

reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2012-04-14 00:36:26 +00:00
parent da39d32f60
commit e95f7ea80d
22 changed files with 110 additions and 39 deletions

View file

@ -1,3 +1,43 @@
Sat Apr 14 09:35:45 2012 Eric Hodel <drbrain@segment7.net>
* variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable): Replaced "not reached"
comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing): ditto.
* variable.c (rb_mod_remove_cvar): ditto.
* enum.c (first_i): ditto.
* string.c (rb_str_aref): ditto.
* string.c (str_byte_aref): ditto.
* string.c (rb_to_id): ditto.
* io.c (rb_io_fmode_modestr): ditto.
* io.c (rb_io_oflags_modestr): ditto.
* pack.c (num2i32): ditto.
* vm_eval.c (rb_method_missing): ditto.
* vm_eval.c (rb_f_throw): ditto.
* dir.c (dir_read): ditto.
* win32/win32.c (child_result): ditto.
* struct.c (rb_struct_getmember): ditto.
* struct.c (rb_struct_set): ditto.
* struct.c (rb_struct_aref_id): ditto.
* eval.c (rb_f_raise): ditto.
* process.c (rb_f_exit_bang): ditto.
* process.c (rb_f_exit): ditto.
* process.c (rb_f_abort): ditto.
* ext/-test-/iter/break.c (iter_break_value): ditto.
* ext/pty/pty.c (pty_check): ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new): ditto.
* ext/readline/readline.c (rb_remove_history): ditto.
* ext/stringio/stringio.c (strio_unimpl): ditto.
* numeric.c (num_sadded): ditto.
* numeric.c (num_init_copy): ditto.
* numeric.c (rb_num2ll): ditto.
* numeric.c (rb_num2ull): ditto.
* vm_insnhelper.c (call_cfunc): ditto.
* ruby.c (opt_W_getter): ditto.
* bignum.c (rb_big_coerce): ditto.
* file.c (rb_f_test): ditto.
Sat Apr 14 08:38:20 2012 Eric Hodel <drbrain@segment7.net> Sat Apr 14 08:38:20 2012 Eric Hodel <drbrain@segment7.net>
* encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control

View file

@ -3674,8 +3674,8 @@ rb_big_coerce(VALUE x, VALUE y)
rb_raise(rb_eTypeError, "can't coerce %s to Bignum", rb_raise(rb_eTypeError, "can't coerce %s to Bignum",
rb_obj_classname(y)); rb_obj_classname(y));
} }
/* not reached */
return Qnil; UNREACHABLE;
} }
/* /*

3
dir.c
View file

@ -590,7 +590,8 @@ dir_read(VALUE dir)
else { else {
rb_sys_fail(0); rb_sys_fail(0);
} }
return Qnil; /* not reached */
UNREACHABLE;
} }
/* /*

3
enum.c
View file

@ -700,7 +700,8 @@ first_i(VALUE i, VALUE params, int argc, VALUE *argv)
memo->u1.value = i; memo->u1.value = i;
rb_iter_break(); rb_iter_break();
return Qnil; /* not reached */
UNREACHABLE;
} }
static VALUE enum_take(VALUE obj, VALUE n); static VALUE enum_take(VALUE obj, VALUE n);

3
eval.c
View file

@ -516,7 +516,8 @@ rb_f_raise(int argc, VALUE *argv)
} }
} }
rb_raise_jump(rb_make_exception(argc, argv)); rb_raise_jump(rb_make_exception(argc, argv));
return Qnil; /* not reached */
UNREACHABLE;
} }
static VALUE static VALUE

View file

@ -4,7 +4,8 @@ static VALUE
iter_break_value(VALUE self, VALUE val) iter_break_value(VALUE self, VALUE val)
{ {
rb_iter_break_value(val); rb_iter_break_value(val);
return self; /* not reached */
UNREACHABLE;
} }
void void

View file

@ -98,7 +98,8 @@ ossl_pkey_new(EVP_PKEY *pkey)
default: default:
ossl_raise(ePKeyError, "unsupported key type"); ossl_raise(ePKeyError, "unsupported key type");
} }
return Qnil; /* not reached */
UNREACHABLE;
} }
VALUE VALUE

View file

@ -687,7 +687,8 @@ pty_check(int argc, VALUE *argv, VALUE self)
if (!RTEST(exc)) return rb_last_status_get(); if (!RTEST(exc)) return rb_last_status_get();
raise_from_check(cpid, status); raise_from_check(cpid, status);
return Qnil; /* not reached */
UNREACHABLE;
} }
static VALUE cPTY; static VALUE cPTY;

View file

@ -1379,7 +1379,8 @@ rb_remove_history(int index)
return Qnil; return Qnil;
#else #else
rb_notimplement(); rb_notimplement();
return Qnil; /* not reached */
UNREACHABLE;
#endif #endif
} }

View file

@ -287,7 +287,8 @@ strio_unimpl(int argc, VALUE *argv, VALUE self)
{ {
StringIO(self); StringIO(self);
rb_notimplement(); rb_notimplement();
return Qnil; /* not reached */
UNREACHABLE;
} }
/* /*

3
file.c
View file

@ -4387,7 +4387,8 @@ rb_f_test(int argc, VALUE *argv)
else { else {
rb_raise(rb_eArgError, "unknown command \"\\x%02X\"", cmd); rb_raise(rb_eArgError, "unknown command \"\\x%02X\"", cmd);
} }
return Qnil; /* not reached */
UNREACHABLE;
} }

6
io.c
View file

@ -4448,7 +4448,8 @@ rb_io_fmode_modestr(int fmode)
return MODE_BTMODE("r+", "rb+", "rt+"); return MODE_BTMODE("r+", "rb+", "rt+");
} }
rb_raise(rb_eArgError, "invalid access fmode 0x%x", fmode); rb_raise(rb_eArgError, "invalid access fmode 0x%x", fmode);
return NULL; /* not reached */
UNREACHABLE;
} }
static int static int
@ -4614,7 +4615,8 @@ rb_io_oflags_modestr(int oflags)
return MODE_BINARY("r+", "rb+"); return MODE_BINARY("r+", "rb+");
} }
rb_raise(rb_eArgError, "invalid access oflags 0x%x", oflags); rb_raise(rb_eArgError, "invalid access oflags 0x%x", oflags);
return NULL; /* not reached */
UNREACHABLE;
} }
/* /*

View file

@ -260,7 +260,8 @@ num_sadded(VALUE x, VALUE name)
"can't define singleton method \"%s\" for %s", "can't define singleton method \"%s\" for %s",
rb_id2name(mid), rb_id2name(mid),
rb_obj_classname(x)); rb_obj_classname(x));
return Qnil; /* not reached */
UNREACHABLE;
} }
/* :nodoc: */ /* :nodoc: */
@ -269,7 +270,8 @@ num_init_copy(VALUE x, VALUE y)
{ {
/* Numerics are immutable values, which should not be copied */ /* Numerics are immutable values, which should not be copied */
rb_raise(rb_eTypeError, "can't copy %s", rb_obj_classname(x)); rb_raise(rb_eTypeError, "can't copy %s", rb_obj_classname(x));
return Qnil; /* not reached */
UNREACHABLE;
} }
/* /*
@ -2099,17 +2101,19 @@ rb_num2ll(VALUE val)
case T_STRING: case T_STRING:
rb_raise(rb_eTypeError, "no implicit conversion from string"); rb_raise(rb_eTypeError, "no implicit conversion from string");
return Qnil; /* not reached */ break;
case T_TRUE: case T_TRUE:
case T_FALSE: case T_FALSE:
rb_raise(rb_eTypeError, "no implicit conversion from boolean"); rb_raise(rb_eTypeError, "no implicit conversion from boolean");
return Qnil; /* not reached */ break;
default: default:
val = rb_to_int(val); val = rb_to_int(val);
return NUM2LL(val); return NUM2LL(val);
} }
UNREACHABLE;
} }
unsigned LONG_LONG unsigned LONG_LONG
@ -2141,17 +2145,19 @@ rb_num2ull(VALUE val)
case T_STRING: case T_STRING:
rb_raise(rb_eTypeError, "no implicit conversion from string"); rb_raise(rb_eTypeError, "no implicit conversion from string");
return Qnil; /* not reached */ break;
case T_TRUE: case T_TRUE:
case T_FALSE: case T_FALSE:
rb_raise(rb_eTypeError, "no implicit conversion from boolean"); rb_raise(rb_eTypeError, "no implicit conversion from boolean");
return Qnil; /* not reached */ break;
default: default:
val = rb_to_int(val); val = rb_to_int(val);
return NUM2ULL(val); return NUM2ULL(val);
} }
UNREACHABLE;
} }
#endif /* HAVE_LONG_LONG */ #endif /* HAVE_LONG_LONG */

3
pack.c
View file

@ -247,7 +247,8 @@ num2i32(VALUE x)
return rb_big2ulong_pack(x); return rb_big2ulong_pack(x);
} }
rb_raise(rb_eTypeError, "can't convert %s to `integer'", rb_obj_classname(x)); rb_raise(rb_eTypeError, "can't convert %s to `integer'", rb_obj_classname(x));
return 0; /* not reached */
UNREACHABLE;
} }
#define MAX_INTEGER_PACK_SIZE 8 #define MAX_INTEGER_PACK_SIZE 8

View file

@ -2868,7 +2868,7 @@ rb_f_exit_bang(int argc, VALUE *argv, VALUE obj)
} }
_exit(istatus); _exit(istatus);
return Qnil; /* not reached */ UNREACHABLE;
} }
void void
@ -2941,7 +2941,8 @@ rb_f_exit(int argc, VALUE *argv)
istatus = EXIT_SUCCESS; istatus = EXIT_SUCCESS;
} }
rb_exit(istatus); rb_exit(istatus);
return Qnil; /* not reached */
UNREACHABLE;
} }
@ -2975,7 +2976,8 @@ rb_f_abort(int argc, VALUE *argv)
args[0] = INT2NUM(EXIT_FAILURE); args[0] = INT2NUM(EXIT_FAILURE);
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit)); rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
} }
return Qnil; /* not reached */
UNREACHABLE;
} }
void void

3
ruby.c
View file

@ -1757,7 +1757,8 @@ opt_W_getter(ID id, void *data)
case Qtrue: case Qtrue:
return INT2FIX(2); return INT2FIX(2);
} }
return Qnil; /* not reached */
UNREACHABLE;
} }
void void

View file

@ -3186,7 +3186,8 @@ rb_str_aref(VALUE str, VALUE indx)
idx = NUM2LONG(indx); idx = NUM2LONG(indx);
goto num_index; goto num_index;
} }
return Qnil; /* not reached */
UNREACHABLE;
} }
@ -4092,7 +4093,8 @@ str_byte_aref(VALUE str, VALUE indx)
idx = NUM2LONG(indx); idx = NUM2LONG(indx);
goto num_index; goto num_index;
} }
return Qnil; /* not reached */
UNREACHABLE;
} }
/* /*
@ -7764,7 +7766,8 @@ rb_to_id(VALUE name)
case T_SYMBOL: case T_SYMBOL:
return SYM2ID(name); return SYM2ID(name);
} }
return Qnil; /* not reached */
UNREACHABLE;
} }
/* /*

View file

@ -113,7 +113,8 @@ rb_struct_getmember(VALUE obj, ID id)
} }
} }
rb_name_error(id, "%s is not struct member", rb_id2name(id)); rb_name_error(id, "%s is not struct member", rb_id2name(id));
return Qnil; /* not reached */
UNREACHABLE;
} }
static VALUE static VALUE
@ -175,7 +176,8 @@ rb_struct_set(VALUE obj, VALUE val)
} }
rb_name_error(rb_frame_this_func(), "`%s' is not a struct member", rb_name_error(rb_frame_this_func(), "`%s' is not a struct member",
rb_id2name(rb_frame_this_func())); rb_id2name(rb_frame_this_func()));
return Qnil; /* not reached */
UNREACHABLE;
} }
static VALUE static VALUE
@ -617,7 +619,8 @@ rb_struct_aref_id(VALUE s, ID id)
} }
} }
rb_name_error(id, "no member '%s' in struct", rb_id2name(id)); rb_name_error(id, "no member '%s' in struct", rb_id2name(id));
return Qnil; /* not reached */
UNREACHABLE;
} }
/* /*

View file

@ -694,7 +694,8 @@ trace_ev(struct trace_data *data)
(*trace->func)(trace->data, data->val); (*trace->func)(trace->data, data->val);
trace = trace->next; trace = trace->next;
} }
return Qnil; /* not reached */
return Qnil;
} }
static VALUE static VALUE
@ -1363,7 +1364,8 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name)
break; break;
} }
rb_name_error(id, "instance variable %s not defined", rb_id2name(id)); rb_name_error(id, "instance variable %s not defined", rb_id2name(id));
return Qnil; /* not reached */
UNREACHABLE;
} }
NORETURN(static void uninitialized_constant(VALUE, ID)); NORETURN(static void uninitialized_constant(VALUE, ID));
@ -1427,7 +1429,8 @@ rb_mod_const_missing(VALUE klass, VALUE name)
{ {
rb_frame_pop(); /* pop frame for "const_missing" */ rb_frame_pop(); /* pop frame for "const_missing" */
uninitialized_constant(klass, rb_to_id(name)); uninitialized_constant(klass, rb_to_id(name));
return Qnil; /* not reached */
UNREACHABLE;
} }
static void static void
@ -2408,7 +2411,8 @@ rb_mod_remove_cvar(VALUE mod, VALUE name)
} }
rb_name_error(id, "class variable %s not defined for %s", rb_name_error(id, "class variable %s not defined for %s",
rb_id2name(id), rb_class2name(mod)); rb_id2name(id), rb_class2name(mod));
return Qnil; /* not reached */
UNREACHABLE;
} }
VALUE VALUE

View file

@ -496,7 +496,7 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj)
{ {
rb_thread_t *th = GET_THREAD(); rb_thread_t *th = GET_THREAD();
raise_method_missing(th, argc, argv, obj, th->method_missing_reason); raise_method_missing(th, argc, argv, obj, th->method_missing_reason);
return Qnil; /* not reached */ UNREACHABLE;
} }
#define NOEX_MISSING 0x80 #define NOEX_MISSING 0x80
@ -1450,7 +1450,7 @@ rb_f_throw(int argc, VALUE *argv)
rb_scan_args(argc, argv, "11", &tag, &value); rb_scan_args(argc, argv, "11", &tag, &value);
rb_throw_obj(tag, value); rb_throw_obj(tag, value);
return Qnil; /* not reached */ UNREACHABLE;
} }
void void

View file

@ -431,7 +431,7 @@ call_cfunc(VALUE (*func)(), VALUE recv,
break; break;
default: default:
rb_raise(rb_eArgError, "too many arguments(%d)", len); rb_raise(rb_eArgError, "too many arguments(%d)", len);
return Qundef; /* not reached */ UNREACHABLE;
} }
} }

View file

@ -1079,8 +1079,8 @@ child_result(struct ChildRecord *child, int mode)
GetExitCodeProcess(child->hProcess, &exitcode); GetExitCodeProcess(child->hProcess, &exitcode);
CloseChildHandle(child); CloseChildHandle(child);
_exit(exitcode); _exit(exitcode);
default: default
return -1; /* not reached */ UNREACHABLE;
} }
} }