From de3e931df7abdc3ee22dbb7543e86af6d00ee899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Wed, 24 Jun 2020 16:23:59 +0900 Subject: add UNREACHABLE_RETURN Not every compilers understand that rb_raise does not return. When a function does not end with a return statement, such compilers can issue warnings. We would better tell them about reachabilities. --- object.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'object.c') diff --git a/object.c b/object.c index fd7d02ba0d..c4a0d3c7ee 100644 --- a/object.c +++ b/object.c @@ -2574,6 +2574,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) wrong_name: rb_name_err_raise(wrong_constant_name, mod, name); + UNREACHABLE_RETURN(Qundef); } /* @@ -2752,6 +2753,7 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod) wrong_name: rb_name_err_raise(wrong_constant_name, mod, name); + UNREACHABLE_RETURN(Qundef); } /* @@ -2904,6 +2906,7 @@ rb_mod_const_source_location(int argc, VALUE *argv, VALUE mod) wrong_name: rb_name_err_raise(wrong_constant_name, mod, name); + UNREACHABLE_RETURN(Qundef); } /* @@ -3607,8 +3610,10 @@ rb_cstr_to_dbl_raise(const char *p, int badcheck, int raise, int *error) return d; bad: - if (raise) + if (raise) { rb_invalid_str(q, "Float()"); + UNREACHABLE_RETURN(nan("")); + } else { if (error) *error = 1; return 0.0; -- cgit v1.2.3