ruby-changes:61184
From: Nobuyoshi <ko1@a...>
Date: Mon, 11 May 2020 02:25:31 +0900 (JST)
Subject: [ruby-changes:61184] 5d430c1b34 (master): Added more NORETURN declarations
https://git.ruby-lang.org/ruby.git/commit/?id=5d430c1b34 From 5d430c1b34b6162d4cfbd472fae09e6ea282f3a3 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 11 May 2020 00:24:14 +0900 Subject: Added more NORETURN declarations diff --git a/compile.c b/compile.c index 97548b4..6f5569f 100644 --- a/compile.c +++ b/compile.c @@ -10856,11 +10856,13 @@ ibf_dump_object_unsupported(struct ibf_dump *dump, VALUE obj) https://github.com/ruby/ruby/blob/trunk/compile.c#L10856 rb_raise(rb_eNotImpError, "ibf_dump_object_unsupported: %s", buff); } +NORETURN(static VALUE ibf_load_object_unsupported(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)); + static VALUE ibf_load_object_unsupported(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset) { rb_raise(rb_eArgError, "unsupported"); - return Qnil; + UNREACHABLE_RETURN(Qnil); } static void diff --git a/cont.c b/cont.c index ac761ac..38a1be1 100644 --- a/cont.c +++ b/cont.c @@ -1610,6 +1610,8 @@ rollback_ensure_stack(VALUE self,rb_ensure_list_t *current,rb_ensure_entry_t *ta https://github.com/ruby/ruby/blob/trunk/cont.c#L1610 } } +NORETURN(static VALUE rb_cont_call(int argc, VALUE *argv, VALUE contval)); + /* * call-seq: * cont.call(args, ...) @@ -1648,7 +1650,7 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval) https://github.com/ruby/ruby/blob/trunk/cont.c#L1650 cont->value = make_passing_arg(argc, argv); cont_restore_0(cont, &contval); - return Qnil; /* unreachable */ + UNREACHABLE_RETURN(Qnil); } /*********/ diff --git a/dir.c b/dir.c index 7860964..5c12cd2 100644 --- a/dir.c +++ b/dir.c @@ -1966,13 +1966,15 @@ rb_glob_warning(const char *path, VALUE a, const void *enc, int error) https://github.com/ruby/ruby/blob/trunk/dir.c#L1966 } #endif +NORETURN(static VALUE glob_func_error(VALUE val)); + static VALUE glob_func_error(VALUE val) { struct glob_error_args *arg = (struct glob_error_args *)val; VALUE path = rb_enc_str_new_cstr(arg->path, arg->enc); rb_syserr_fail_str(arg->error, path); - return Qnil; + UNREACHABLE_RETURN(Qnil); } static int diff --git a/encoding.c b/encoding.c index e20235f..da2811e 100644 --- a/encoding.c +++ b/encoding.c @@ -1302,12 +1302,13 @@ enc_compatible_p(VALUE klass, VALUE str1, VALUE str2) https://github.com/ruby/ruby/blob/trunk/encoding.c#L1302 return rb_enc_from_encoding(enc); } +NORETURN(static VALUE enc_s_alloc(VALUE klass)); /* :nodoc: */ static VALUE enc_s_alloc(VALUE klass) { rb_undefined_alloc(klass); - return Qnil; + UNREACHABLE_RETURN(Qnil); } /* :nodoc: */ diff --git a/enum.c b/enum.c index 867eec8..89bbd50 100644 --- a/enum.c +++ b/enum.c @@ -1021,6 +1021,7 @@ enum_tally(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enum.c#L1021 return enum_hashify(obj, 0, 0, tally_i); } +NORETURN(static VALUE first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, params))); static VALUE first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, params)) { diff --git a/enumerator.c b/enumerator.c index cc0cce8..c2fde9a 100644 --- a/enumerator.c +++ b/enumerator.c @@ -2676,7 +2676,8 @@ lazy_with_index_proc(VALUE proc_entry, struct MEMO* result, VALUE memos, long me https://github.com/ruby/ruby/blob/trunk/enumerator.c#L2676 if (entry->proc) { rb_proc_call_with_block(entry->proc, 2, argv, Qnil); LAZY_MEMO_RESET_PACKED(result); - } else { + } + else { LAZY_MEMO_SET_VALUE(result, rb_ary_new_from_values(2, argv)); LAZY_MEMO_SET_PACKED(result); } @@ -2931,6 +2932,8 @@ producer_each_stop(VALUE dummy, VALUE exc) https://github.com/ruby/ruby/blob/trunk/enumerator.c#L2932 return rb_attr_get(exc, id_result); } +NORETURN(static VALUE producer_each_i(VALUE obj)); + static VALUE producer_each_i(VALUE obj) { @@ -2943,7 +2946,8 @@ producer_each_i(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enumerator.c#L2946 if (init == Qundef) { curr = Qnil; - } else { + } + else { rb_yield(init); curr = init; } @@ -2953,7 +2957,7 @@ producer_each_i(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enumerator.c#L2957 rb_yield(curr); } - return Qnil; + UNREACHABLE_RETURN(Qnil); } /* :nodoc: */ diff --git a/gc.c b/gc.c index ab75d67..b05b296 100644 --- a/gc.c +++ b/gc.c @@ -968,6 +968,8 @@ void rb_gcdebug_print_obj_condition(VALUE obj); https://github.com/ruby/ruby/blob/trunk/gc.c#L968 static VALUE define_final0(VALUE obj, VALUE block); +NORETURN(static void *gc_vraise(void *ptr)); +NORETURN(static void gc_raise(VALUE exc, const char *fmt, ...)); NORETURN(static void negative_size_allocation_error(const char *)); static void init_mark_stack(mark_stack_t *stack); diff --git a/hash.c b/hash.c index ab6dd3b..8b6ea34 100644 --- a/hash.c +++ b/hash.c @@ -6328,6 +6328,7 @@ env_reject(VALUE _) https://github.com/ruby/ruby/blob/trunk/hash.c#L6328 return rb_hash_delete_if(env_to_hash()); } +NORETURN(static VALUE env_freeze(VALUE self)); /* * call-seq: * ENV.freeze @@ -6339,7 +6340,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/hash.c#L6340 env_freeze(VALUE self) { rb_raise(rb_eTypeError, "cannot freeze ENV"); - return self; /* Not reached */ + UNREACHABLE_RETURN(self); } /* diff --git a/numeric.c b/numeric.c index e0729a2..671b95c 100644 --- a/numeric.c +++ b/numeric.c @@ -479,6 +479,8 @@ rb_num_coerce_relop(VALUE x, VALUE y, ID func) https://github.com/ruby/ruby/blob/trunk/numeric.c#L479 return c; } +NORETURN(static VALUE num_sadded(VALUE x, VALUE name)); + /* * :nodoc: * diff --git a/process.c b/process.c index 7ec3b54..161b34d 100644 --- a/process.c +++ b/process.c @@ -2931,6 +2931,8 @@ rb_f_exec(int argc, const VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L2931 UNREACHABLE_RETURN(Qnil); } +NORETURN(static VALUE f_exec(int c, const VALUE *a, VALUE _)); + /* * call-seq: * exec([env,] command... [,options]) @@ -3007,7 +3009,8 @@ rb_f_exec(int argc, const VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L3009 static VALUE f_exec(int c, const VALUE *a, VALUE _) { - return rb_f_exec(c, a); + rb_f_exec(c, a); + UNREACHABLE_RETURN(Qnil); } #define ERRMSG(str) do { if (errmsg && 0 < errmsg_buflen) strlcpy(errmsg, (str), errmsg_buflen); } while (0) @@ -4175,6 +4178,7 @@ exit_status_code(VALUE status) https://github.com/ruby/ruby/blob/trunk/process.c#L4178 return istatus; } +NORETURN(static VALUE rb_f_exit_bang(int argc, VALUE *argv, VALUE obj)); /* * call-seq: * Process.exit!(status=false) @@ -4231,6 +4235,7 @@ rb_f_exit(int argc, const VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L4235 UNREACHABLE_RETURN(Qnil); } +NORETURN(static VALUE f_exit(int c, const VALUE *a, VALUE _)); /* * call-seq: * exit(status=true) @@ -4275,7 +4280,8 @@ rb_f_exit(int argc, const VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L4280 static VALUE f_exit(int c, const VALUE *a, VALUE _) { - return rb_f_exit(c, a); + rb_f_exit(c, a); + UNREACHABLE_RETURN(Qnil); } /* @@ -4314,10 +4320,12 @@ rb_f_abort(int argc, const VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L4320 UNREACHABLE_RETURN(Qnil); } +NORETURN(static VALUE f_abort(int c, const VALUE *a, VALUE _)); static VALUE f_abort(int c, const VALUE *a, VALUE _) { - return rb_f_abort(c, a); + rb_f_abort(c, a); + UNREACHABLE_RETURN(Qnil); } void diff --git a/thread_sync.c b/thread_sync.c index 7af5172..2e20812 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -1437,6 +1437,7 @@ rb_condvar_broadcast(VALUE self) https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L1437 return self; } +NORETURN(static VALUE undumpable(VALUE obj)); /* :nodoc: */ static VALUE undumpable(VALUE obj) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/