diff options
-rw-r--r-- | ChangeLog | 40 | ||||
-rw-r--r-- | bignum.c | 4 | ||||
-rw-r--r-- | dir.c | 3 | ||||
-rw-r--r-- | enum.c | 3 | ||||
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | ext/-test-/iter/break.c | 3 | ||||
-rw-r--r-- | ext/openssl/ossl_pkey.c | 3 | ||||
-rw-r--r-- | ext/pty/pty.c | 3 | ||||
-rw-r--r-- | ext/readline/readline.c | 3 | ||||
-rw-r--r-- | ext/stringio/stringio.c | 3 | ||||
-rw-r--r-- | file.c | 3 | ||||
-rw-r--r-- | io.c | 6 | ||||
-rw-r--r-- | numeric.c | 18 | ||||
-rw-r--r-- | pack.c | 3 | ||||
-rw-r--r-- | process.c | 8 | ||||
-rw-r--r-- | ruby.c | 3 | ||||
-rw-r--r-- | string.c | 9 | ||||
-rw-r--r-- | struct.c | 9 | ||||
-rw-r--r-- | variable.c | 12 | ||||
-rw-r--r-- | vm_eval.c | 4 | ||||
-rw-r--r-- | vm_insnhelper.c | 2 | ||||
-rw-r--r-- | win32/win32.c | 4 |
22 files changed, 110 insertions, 39 deletions
@@ -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> * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control @@ -3674,8 +3674,8 @@ rb_big_coerce(VALUE x, VALUE y) rb_raise(rb_eTypeError, "can't coerce %s to Bignum", rb_obj_classname(y)); } - /* not reached */ - return Qnil; + + UNREACHABLE; } /* @@ -590,7 +590,8 @@ dir_read(VALUE dir) else { rb_sys_fail(0); } - return Qnil; /* not reached */ + + UNREACHABLE; } /* @@ -700,7 +700,8 @@ first_i(VALUE i, VALUE params, int argc, VALUE *argv) memo->u1.value = i; rb_iter_break(); - return Qnil; /* not reached */ + + UNREACHABLE; } static VALUE enum_take(VALUE obj, VALUE n); @@ -516,7 +516,8 @@ rb_f_raise(int argc, VALUE *argv) } } rb_raise_jump(rb_make_exception(argc, argv)); - return Qnil; /* not reached */ + + UNREACHABLE; } static VALUE diff --git a/ext/-test-/iter/break.c b/ext/-test-/iter/break.c index 78c7da6491..b72440f838 100644 --- a/ext/-test-/iter/break.c +++ b/ext/-test-/iter/break.c @@ -4,7 +4,8 @@ static VALUE iter_break_value(VALUE self, VALUE val) { rb_iter_break_value(val); - return self; /* not reached */ + + UNREACHABLE; } void diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index 15a2eed8d2..0004d9d9b5 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -98,7 +98,8 @@ ossl_pkey_new(EVP_PKEY *pkey) default: ossl_raise(ePKeyError, "unsupported key type"); } - return Qnil; /* not reached */ + + UNREACHABLE; } VALUE diff --git a/ext/pty/pty.c b/ext/pty/pty.c index d7e6f3d8bb..de5cbf79e2 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -687,7 +687,8 @@ pty_check(int argc, VALUE *argv, VALUE self) if (!RTEST(exc)) return rb_last_status_get(); raise_from_check(cpid, status); - return Qnil; /* not reached */ + + UNREACHABLE; } static VALUE cPTY; diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 77acfdf517..e550782c5d 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -1379,7 +1379,8 @@ rb_remove_history(int index) return Qnil; #else rb_notimplement(); - return Qnil; /* not reached */ + + UNREACHABLE; #endif } diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 54d36c96a8..89fe5dab72 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -287,7 +287,8 @@ strio_unimpl(int argc, VALUE *argv, VALUE self) { StringIO(self); rb_notimplement(); - return Qnil; /* not reached */ + + UNREACHABLE; } /* @@ -4387,7 +4387,8 @@ rb_f_test(int argc, VALUE *argv) else { rb_raise(rb_eArgError, "unknown command \"\\x%02X\"", cmd); } - return Qnil; /* not reached */ + + UNREACHABLE; } @@ -4448,7 +4448,8 @@ rb_io_fmode_modestr(int fmode) return MODE_BTMODE("r+", "rb+", "rt+"); } rb_raise(rb_eArgError, "invalid access fmode 0x%x", fmode); - return NULL; /* not reached */ + + UNREACHABLE; } static int @@ -4614,7 +4615,8 @@ rb_io_oflags_modestr(int oflags) return MODE_BINARY("r+", "rb+"); } rb_raise(rb_eArgError, "invalid access oflags 0x%x", oflags); - return NULL; /* not reached */ + + UNREACHABLE; } /* @@ -260,7 +260,8 @@ num_sadded(VALUE x, VALUE name) "can't define singleton method \"%s\" for %s", rb_id2name(mid), rb_obj_classname(x)); - return Qnil; /* not reached */ + + UNREACHABLE; } /* :nodoc: */ @@ -269,7 +270,8 @@ num_init_copy(VALUE x, VALUE y) { /* Numerics are immutable values, which should not be copied */ 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: rb_raise(rb_eTypeError, "no implicit conversion from string"); - return Qnil; /* not reached */ + break; case T_TRUE: case T_FALSE: rb_raise(rb_eTypeError, "no implicit conversion from boolean"); - return Qnil; /* not reached */ + break; default: val = rb_to_int(val); return NUM2LL(val); } + + UNREACHABLE; } unsigned LONG_LONG @@ -2141,17 +2145,19 @@ rb_num2ull(VALUE val) case T_STRING: rb_raise(rb_eTypeError, "no implicit conversion from string"); - return Qnil; /* not reached */ + break; case T_TRUE: case T_FALSE: rb_raise(rb_eTypeError, "no implicit conversion from boolean"); - return Qnil; /* not reached */ + break; default: val = rb_to_int(val); return NUM2ULL(val); } + + UNREACHABLE; } #endif /* HAVE_LONG_LONG */ @@ -247,7 +247,8 @@ num2i32(VALUE x) return rb_big2ulong_pack(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 @@ -2868,7 +2868,7 @@ rb_f_exit_bang(int argc, VALUE *argv, VALUE obj) } _exit(istatus); - return Qnil; /* not reached */ + UNREACHABLE; } void @@ -2941,7 +2941,8 @@ rb_f_exit(int argc, VALUE *argv) istatus = EXIT_SUCCESS; } rb_exit(istatus); - return Qnil; /* not reached */ + + UNREACHABLE; } @@ -2975,7 +2976,8 @@ rb_f_abort(int argc, VALUE *argv) args[0] = INT2NUM(EXIT_FAILURE); rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit)); } - return Qnil; /* not reached */ + + UNREACHABLE; } void @@ -1757,7 +1757,8 @@ opt_W_getter(ID id, void *data) case Qtrue: return INT2FIX(2); } - return Qnil; /* not reached */ + + UNREACHABLE; } void @@ -3186,7 +3186,8 @@ rb_str_aref(VALUE str, VALUE indx) idx = NUM2LONG(indx); goto num_index; } - return Qnil; /* not reached */ + + UNREACHABLE; } @@ -4092,7 +4093,8 @@ str_byte_aref(VALUE str, VALUE indx) idx = NUM2LONG(indx); goto num_index; } - return Qnil; /* not reached */ + + UNREACHABLE; } /* @@ -7764,7 +7766,8 @@ rb_to_id(VALUE name) case T_SYMBOL: return SYM2ID(name); } - return Qnil; /* not reached */ + + UNREACHABLE; } /* @@ -113,7 +113,8 @@ rb_struct_getmember(VALUE obj, ID id) } } rb_name_error(id, "%s is not struct member", rb_id2name(id)); - return Qnil; /* not reached */ + + UNREACHABLE; } 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_id2name(rb_frame_this_func())); - return Qnil; /* not reached */ + + UNREACHABLE; } 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)); - return Qnil; /* not reached */ + + UNREACHABLE; } /* diff --git a/variable.c b/variable.c index d3943dde5d..73e6e213f9 100644 --- a/variable.c +++ b/variable.c @@ -694,7 +694,8 @@ trace_ev(struct trace_data *data) (*trace->func)(trace->data, data->val); trace = trace->next; } - return Qnil; /* not reached */ + + return Qnil; } static VALUE @@ -1363,7 +1364,8 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name) break; } rb_name_error(id, "instance variable %s not defined", rb_id2name(id)); - return Qnil; /* not reached */ + + UNREACHABLE; } 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" */ uninitialized_constant(klass, rb_to_id(name)); - return Qnil; /* not reached */ + + UNREACHABLE; } 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_id2name(id), rb_class2name(mod)); - return Qnil; /* not reached */ + + UNREACHABLE; } VALUE @@ -496,7 +496,7 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj) { rb_thread_t *th = GET_THREAD(); raise_method_missing(th, argc, argv, obj, th->method_missing_reason); - return Qnil; /* not reached */ + UNREACHABLE; } #define NOEX_MISSING 0x80 @@ -1450,7 +1450,7 @@ rb_f_throw(int argc, VALUE *argv) rb_scan_args(argc, argv, "11", &tag, &value); rb_throw_obj(tag, value); - return Qnil; /* not reached */ + UNREACHABLE; } void diff --git a/vm_insnhelper.c b/vm_insnhelper.c index cd23429944..c5a3bd0ad4 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -431,7 +431,7 @@ call_cfunc(VALUE (*func)(), VALUE recv, break; default: rb_raise(rb_eArgError, "too many arguments(%d)", len); - return Qundef; /* not reached */ + UNREACHABLE; } } diff --git a/win32/win32.c b/win32/win32.c index e7dfa9d39b..782cb61773 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1079,8 +1079,8 @@ child_result(struct ChildRecord *child, int mode) GetExitCodeProcess(child->hProcess, &exitcode); CloseChildHandle(child); _exit(exitcode); - default: - return -1; /* not reached */ + default + UNREACHABLE; } } |