[前][次][番号順一覧][スレッド一覧]

ruby-changes:23271

From: drbrain <ko1@a...>
Date: Sat, 14 Apr 2012 09:37:46 +0900 (JST)
Subject: [ruby-changes:23271] drbrain:r35322 (trunk): * variable.c (trace_ev): Removed "not reached" comment as this line is

drbrain	2012-04-14 09:36:26 +0900 (Sat, 14 Apr 2012)

  New Revision: 35322

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35322

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c
    trunk/dir.c
    trunk/enum.c
    trunk/eval.c
    trunk/ext/-test-/iter/break.c
    trunk/ext/openssl/ossl_pkey.c
    trunk/ext/pty/pty.c
    trunk/ext/readline/readline.c
    trunk/ext/stringio/stringio.c
    trunk/file.c
    trunk/io.c
    trunk/numeric.c
    trunk/pack.c
    trunk/process.c
    trunk/ruby.c
    trunk/string.c
    trunk/struct.c
    trunk/variable.c
    trunk/vm_eval.c
    trunk/vm_insnhelper.c
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35321)
+++ ChangeLog	(revision 35322)
@@ -1,3 +1,43 @@
+Sat Apr 14 09:35:45 2012  Eric Hodel  <drbrain@s...>
+
+	* 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@s...>
 
 	* encoding.c (rb_enc_codepoint_len):  Use UNREACHABLE to avoid "control
Index: variable.c
===================================================================
--- variable.c	(revision 35321)
+++ variable.c	(revision 35322)
@@ -694,7 +694,8 @@
 	(*trace->func)(trace->data, data->val);
 	trace = trace->next;
     }
-    return Qnil;		/* not reached */
+
+    return Qnil;
 }
 
 static VALUE
@@ -1363,7 +1364,8 @@
 	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_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_name_error(id, "class variable %s not defined for %s",
 		  rb_id2name(id), rb_class2name(mod));
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 VALUE
Index: enum.c
===================================================================
--- enum.c	(revision 35321)
+++ enum.c	(revision 35322)
@@ -700,7 +700,8 @@
 
     memo->u1.value = i;
     rb_iter_break();
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 static VALUE enum_take(VALUE obj, VALUE n);
Index: string.c
===================================================================
--- string.c	(revision 35321)
+++ string.c	(revision 35322)
@@ -3186,7 +3186,8 @@
 	idx = NUM2LONG(indx);
 	goto num_index;
     }
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 
@@ -4092,7 +4093,8 @@
 	idx = NUM2LONG(indx);
 	goto num_index;
     }
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 /*
@@ -7764,7 +7766,8 @@
       case T_SYMBOL:
 	return SYM2ID(name);
     }
-    return Qnil; /* not reached */
+
+    UNREACHABLE;
 }
 
 /*
Index: io.c
===================================================================
--- io.c	(revision 35321)
+++ io.c	(revision 35322)
@@ -4448,7 +4448,8 @@
 	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 @@
 	return MODE_BINARY("r+", "rb+");
     }
     rb_raise(rb_eArgError, "invalid access oflags 0x%x", oflags);
-    return NULL;		/* not reached */
+
+    UNREACHABLE;
 }
 
 /*
Index: pack.c
===================================================================
--- pack.c	(revision 35321)
+++ pack.c	(revision 35322)
@@ -247,7 +247,8 @@
 	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
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 35321)
+++ vm_eval.c	(revision 35322)
@@ -496,7 +496,7 @@
 {
     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_scan_args(argc, argv, "11", &tag, &value);
     rb_throw_obj(tag, value);
-    return Qnil;		/* not reached */
+    UNREACHABLE;
 }
 
 void
Index: dir.c
===================================================================
--- dir.c	(revision 35321)
+++ dir.c	(revision 35322)
@@ -590,7 +590,8 @@
     else {
 	rb_sys_fail(0);
     }
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 /*
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 35321)
+++ win32/win32.c	(revision 35322)
@@ -1079,8 +1079,8 @@
 	GetExitCodeProcess(child->hProcess, &exitcode);
 	CloseChildHandle(child);
 	_exit(exitcode);
-      default:
-	return -1;	/* not reached */
+      default
+	UNREACHABLE;
     }
 }
 
