From da39d32f60778b111c6cf063ae74e2627be14b77 Mon Sep 17 00:00:00 2001 From: drbrain Date: Fri, 13 Apr 2012 23:45:37 +0000 Subject: [PATCH] * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control reaches end of non-void function" warnings. [ruby-trunk - Bug #6066] * re.c (name_to_backref_number): ditto. * object.c (rb_Float): ditto. * io.c (io_readpartial): ditto. * io.c (io_read_nonblock): ditto. * pack.c (rb_uv_to_utf8): ditto. * proc.c (rb_method_entry_arity): ditto. * vm_method.c (rb_f_notimplement): ditto. * struct.c (rb_struct_aset_id): ditto. * class.c (rb_scan_args): ditto. * process.c (rlimit_resource_type): ditto. * process.c (rlimit_resource_value): ditto. * process.c (p_uid_switch): ditto. * process.c (p_gid_switch): ditto. * ext/digest/digest.c (rb_digest_instance_update): ditto. * ext/digest/digest.c (rb_digest_instance_finish): ditto. * ext/digest/digest.c (rb_digest_instance_reset): ditto. * ext/digest/digest.c (rb_digest_instance_block_length): ditto. * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto. * ext/dl/handle.c (rb_dlhandle_close): ditto. * ext/tk/tcltklib.c (pending_exception_check0): ditto. * ext/tk/tcltklib.c (pending_exception_check1): ditto. * ext/tk/tcltklib.c (ip_cancel_eval_core): ditto. * ext/tk/tcltklib.c (lib_get_reltype_name): ditto. * ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto. * ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto. * ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto. * ext/fiddle/conversions.c (generic_to_value): ditto. * ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto. * ext/socket/socket.c (sock_s_getnameinfo): ditto. * ext/ripper/eventids2.c (ripper_token2eventid): ditto. * cont.c (return_fiber): ditto. * dmydln.c (dln_load): ditto. * vm_insnhelper.c (vm_search_normal_superclass): ditto. * bignum.c (big_fdiv): ditto. * marshal.c (r_symlink): ditto. * marshal.c (r_symbol): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 44 +++++++++++++++++++++++++++++++++++++ bignum.c | 3 ++- class.c | 2 ++ cont.c | 2 ++ dmydln.c | 2 ++ encoding.c | 2 ++ ext/bigdecimal/bigdecimal.c | 2 ++ ext/digest/digest.c | 8 +++++++ ext/dl/handle.c | 2 ++ ext/fiddle/conversions.c | 2 ++ ext/openssl/ossl_pkey_ec.c | 6 +++++ ext/openssl/ossl_ssl.c | 2 ++ ext/ripper/eventids2.c | 2 ++ ext/socket/raddrinfo.c | 2 ++ ext/socket/socket.c | 2 ++ ext/tk/tcltklib.c | 10 +++++++++ ext/tk/tkutil/tkutil.c | 2 ++ io.c | 4 ++++ marshal.c | 4 ++++ object.c | 2 ++ pack.c | 2 ++ proc.c | 2 ++ process.c | 8 +++++++ re.c | 2 ++ struct.c | 2 ++ vm_insnhelper.c | 2 ++ vm_method.c | 2 ++ 27 files changed, 124 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ba22e42bd38480..037127b6b07c67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +Sat Apr 14 08:38:20 2012 Eric Hodel + + * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control + reaches end of non-void function" warnings. [ruby-trunk - Bug #6066] + * re.c (name_to_backref_number): ditto. + * object.c (rb_Float): ditto. + * io.c (io_readpartial): ditto. + * io.c (io_read_nonblock): ditto. + * pack.c (rb_uv_to_utf8): ditto. + * proc.c (rb_method_entry_arity): ditto. + * vm_method.c (rb_f_notimplement): ditto. + * struct.c (rb_struct_aset_id): ditto. + * class.c (rb_scan_args): ditto. + * process.c (rlimit_resource_type): ditto. + * process.c (rlimit_resource_value): ditto. + * process.c (p_uid_switch): ditto. + * process.c (p_gid_switch): ditto. + * ext/digest/digest.c (rb_digest_instance_update): ditto. + * ext/digest/digest.c (rb_digest_instance_finish): ditto. + * ext/digest/digest.c (rb_digest_instance_reset): ditto. + * ext/digest/digest.c (rb_digest_instance_block_length): ditto. + * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto. + * ext/dl/handle.c (rb_dlhandle_close): ditto. + * ext/tk/tcltklib.c (pending_exception_check0): ditto. + * ext/tk/tcltklib.c (pending_exception_check1): ditto. + * ext/tk/tcltklib.c (ip_cancel_eval_core): ditto. + * ext/tk/tcltklib.c (lib_get_reltype_name): ditto. + * ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto. + * ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto. + * ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto. + * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto. + * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto. + * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto. + * ext/fiddle/conversions.c (generic_to_value): ditto. + * ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto. + * ext/socket/socket.c (sock_s_getnameinfo): ditto. + * ext/ripper/eventids2.c (ripper_token2eventid): ditto. + * cont.c (return_fiber): ditto. + * dmydln.c (dln_load): ditto. + * vm_insnhelper.c (vm_search_normal_superclass): ditto. + * bignum.c (big_fdiv): ditto. + * marshal.c (r_symlink): ditto. + * marshal.c (r_symbol): ditto. + Fri Apr 13 17:12:09 2012 NARUSE, Yui * hash.c (inspect_i): keep string's coderange. diff --git a/bignum.c b/bignum.c index 678a65bba721e0..9966b64aa0527b 100644 --- a/bignum.c +++ b/bignum.c @@ -3001,7 +3001,8 @@ big_fdiv(VALUE x, VALUE y) goto bignum; } rb_bug("big_fdiv"); - /* NOTREACHED */ + + UNREACHABLE; } /* diff --git a/class.c b/class.c index a34a3bd930bbbe..8dc2f2eb5c929c 100644 --- a/class.c +++ b/class.c @@ -1656,6 +1656,8 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...) argc_error: rb_error_arity(argc, n_mand, f_var ? UNLIMITED_ARGUMENTS : n_mand + n_opt); + + UNREACHABLE; } /*! diff --git a/cont.c b/cont.c index 314340ec3710e7..256ae378ba3153 100644 --- a/cont.c +++ b/cont.c @@ -1110,6 +1110,8 @@ return_fiber(void) fib->prev = Qnil; return prev; } + + UNREACHABLE; } VALUE rb_fiber_transfer(VALUE fib, int argc, VALUE *argv); diff --git a/dmydln.c b/dmydln.c index 2c8aacc06a1aab..25872efc982d44 100644 --- a/dmydln.c +++ b/dmydln.c @@ -4,4 +4,6 @@ void* dln_load(const char *file) { rb_loaderror("this executable file can't load extension libraries"); + + UNREACHABLE; } diff --git a/encoding.c b/encoding.c index 1d82d4d3c491aa..f2506b3412f695 100644 --- a/encoding.c +++ b/encoding.c @@ -928,6 +928,8 @@ rb_enc_codepoint_len(const char *p, const char *e, int *len_p, rb_encoding *enc) } else rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(enc)); + + UNREACHABLE; } #undef rb_enc_codepoint diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 3fbb9a88835ef3..041d33fd7d043b 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -971,6 +971,8 @@ BigDecimalCmp(VALUE self, VALUE r,char op) } rb_bug("Undefined operation in BigDecimalCmp()"); + + UNREACHABLE; } /* Returns True if the value is zero. */ diff --git a/ext/digest/digest.c b/ext/digest/digest.c index 956f47ff78c0f1..4d185a8e5df667 100644 --- a/ext/digest/digest.c +++ b/ext/digest/digest.c @@ -154,6 +154,8 @@ static VALUE rb_digest_instance_update(VALUE self, VALUE str) { rb_digest_instance_method_unimpl(self, "update"); + + UNREACHABLE; } /* @@ -172,6 +174,8 @@ static VALUE rb_digest_instance_finish(VALUE self) { rb_digest_instance_method_unimpl(self, "finish"); + + UNREACHABLE; } /* @@ -186,6 +190,8 @@ static VALUE rb_digest_instance_reset(VALUE self) { rb_digest_instance_method_unimpl(self, "reset"); + + UNREACHABLE; } /* @@ -409,6 +415,8 @@ static VALUE rb_digest_instance_block_length(VALUE self) { rb_digest_instance_method_unimpl(self, "block_length"); + + UNREACHABLE; } /* diff --git a/ext/dl/handle.c b/ext/dl/handle.c index 2037ab5760f580..ef182e816fc971 100644 --- a/ext/dl/handle.c +++ b/ext/dl/handle.c @@ -78,6 +78,8 @@ rb_dlhandle_close(VALUE self) return INT2NUM(ret); } rb_raise(rb_eDLError, "dlclose() called too many times"); + + UNREACHABLE; } VALUE diff --git a/ext/fiddle/conversions.c b/ext/fiddle/conversions.c index f2c15117787e62..d40ddc1f38fa35 100644 --- a/ext/fiddle/conversions.c +++ b/ext/fiddle/conversions.c @@ -134,6 +134,8 @@ generic_to_value(VALUE rettype, fiddle_generic retval) default: rb_raise(rb_eRuntimeError, "unknown type %d", type); } + + UNREACHABLE; } /* vim: set noet sw=4 sts=4 */ diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index 9f1050f62d9dfb..cfcaf97ab51b45 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -700,6 +700,8 @@ static VALUE ossl_ec_key_dsa_verify_asn1(VALUE self, VALUE data, VALUE sig) } ossl_raise(eECError, "ECDSA_verify"); + + UNREACHABLE; } static void ossl_ec_group_free(ossl_ec_group *ec_group) @@ -1349,6 +1351,8 @@ static VALUE ossl_ec_point_is_at_infinity(VALUE self) case 0: return Qfalse; default: ossl_raise(cEC_POINT, "EC_POINT_is_at_infinity"); } + + UNREACHABLE; } /* @@ -1370,6 +1374,8 @@ static VALUE ossl_ec_point_is_on_curve(VALUE self) case 0: return Qfalse; default: ossl_raise(cEC_POINT, "EC_POINT_is_on_curve"); } + + UNREACHABLE; } /* diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index c55b7796f70225..79941db1ee0b10 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -1593,6 +1593,8 @@ ossl_ssl_session_reused(VALUE self) case 0: return Qfalse; default: ossl_raise(eSSLError, "SSL_session_reused"); } + + UNREACHABLE; } /* diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c index 946978954a6115..18d2d2a28a4e82 100644 --- a/ext/ripper/eventids2.c +++ b/ext/ripper/eventids2.c @@ -275,4 +275,6 @@ ripper_token2eventid(int tok) return ripper_id_CHAR; } rb_raise(rb_eRuntimeError, "[Ripper FATAL] unknown token %d", tok); + + UNREACHABLE; } diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index a9a4535741b983..f71d0f9c655b61 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -2144,6 +2144,8 @@ rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len) default: rb_raise(rb_eTypeError, "neither IO nor file descriptor"); } + + UNREACHABLE; } /* diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 872dd65b85f40f..d2177e505dad2a 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1334,6 +1334,8 @@ sock_s_getnameinfo(int argc, VALUE *argv) error_exit_name: if (res) freeaddrinfo(res); rsock_raise_socket_error("getnameinfo", error); + + UNREACHABLE; } /* diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index e3c5ea0c79fe52..02571d62fba491 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -1407,6 +1407,8 @@ pending_exception_check0() } else { return 0; } + + UNREACHABLE; } static int @@ -1448,6 +1450,8 @@ pending_exception_check1(thr_crit_bup, ptr) } else { return 0; } + + UNREACHABLE; } @@ -7781,6 +7785,8 @@ ip_cancel_eval_core(interp, msg, flag) #if TCL_MAJOR_VERSION < 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 6) rb_raise(rb_eNotImpError, "cancel_eval is supported Tcl/Tk8.6 or later."); + + UNREACHABLE; #else Tcl_Obj *msg_obj; @@ -10014,6 +10020,8 @@ lib_get_reltype_name(self) default: rb_raise(rb_eRuntimeError, "tcltklib has invalid release type number"); } + + UNREACHABLE; } @@ -10117,6 +10125,8 @@ create_dummy_encoding_for_tk_core(interp, name, error_mode) return Qnil; } } + + UNREACHABLE; #else return name; #endif diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c index 956c6737c9e7e6..0e256921ba14c7 100644 --- a/ext/tk/tkutil/tkutil.c +++ b/ext/tk/tkutil/tkutil.c @@ -800,6 +800,8 @@ tk_hash_kv(argc, argv, self) } rb_raise(rb_eArgError, "Hash is expected for 1st argument"); } + + UNREACHABLE; } static VALUE diff --git a/io.c b/io.c index f0c851519fd4f2..6b2e6da3f32aba 100644 --- a/io.c +++ b/io.c @@ -2338,6 +2338,8 @@ io_readpartial(int argc, VALUE *argv, VALUE io) rb_eof_error(); else return ret; + + UNREACHABLE; } /* @@ -2399,6 +2401,8 @@ io_read_nonblock(int argc, VALUE *argv, VALUE io) rb_eof_error(); else return ret; + + UNREACHABLE; } /* diff --git a/marshal.c b/marshal.c index dee1891106fe96..362cfa544d7738 100644 --- a/marshal.c +++ b/marshal.c @@ -1147,6 +1147,8 @@ r_symlink(struct load_arg *arg) return (ID)id; } rb_raise(rb_eArgError, "bad symbol"); + + UNREACHABLE; } static ID @@ -1193,6 +1195,8 @@ r_symbol(struct load_arg *arg) rb_raise(rb_eArgError, "dump format error for symbol(0x%x)", type); break; } + + UNREACHABLE; } static VALUE diff --git a/object.c b/object.c index d43095d8c38dce..59bdea0c18856d 100644 --- a/object.c +++ b/object.c @@ -2483,6 +2483,8 @@ rb_Float(VALUE val) default: return rb_convert_type(val, T_FLOAT, "Float", "to_f"); } + + UNREACHABLE; } /* diff --git a/pack.c b/pack.c index 4a2d2461745747..26c00f4b82822c 100644 --- a/pack.c +++ b/pack.c @@ -2199,6 +2199,8 @@ rb_uv_to_utf8(char buf[6], unsigned long uv) return 6; } rb_raise(rb_eRangeError, "pack(U): value out of range"); + + UNREACHABLE; } static const unsigned long utf8_limits[] = { diff --git a/proc.c b/proc.c index 8dcdf8fc3a9ffb..d44e8d8ab928f7 100644 --- a/proc.c +++ b/proc.c @@ -1663,6 +1663,8 @@ rb_method_entry_arity(const rb_method_entry_t *me) } } rb_bug("rb_method_entry_arity: invalid method entry type (%d)", def->type); + + UNREACHABLE; } /* diff --git a/process.c b/process.c index 7735ecb2cccecf..04ce3fb1d07d00 100644 --- a/process.c +++ b/process.c @@ -3829,6 +3829,8 @@ rlimit_resource_type(VALUE rtype) return r; rb_raise(rb_eArgError, "invalid resource name: %s", name); + + UNREACHABLE; } static rlim_t @@ -3867,6 +3869,8 @@ rlimit_resource_value(VALUE rval) if (strcmp(name, "SAVED_CUR") == 0) return RLIM_SAVED_CUR; #endif rb_raise(rb_eArgError, "invalid resource value: %s", name); + + UNREACHABLE; } #endif @@ -5690,6 +5694,8 @@ p_uid_switch(VALUE obj) errno = EPERM; rb_sys_fail(0); } + + UNREACHABLE; } #else static VALUE @@ -5803,6 +5809,8 @@ p_gid_switch(VALUE obj) errno = EPERM; rb_sys_fail(0); } + + UNREACHABLE; } #else static VALUE diff --git a/re.c b/re.c index e24050cfab6766..590e9b0fb0005f 100644 --- a/re.c +++ b/re.c @@ -1665,6 +1665,8 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name rb_raise(rb_eIndexError, "undefined group name reference: %s", StringValuePtr(s)); } + + UNREACHABLE; } /* diff --git a/struct.c b/struct.c index 042932d6aff50b..e123c618c7a6d8 100644 --- a/struct.c +++ b/struct.c @@ -681,6 +681,8 @@ rb_struct_aset_id(VALUE s, ID id, VALUE val) } } rb_name_error(id, "no member '%s' in struct", rb_id2name(id)); + + UNREACHABLE; } /* diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 68c2a2eae3e19f..cd234299446e2a 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1462,6 +1462,8 @@ vm_search_normal_superclass(VALUE klass, VALUE recv) else { rb_bug("vm_search_normal_superclass: should not be reach here"); } + + UNREACHABLE; } static void diff --git a/vm_method.c b/vm_method.c index 6bb8e6c7094617..953e509769958a 100644 --- a/vm_method.c +++ b/vm_method.c @@ -66,6 +66,8 @@ VALUE rb_f_notimplement(int argc, VALUE *argv, VALUE obj) { rb_notimplement(); + + UNREACHABLE; } static void