summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-14 00:36:26 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-14 00:36:26 +0000
commite95f7ea80d096cf27ea0ae5f7dc712ad72e71f3c (patch)
treec2550b798f6f44c9b0aef99617c8dca47ca55420
parentda39d32f60778b111c6cf063ae74e2627be14b77 (diff)
downloadruby-e95f7ea80d096cf27ea0ae5f7dc712ad72e71f3c.tar.gz
* 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
-rw-r--r--ChangeLog40
-rw-r--r--bignum.c4
-rw-r--r--dir.c3
-rw-r--r--enum.c3
-rw-r--r--eval.c3
-rw-r--r--ext/-test-/iter/break.c3
-rw-r--r--ext/openssl/ossl_pkey.c3
-rw-r--r--ext/pty/pty.c3
-rw-r--r--ext/readline/readline.c3
-rw-r--r--ext/stringio/stringio.c3
-rw-r--r--file.c3
-rw-r--r--io.c6
-rw-r--r--numeric.c18
-rw-r--r--pack.c3
-rw-r--r--process.c8
-rw-r--r--ruby.c3
-rw-r--r--string.c9
-rw-r--r--struct.c9
-rw-r--r--variable.c12
-rw-r--r--vm_eval.c4
-rw-r--r--vm_insnhelper.c2
-rw-r--r--win32/win32.c4
22 files changed, 110 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 037127b6b0..29cdac877d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/bignum.c b/bignum.c
index 9966b64aa0..9d09098f29 100644
--- a/bignum.c
+++ b/bignum.c
@@ -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;
}
/*
diff --git a/dir.c b/dir.c
index b0a1d9eaf5..e2304a69f4 100644
--- a/dir.c
+++ b/dir.c
@@ -590,7 +590,8 @@ dir_read(VALUE dir)
else {
rb_sys_fail(0);
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
/*
diff --git a/enum.c b/enum.c
index 24db7b23f1..9e999a8f51 100644
--- a/enum.c
+++ b/enum.c
@@ -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);
diff --git a/eval.c b/eval.c
index 43ddb4197c..4dddcaa690 100644
--- a/eval.c
+++ b/eval.c
@@ -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;
}
/*
diff --git a/file.c b/file.c
index 57d596027a..1c31086d26 100644
--- a/file.c
+++ b/file.c
@@ -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;
}
diff --git a/io.c b/io.c
index 6b2e6da3f3..bf7db693c9 100644
--- a/io.c
+++ b/io.c
@@ -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;
}
/*
diff --git a/numeric.c b/numeric.c
index 7371236426..03abf6db8f 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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 */
diff --git a/pack.c b/pack.c
index 26c00f4b82..354eb0f9e3 100644
--- a/pack.c
+++ b/pack.c
@@ -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
diff --git a/process.c b/process.c
index 04ce3fb1d0..c5e6eb72bf 100644
--- a/process.c
+++ b/process.c
@@ -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
diff --git a/ruby.c b/ruby.c
index d6f0432f3a..31385e4310 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1757,7 +1757,8 @@ opt_W_getter(ID id, void *data)
case Qtrue:
return INT2FIX(2);
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
void
diff --git a/string.c b/string.c
index 21fbbda868..6569215d17 100644
--- a/string.c
+++ b/string.c
@@ -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;
}
/*
diff --git a/struct.c b/struct.c
index e123c618c7..7fa50f14ee 100644
--- a/struct.c
+++ b/struct.c
@@ -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
diff --git a/vm_eval.c b/vm_eval.c
index 3487f2026f..6c26b97f92 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -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;
}
}