Index: struct.c
===================================================================
--- struct.c	(revision 35321)
+++ struct.c	(revision 35322)
@@ -113,7 +113,8 @@
 	}
     }
     rb_name_error(id, "%s is not struct member", rb_id2name(id));
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 static VALUE
@@ -175,7 +176,8 @@
     }
     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_name_error(id, "no member '%s' in struct", rb_id2name(id));
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 /*
Index: eval.c
===================================================================
--- eval.c	(revision 35321)
+++ eval.c	(revision 35322)
@@ -516,7 +516,8 @@
 	}
     }
     rb_raise_jump(rb_make_exception(argc, argv));
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 static VALUE
Index: process.c
===================================================================
--- process.c	(revision 35321)
+++ process.c	(revision 35322)
@@ -2868,7 +2868,7 @@
     }
     _exit(istatus);
 
-    return Qnil;		/* not reached */
+    UNREACHABLE;
 }
 
 void
@@ -2941,7 +2941,8 @@
 	istatus = EXIT_SUCCESS;
     }
     rb_exit(istatus);
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 
@@ -2975,7 +2976,8 @@
 	args[0] = INT2NUM(EXIT_FAILURE);
 	rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
     }
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 void
Index: ext/-test-/iter/break.c
===================================================================
--- ext/-test-/iter/break.c	(revision 35321)
+++ ext/-test-/iter/break.c	(revision 35322)
@@ -4,7 +4,8 @@
 iter_break_value(VALUE self, VALUE val)
 {
     rb_iter_break_value(val);
-    return self;		/* not reached */
+
+    UNREACHABLE;
 }
 
 void
Index: ext/pty/pty.c
===================================================================
--- ext/pty/pty.c	(revision 35321)
+++ ext/pty/pty.c	(revision 35322)
@@ -687,7 +687,8 @@
 
     if (!RTEST(exc)) return rb_last_status_get();
     raise_from_check(cpid, status);
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 static VALUE cPTY;
Index: ext/readline/readline.c
===================================================================
--- ext/readline/readline.c	(revision 35321)
+++ ext/readline/readline.c	(revision 35322)
@@ -1379,7 +1379,8 @@
     return Qnil;
 #else
     rb_notimplement();
-    return Qnil; /* not reached */
+
+    UNREACHABLE;
 #endif
 }
 
Index: ext/openssl/ossl_pkey.c
===================================================================
--- ext/openssl/ossl_pkey.c	(revision 35321)
+++ ext/openssl/ossl_pkey.c	(revision 35322)
@@ -98,7 +98,8 @@
     default:
 	ossl_raise(ePKeyError, "unsupported key type");
     }
-    return Qnil; /* not reached */
+
+    UNREACHABLE;
 }
 
 VALUE
Index: ext/stringio/stringio.c
===================================================================
--- ext/stringio/stringio.c	(revision 35321)
+++ ext/stringio/stringio.c	(revision 35322)
@@ -287,7 +287,8 @@
 {
     StringIO(self);
     rb_notimplement();
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 /*
Index: numeric.c
===================================================================
--- numeric.c	(revision 35321)
+++ numeric.c	(revision 35322)
@@ -260,7 +260,8 @@
 	     "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 @@
 {
     /* 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 @@
 
       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 @@
 
       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 */
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 35321)
+++ vm_insnhelper.c	(revision 35322)
@@ -431,7 +431,7 @@
 	break;
       default:
 	rb_raise(rb_eArgError, "too many arguments(%d)", len);
-	return Qundef; /* not reached */
+	UNREACHABLE;
     }
 }
 
Index: bignum.c
===================================================================
--- bignum.c	(revision 35321)
+++ bignum.c	(revision 35322)
@@ -3674,8 +3674,8 @@
 	rb_raise(rb_eTypeError, "can't coerce %s to Bignum",
 		 rb_obj_classname(y));
     }
-    /* not reached */
-    return Qnil;
+
+    UNREACHABLE;
 }
 
 /*
Index: ruby.c
===================================================================
--- ruby.c	(revision 35321)
+++ ruby.c	(revision 35322)
@@ -1757,7 +1757,8 @@
       case Qtrue:
 	return INT2FIX(2);
     }
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 void
Index: file.c
===================================================================
--- file.c	(revision 35321)
+++ file.c	(revision 35322)
@@ -4387,7 +4387,8 @@
     else {
 	rb_raise(rb_eArgError, "unknown command \"\\x%02X\"", cmd);
     }
-    return Qnil;		/* not reached */
+
+    UNREACHABLE;
 }
 
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]