Permalink
Browse files

* 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
  • Loading branch information...
1 parent da39d32 commit e95f7ea80d096cf27ea0ae5f7dc712ad72e71f3c @drbrain drbrain committed Apr 14, 2012
Showing with 110 additions and 39 deletions.
  1. +40 −0 ChangeLog
  2. +2 −2 bignum.c
  3. +2 −1 dir.c
  4. +2 −1 enum.c
  5. +2 −1 eval.c
  6. +2 −1 ext/-test-/iter/break.c
  7. +2 −1 ext/openssl/ossl_pkey.c
  8. +2 −1 ext/pty/pty.c
  9. +2 −1 ext/readline/readline.c
  10. +2 −1 ext/stringio/stringio.c
  11. +2 −1 file.c
  12. +4 −2 io.c
  13. +12 −6 numeric.c
  14. +2 −1 pack.c
  15. +5 −3 process.c
  16. +2 −1 ruby.c
  17. +6 −3 string.c
  18. +6 −3 struct.c
  19. +8 −4 variable.c
  20. +2 −2 vm_eval.c
  21. +1 −1 vm_insnhelper.c
  22. +2 −2 win32/win32.c
View
@@ -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
View
@@ -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;
}
/*
View
3 dir.c
@@ -590,7 +590,8 @@ dir_read(VALUE dir)
else {
rb_sys_fail(0);
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
/*
View
3 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);
View
3 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
View
@@ -4,7 +4,8 @@ static VALUE
iter_break_value(VALUE self, VALUE val)
{
rb_iter_break_value(val);
- return self; /* not reached */
+
+ UNREACHABLE;
}
void
View
@@ -98,7 +98,8 @@ ossl_pkey_new(EVP_PKEY *pkey)
default:
ossl_raise(ePKeyError, "unsupported key type");
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
VALUE
View
@@ -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;
View
@@ -1379,7 +1379,8 @@ rb_remove_history(int index)
return Qnil;
#else
rb_notimplement();
- return Qnil; /* not reached */
+
+ UNREACHABLE;
#endif
}
View
@@ -287,7 +287,8 @@ strio_unimpl(int argc, VALUE *argv, VALUE self)
{
StringIO(self);
rb_notimplement();
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
/*
View
3 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;
}
View
6 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;
}
/*
View
@@ -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 */
View
3 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
View
@@ -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
View
3 ruby.c
@@ -1757,7 +1757,8 @@ opt_W_getter(ID id, void *data)
case Qtrue:
return INT2FIX(2);
}
- return Qnil; /* not reached */
+
+ UNREACHABLE;
}
void
View
@@ -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;
}
/*
View
@@ -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;
}
/*
View
@@ -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
View
@@ -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
Oops, something went wrong.

0 comments on commit e95f7ea

Please sign in to comment.