summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bignum.c2
-rw-r--r--dmydln.c2
-rw-r--r--enum.c2
-rw-r--r--eval.c2
-rw-r--r--ext/-test-/exception/enc_raise.c2
-rw-r--r--ext/-test-/iter/break.c4
-rw-r--r--ext/-test-/string/coderange.c2
-rw-r--r--ext/pty/pty.c2
-rw-r--r--ext/readline/readline.c2
-rw-r--r--ext/ripper/eventids2.c2
-rw-r--r--ext/socket/option.c4
-rw-r--r--ext/socket/raddrinfo.c2
-rw-r--r--ext/socket/socket.c2
-rw-r--r--include/ruby/ruby.h7
-rw-r--r--numeric.c2
-rw-r--r--pack.c2
-rw-r--r--proc.c2
-rw-r--r--process.c16
-rw-r--r--struct.c2
-rw-r--r--thread_sync.c2
-rw-r--r--variable.c4
-rw-r--r--vm_eval.c4
-rw-r--r--vm_method.c2
23 files changed, 40 insertions, 33 deletions
diff --git a/bignum.c b/bignum.c
index 7e5ce4d585..ee481e1bd7 100644
--- a/bignum.c
+++ b/bignum.c
@@ -7097,7 +7097,7 @@ rb_int_powm(int const argc, VALUE * const argv, VALUE const num)
return int_pow_tmp3(rb_int_modulo(a, m), b, m, nega_flg);
}
}
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
/*
diff --git a/dmydln.c b/dmydln.c
index 0fc0a5325e..d05cda0b8e 100644
--- a/dmydln.c
+++ b/dmydln.c
@@ -6,5 +6,5 @@ dln_load(const char *file)
{
rb_loaderror("this executable file can't load extension libraries");
- UNREACHABLE;
+ UNREACHABLE_RETURN(NULL);
}
diff --git a/enum.c b/enum.c
index 04b6c9cb95..293ddd4b54 100644
--- a/enum.c
+++ b/enum.c
@@ -938,7 +938,7 @@ first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, params))
MEMO_V1_SET(memo, i);
rb_iter_break();
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static VALUE enum_take(VALUE obj, VALUE n);
diff --git a/eval.c b/eval.c
index aff1b9021b..e777aa6e3b 100644
--- a/eval.c
+++ b/eval.c
@@ -728,7 +728,7 @@ rb_f_raise(int argc, VALUE *argv)
}
rb_raise_jump(rb_make_exception(argc, argv), *cause);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static VALUE
diff --git a/ext/-test-/exception/enc_raise.c b/ext/-test-/exception/enc_raise.c
index dc8a42cf3f..68d7b4ebc1 100644
--- a/ext/-test-/exception/enc_raise.c
+++ b/ext/-test-/exception/enc_raise.c
@@ -5,7 +5,7 @@ static VALUE
enc_raise(VALUE exc, VALUE encoding, VALUE mesg)
{
rb_enc_raise(rb_to_encoding(encoding), exc, "%s", StringValueCStr(mesg));
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
void
diff --git a/ext/-test-/iter/break.c b/ext/-test-/iter/break.c
index 66ed26a9b8..4d43c5d0cf 100644
--- a/ext/-test-/iter/break.c
+++ b/ext/-test-/iter/break.c
@@ -5,7 +5,7 @@ iter_break(VALUE self)
{
rb_iter_break();
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static VALUE
@@ -13,7 +13,7 @@ iter_break_value(VALUE self, VALUE val)
{
rb_iter_break_value(val);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
void
diff --git a/ext/-test-/string/coderange.c b/ext/-test-/string/coderange.c
index df83fb5d44..1342ce20da 100644
--- a/ext/-test-/string/coderange.c
+++ b/ext/-test-/string/coderange.c
@@ -17,7 +17,7 @@ coderange_int2sym(int coderange)
return sym_broken;
}
rb_bug("wrong condition of coderange");
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
/* return coderange without scan */
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 1ac89061c1..1a70bf7b61 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -665,7 +665,7 @@ pty_check(int argc, VALUE *argv, VALUE self)
if (!RTEST(exc)) return rb_last_status_get();
raise_from_check(cpid, status);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static VALUE cPTY;
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 10ff0cbacd..47df49ed1c 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -1756,7 +1756,7 @@ rb_remove_history(int index)
#else
rb_notimplement();
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
#endif
}
diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c
index 334d9f557b..e876e95ab3 100644
--- a/ext/ripper/eventids2.c
+++ b/ext/ripper/eventids2.c
@@ -303,5 +303,5 @@ ripper_token2eventid(int tok)
}
rb_raise(rb_eRuntimeError, "[Ripper FATAL] unknown token %d", tok);
- UNREACHABLE;
+ UNREACHABLE_RETURN(0);
}
diff --git a/ext/socket/option.c b/ext/socket/option.c
index bf3af171a2..5ad44cdcd8 100644
--- a/ext/socket/option.c
+++ b/ext/socket/option.c
@@ -424,7 +424,7 @@ sockopt_ipv4_multicast_loop(VALUE self)
}
#endif
rb_raise(rb_eTypeError, "ipv4_multicast_loop socket option expected");
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
#define inspect_ipv4_multicast_loop(a,b,c,d) \
@@ -475,7 +475,7 @@ sockopt_ipv4_multicast_ttl(VALUE self)
}
#endif
rb_raise(rb_eTypeError, "ipv4_multicast_ttl socket option expected");
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
#define inspect_ipv4_multicast_ttl(a,b,c,d) \
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c
index 41db6960ad..4c6a9b511c 100644
--- a/ext/socket/raddrinfo.c
+++ b/ext/socket/raddrinfo.c
@@ -2550,7 +2550,7 @@ rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len)
rb_raise(rb_eTypeError, "neither IO nor file descriptor");
}
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
/*
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 8846770097..ead3592d8a 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1381,7 +1381,7 @@ sock_s_getnameinfo(int argc, VALUE *argv)
errno = saved_errno;
rsock_raise_socket_error("getnameinfo", error);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
/*
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 81f3c691df..a654cddb7e 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -44,6 +44,13 @@ extern "C" {
# define ASSUME(x) ((void)(x))
# endif
#endif
+#ifndef UNREACHABLE_RETURN
+# ifdef UNREACHABLE
+# define UNREACHABLE_RETURN(val) UNREACHABLE
+# else
+# define UNREACHABLE_RETURN(val) return (val)
+# endif
+#endif
#ifndef UNREACHABLE
# define UNREACHABLE ((void)0) /* unreachable */
#endif
diff --git a/numeric.c b/numeric.c
index fe867f9fd3..090b5e57ba 100644
--- a/numeric.c
+++ b/numeric.c
@@ -487,7 +487,7 @@ num_sadded(VALUE x, VALUE name)
rb_id2str(mid),
rb_obj_class(x));
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
#if 0
diff --git a/pack.c b/pack.c
index 93577a9280..037a4a98bb 100644
--- a/pack.c
+++ b/pack.c
@@ -1936,7 +1936,7 @@ rb_uv_to_utf8(char buf[6], unsigned long uv)
}
rb_raise(rb_eRangeError, "pack(U): value out of range");
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static const unsigned long utf8_limits[] = {
diff --git a/proc.c b/proc.c
index 358672c018..9637ac5b4a 100644
--- a/proc.c
+++ b/proc.c
@@ -2336,7 +2336,7 @@ rb_method_entry_min_max_arity(const rb_method_entry_t *me, int *max)
return 0;
}
rb_bug("rb_method_entry_min_max_arity: invalid method entry type (%d)", def->type);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
int
diff --git a/process.c b/process.c
index 93c8544015..f0d1b87434 100644
--- a/process.c
+++ b/process.c
@@ -2896,7 +2896,7 @@ rb_f_exec(int argc, const VALUE *argv)
rb_exec_fail(eargp, err, errmsg);
RB_GC_GUARD(execarg_obj);
rb_syserr_fail_str(err, fail_str);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
#define ERRMSG(str) do { if (errmsg && 0 < errmsg_buflen) strlcpy(errmsg, (str), errmsg_buflen); } while (0)
@@ -4058,7 +4058,7 @@ rb_f_exit_bang(int argc, VALUE *argv, VALUE obj)
}
_exit(istatus);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
void
@@ -4129,7 +4129,7 @@ rb_f_exit(int argc, const VALUE *argv)
}
rb_exit(istatus);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
@@ -4166,7 +4166,7 @@ rb_f_abort(int argc, const VALUE *argv)
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
void
@@ -5154,7 +5154,7 @@ rlimit_resource_type(VALUE rtype)
rb_raise(rb_eArgError, "invalid resource name: % "PRIsVALUE, rtype);
- UNREACHABLE;
+ UNREACHABLE_RETURN(-1);
}
static rlim_t
@@ -5195,7 +5195,7 @@ rlimit_resource_value(VALUE rval)
#endif
rb_raise(rb_eArgError, "invalid resource value: %"PRIsVALUE, rval);
- UNREACHABLE;
+ UNREACHABLE_RETURN((rlim_t)-1);
}
#endif
@@ -7034,7 +7034,7 @@ p_uid_switch(VALUE obj)
rb_syserr_fail(EPERM, 0);
}
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
#else
static VALUE
@@ -7147,7 +7147,7 @@ p_gid_switch(VALUE obj)
rb_syserr_fail(EPERM, 0);
}
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
#else
static VALUE
diff --git a/struct.c b/struct.c
index cf28fec6fd..7de46980aa 100644
--- a/struct.c
+++ b/struct.c
@@ -217,7 +217,7 @@ rb_struct_getmember(VALUE obj, ID id)
}
rb_name_err_raise("`%1$s' is not a struct member", obj, ID2SYM(id));
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static VALUE rb_struct_ref0(VALUE obj) {return RSTRUCT_GET(obj, 0);}
diff --git a/thread_sync.c b/thread_sync.c
index b2b7d05088..1624c470a5 100644
--- a/thread_sync.c
+++ b/thread_sync.c
@@ -1423,7 +1423,7 @@ static VALUE
undumpable(VALUE obj)
{
rb_raise(rb_eTypeError, "can't dump %"PRIsVALUE, rb_obj_class(obj));
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static VALUE
diff --git a/variable.c b/variable.c
index 96073df903..383fab3143 100644
--- a/variable.c
+++ b/variable.c
@@ -1734,7 +1734,7 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name)
not_defined:
rb_name_err_raise("instance variable %1$s not defined",
obj, name);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
NORETURN(static void uninitialized_constant(VALUE, VALUE));
@@ -1805,7 +1805,7 @@ rb_mod_const_missing(VALUE klass, VALUE name)
}
uninitialized_constant(klass, name);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static void
diff --git a/vm_eval.c b/vm_eval.c
index df93d000dd..c726c61f0b 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -636,7 +636,7 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj)
{
rb_execution_context_t *ec = GET_EC();
raise_method_missing(ec, argc, argv, obj, ec->method_missing_reason);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
MJIT_FUNC_EXPORTED VALUE
@@ -1851,7 +1851,7 @@ rb_f_throw(int argc, VALUE *argv)
rb_scan_args(argc, argv, "11", &tag, &value);
rb_throw_obj(tag, value);
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
void
diff --git a/vm_method.c b/vm_method.c
index f76d176d2c..6a829ca23f 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -118,7 +118,7 @@ rb_f_notimplement(int argc, const VALUE *argv, VALUE obj)
{
rb_notimplement();
- UNREACHABLE;
+ UNREACHABLE_RETURN(Qnil);
}
static void