diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-08-26 14:51:00 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-08-27 15:52:26 +0900 |
commit | 5c7c2d9951f2512ca10ea38fecc48d8ac67502e6 (patch) | |
tree | a6a317a81bb40854ebd7dd50cf6d001f7a444fe1 | |
parent | 3cae73133cfec7d5ec3f8058ec647d5163578003 (diff) | |
download | ruby-5c7c2d9951f2512ca10ea38fecc48d8ac67502e6.tar.gz |
rb_rescue / rb_rescue2 now free from ANYARGS
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is
dangerous and should be extinct. This commit deletes ANYARGS from
rb_rescue / rb_rescue2, which revealed many arity / type mismatches.
-rw-r--r-- | enum.c | 6 | ||||
-rw-r--r-- | enumerator.c | 2 | ||||
-rw-r--r-- | eval.c | 8 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 6 | ||||
-rw-r--r-- | include/ruby/ruby.h | 4 | ||||
-rw-r--r-- | io.c | 2 | ||||
-rw-r--r-- | time.c | 2 | ||||
-rw-r--r-- | vm_eval.c | 8 |
8 files changed, 20 insertions, 18 deletions
@@ -2723,14 +2723,16 @@ zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval)) } static VALUE -call_next(VALUE *v) +call_next(VALUE w) { + VALUE *v = (VALUE *)w; return v[0] = rb_funcallv(v[1], id_next, 0, 0); } static VALUE -call_stop(VALUE *v) +call_stop(VALUE w, VALUE _) { + VALUE *v = (VALUE *)w; return v[0] = Qundef; } diff --git a/enumerator.c b/enumerator.c index beea1c728f..afc9ed94fa 100644 --- a/enumerator.c +++ b/enumerator.c @@ -2231,7 +2231,7 @@ call_next(VALUE obj) } static VALUE -next_stopped(VALUE obj) +next_stopped(VALUE obj, VALUE _) { return Qnil; } @@ -931,8 +931,8 @@ rb_need_block(void) * \ingroup exception */ VALUE -rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1, - VALUE (* r_proc) (ANYARGS), VALUE data2, ...) +rb_rescue2(VALUE (* b_proc) (VALUE), VALUE data1, + VALUE (* r_proc) (VALUE, VALUE), VALUE data2, ...) { enum ruby_tag_type state; rb_execution_context_t * volatile ec = GET_EC(); @@ -1003,8 +1003,8 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1, * \ingroup exception */ VALUE -rb_rescue(VALUE (* b_proc)(ANYARGS), VALUE data1, - VALUE (* r_proc)(ANYARGS), VALUE data2) +rb_rescue(VALUE (* b_proc)(VALUE), VALUE data1, + VALUE (* r_proc)(VALUE, VALUE), VALUE data2) { return rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError, (VALUE)0); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index f1fd2b5c8a..e84e565932 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -140,7 +140,7 @@ static void gzfile_reset(struct gzfile*); static void gzfile_close(struct gzfile*, int); static void gzfile_write_raw(struct gzfile*); static VALUE gzfile_read_raw_partial(VALUE); -static VALUE gzfile_read_raw_rescue(VALUE); +static VALUE gzfile_read_raw_rescue(VALUE,VALUE); static VALUE gzfile_read_raw(struct gzfile*, VALUE outbuf); static int gzfile_read_raw_ensure(struct gzfile*, long, VALUE outbuf); static char *gzfile_read_raw_until_zero(struct gzfile*, long); @@ -2385,7 +2385,7 @@ gzfile_read_raw_partial(VALUE arg) } static VALUE -gzfile_read_raw_rescue(VALUE arg) +gzfile_read_raw_rescue(VALUE arg, VALUE _) { struct read_raw_arg *ra = (struct read_raw_arg *)arg; VALUE str = Qnil; @@ -4888,5 +4888,3 @@ Init_zlib(void) * Raised when the data length recorded in the gzip file footer is not equivalent * to the length of the actual uncompressed data. */ - - diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 1f05dd4dc6..b1e5b0dc51 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1966,8 +1966,8 @@ int rb_block_given_p(void); void rb_need_block(void); VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE); VALUE rb_block_call(VALUE,ID,int,const VALUE*,rb_block_call_func_t,VALUE); -VALUE rb_rescue(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE); -VALUE rb_rescue2(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE,...); +VALUE rb_rescue(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE); +VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...); VALUE rb_ensure(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE); VALUE rb_catch(const char*,VALUE(*)(ANYARGS),VALUE); VALUE rb_catch_obj(VALUE,VALUE(*)(ANYARGS),VALUE); @@ -11457,7 +11457,7 @@ copy_stream_fallback(struct copy_stream_struct *stp) rb_raise(rb_eArgError, "cannot specify src_offset for non-IO"); } rb_rescue2(copy_stream_fallback_body, (VALUE)stp, - (VALUE (*) (ANYARGS))0, (VALUE)0, + (VALUE (*) (VALUE, VALUE))0, (VALUE)0, rb_eEOFError, (VALUE)0); return Qnil; } @@ -5204,7 +5204,7 @@ mload_zone(VALUE time, VALUE zone) VALUE z, args[2]; args[0] = time; args[1] = zone; - z = rb_rescue(mload_findzone, (VALUE)args, (VALUE (*)(ANYARGS))NULL, Qnil); + z = rb_rescue(mload_findzone, (VALUE)args, 0, Qnil); if (NIL_P(z)) return rb_fstring(zone); if (RB_TYPE_P(z, T_STRING)) return rb_fstring(z); return z; @@ -322,16 +322,18 @@ struct rescue_funcall_args { }; static VALUE -check_funcall_exec(struct rescue_funcall_args *args) +check_funcall_exec(VALUE v) { + struct rescue_funcall_args *args = (void *)v; return call_method_entry(args->ec, args->defined_class, args->recv, idMethodMissing, args->me, args->argc, args->argv); } static VALUE -check_funcall_failed(struct rescue_funcall_args *args, VALUE e) +check_funcall_failed(VALUE v, VALUE e) { + struct rescue_funcall_args *args = (void *)v; int ret = args->respond; if (!ret) { switch (rb_method_boundp(args->defined_class, args->mid, @@ -1075,7 +1077,7 @@ rb_yield_block(VALUE val, VALUE arg, int argc, const VALUE *argv, VALUE blockarg } static VALUE -loop_i(void) +loop_i(VALUE _) { for (;;) { rb_yield_0(0, 0); |