1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Added more NORETURN declarations

This commit is contained in:
Nobuyoshi Nakada 2020-05-11 00:24:14 +09:00
parent a1e1fdca09
commit 5d430c1b34
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
11 changed files with 37 additions and 11 deletions

View file

@ -10856,11 +10856,13 @@ ibf_dump_object_unsupported(struct ibf_dump *dump, VALUE obj)
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

4
cont.c
View file

@ -1610,6 +1610,8 @@ rollback_ensure_stack(VALUE self,rb_ensure_list_t *current,rb_ensure_entry_t *ta
}
}
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)
cont->value = make_passing_arg(argc, argv);
cont_restore_0(cont, &contval);
return Qnil; /* unreachable */
UNREACHABLE_RETURN(Qnil);
}
/*********/

4
dir.c
View file

@ -1966,13 +1966,15 @@ rb_glob_warning(const char *path, VALUE a, const void *enc, int error)
}
#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

View file

@ -1302,12 +1302,13 @@ enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
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: */

1
enum.c
View file

@ -1021,6 +1021,7 @@ enum_tally(VALUE obj)
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))
{

View file

@ -2676,7 +2676,8 @@ lazy_with_index_proc(VALUE proc_entry, struct MEMO* result, VALUE memos, long me
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)
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)
if (init == Qundef) {
curr = Qnil;
} else {
}
else {
rb_yield(init);
curr = init;
}
@ -2953,7 +2957,7 @@ producer_each_i(VALUE obj)
rb_yield(curr);
}
return Qnil;
UNREACHABLE_RETURN(Qnil);
}
/* :nodoc: */

2
gc.c
View file

@ -968,6 +968,8 @@ void rb_gcdebug_print_obj_condition(VALUE obj);
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);

3
hash.c
View file

@ -6328,6 +6328,7 @@ env_reject(VALUE _)
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
env_freeze(VALUE self)
{
rb_raise(rb_eTypeError, "cannot freeze ENV");
return self; /* Not reached */
UNREACHABLE_RETURN(self);
}
/*

View file

@ -479,6 +479,8 @@ rb_num_coerce_relop(VALUE x, VALUE y, ID func)
return c;
}
NORETURN(static VALUE num_sadded(VALUE x, VALUE name));
/*
* :nodoc:
*

View file

@ -2931,6 +2931,8 @@ rb_f_exec(int argc, const VALUE *argv)
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)
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)
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)
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)
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)
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

View file

@ -1437,6 +1437,7 @@ rb_condvar_broadcast(VALUE self)
return self;
}
NORETURN(static VALUE undumpable(VALUE obj));
/* :nodoc: */
static VALUE
undumpable(VALUE obj)