diff options
author | 卜部昌平 <[email protected]> | 2020-06-24 16:23:59 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-06-29 11:05:41 +0900 |
commit | de3e931df7abdc3ee22dbb7543e86af6d00ee899 (patch) | |
tree | 63f8471b59282d2ca5e7af0282f34d9cfef14ee1 /object.c | |
parent | c8dc2bf1401fc01d35a4a7587ed224f1f2fe29e6 (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3247
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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; |