summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cont.c16
-rw-r--r--dir.c6
-rw-r--r--eval.c2
-rw-r--r--ext/-test-/tracepoint/gc_hook.c2
-rw-r--r--ext/etc/etc.c8
-rw-r--r--ext/pty/pty.c3
-rw-r--r--ext/socket/ipsocket.c6
-rw-r--r--ext/socket/raddrinfo.c3
-rw-r--r--ext/socket/udpsocket.c9
-rw-r--r--ext/zlib/zlib.c15
-rw-r--r--gc.c2
-rw-r--r--include/ruby/ruby.h2
-rw-r--r--internal.h2
-rw-r--r--io.c12
-rw-r--r--thread_sync.c3
-rw-r--r--variable.c6
-rw-r--r--vm_core.h2
17 files changed, 62 insertions, 37 deletions
diff --git a/cont.c b/cont.c
index de2f843601..db422d9880 100644
--- a/cont.c
+++ b/cont.c
@@ -1505,10 +1505,12 @@ make_passing_arg(int argc, const VALUE *argv)
}
}
+typedef VALUE e_proc(VALUE);
+
/* CAUTION!! : Currently, error in rollback_func is not supported */
/* same as rb_protect if set rollback_func to NULL */
void
-ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS))
+ruby_register_rollback_func_for_ensure(e_proc *ensure_func, e_proc *rollback_func)
{
st_table **table_p = &GET_VM()->ensure_rollback_table;
if (UNLIKELY(*table_p == NULL)) {
@@ -1517,14 +1519,14 @@ ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*ro
st_insert(*table_p, (st_data_t)ensure_func, (st_data_t)rollback_func);
}
-static inline VALUE
-lookup_rollback_func(VALUE (*ensure_func)(ANYARGS))
+static inline e_proc *
+lookup_rollback_func(e_proc *ensure_func)
{
st_table *table = GET_VM()->ensure_rollback_table;
st_data_t val;
if (table && st_lookup(table, (st_data_t)ensure_func, &val))
- return (VALUE) val;
- return Qundef;
+ return (e_proc *) val;
+ return (e_proc *) Qundef;
}
@@ -1537,7 +1539,7 @@ rollback_ensure_stack(VALUE self,rb_ensure_list_t *current,rb_ensure_entry_t *ta
size_t cur_size;
size_t target_size;
size_t base_point;
- VALUE (*func)(ANYARGS);
+ e_proc *func;
cur_size = 0;
for (p=current; p; p=p->next)
@@ -1572,7 +1574,7 @@ rollback_ensure_stack(VALUE self,rb_ensure_list_t *current,rb_ensure_entry_t *ta
}
/* push ensure stack */
for (j = 0; j < i; j++) {
- func = (VALUE (*)(ANYARGS)) lookup_rollback_func(target[i - j - 1].e_proc);
+ func = lookup_rollback_func(target[i - j - 1].e_proc);
if ((VALUE)func != Qundef) {
(*func)(target[i - j - 1].data2);
}
diff --git a/dir.c b/dir.c
index 18c10f2139..bfd085e16c 100644
--- a/dir.c
+++ b/dir.c
@@ -1010,8 +1010,9 @@ struct chdir_data {
};
static VALUE
-chdir_yield(struct chdir_data *args)
+chdir_yield(VALUE v)
{
+ struct chdir_data *args = (void *)v;
dir_chdir(args->new_path);
args->done = TRUE;
chdir_blocking++;
@@ -1021,8 +1022,9 @@ chdir_yield(struct chdir_data *args)
}
static VALUE
-chdir_restore(struct chdir_data *args)
+chdir_restore(VALUE v)
{
+ struct chdir_data *args = (void *)v;
if (args->done) {
chdir_blocking--;
if (chdir_blocking == 0)
diff --git a/eval.c b/eval.c
index b06e87f33f..9997d288a3 100644
--- a/eval.c
+++ b/eval.c
@@ -1071,7 +1071,7 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int *pstate)
* \ingroup exception
*/
VALUE
-rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE data2)
+rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2)
{
int state;
volatile VALUE result = Qnil;
diff --git a/ext/-test-/tracepoint/gc_hook.c b/ext/-test-/tracepoint/gc_hook.c
index 6d8485ecb1..2e695a9fba 100644
--- a/ext/-test-/tracepoint/gc_hook.c
+++ b/ext/-test-/tracepoint/gc_hook.c
@@ -4,7 +4,7 @@
static int invoking; /* TODO: should not be global variable */
static VALUE
-invoke_proc_ensure(void *dmy)
+invoke_proc_ensure(VALUE _)
{
invoking = 0;
return Qnil;
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index b6dca94b99..a3a9bbc233 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -231,7 +231,7 @@ etc_getpwnam(VALUE obj, VALUE nam)
#ifdef HAVE_GETPWENT
static int passwd_blocking = 0;
static VALUE
-passwd_ensure(void)
+passwd_ensure(VALUE _)
{
endpwent();
passwd_blocking = (int)Qfalse;
@@ -239,7 +239,7 @@ passwd_ensure(void)
}
static VALUE
-passwd_iterate(void)
+passwd_iterate(VALUE _)
{
struct passwd *pw;
@@ -475,7 +475,7 @@ etc_getgrnam(VALUE obj, VALUE nam)
#ifdef HAVE_GETGRENT
static int group_blocking = 0;
static VALUE
-group_ensure(void)
+group_ensure(VALUE _)
{
endgrent();
group_blocking = (int)Qfalse;
@@ -484,7 +484,7 @@ group_ensure(void)
static VALUE
-group_iterate(void)
+group_iterate(VALUE _)
{
struct group *pw;
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 7b9df4b5b9..4c6ae26127 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -520,8 +520,9 @@ pty_open(VALUE klass)
}
static VALUE
-pty_detach_process(struct pty_info *info)
+pty_detach_process(VALUE v)
{
+ struct pty_info *info = (void *)v;
#ifdef WNOHANG
int st;
if (rb_waitpid(info->child_pid, &st, WNOHANG) <= 0)
diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index f214d852ae..a2cb6e0e12 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -22,8 +22,9 @@ struct inetsock_arg
};
static VALUE
-inetsock_cleanup(struct inetsock_arg *arg)
+inetsock_cleanup(VALUE v)
{
+ struct inetsock_arg *arg = (void *)v;
if (arg->remote.res) {
rb_freeaddrinfo(arg->remote.res);
arg->remote.res = 0;
@@ -39,8 +40,9 @@ inetsock_cleanup(struct inetsock_arg *arg)
}
static VALUE
-init_inetsock_internal(struct inetsock_arg *arg)
+init_inetsock_internal(VALUE v)
{
+ struct inetsock_arg *arg = (void *)v;
int error = 0;
int type = arg->type;
struct addrinfo *res, *lres;
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c
index b59cc49005..dad11ad1ac 100644
--- a/ext/socket/raddrinfo.c
+++ b/ext/socket/raddrinfo.c
@@ -654,8 +654,9 @@ struct hostent_arg {
};
static VALUE
-make_hostent_internal(struct hostent_arg *arg)
+make_hostent_internal(VALUE v)
{
+ struct hostent_arg *arg = (void *)v;
VALUE host = arg->host;
struct addrinfo* addr = arg->addr->ai;
VALUE (*ipaddr)(struct sockaddr*, socklen_t) = arg->ipaddr;
diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c
index c2e273c2a3..6ef8242a1e 100644
--- a/ext/socket/udpsocket.c
+++ b/ext/socket/udpsocket.c
@@ -50,8 +50,9 @@ struct udp_arg
};
static VALUE
-udp_connect_internal(struct udp_arg *arg)
+udp_connect_internal(VALUE v)
{
+ struct udp_arg *arg = (void *)v;
rb_io_t *fptr;
int fd;
struct addrinfo *res;
@@ -97,8 +98,9 @@ udp_connect(VALUE sock, VALUE host, VALUE port)
}
static VALUE
-udp_bind_internal(struct udp_arg *arg)
+udp_bind_internal(VALUE v)
{
+ struct udp_arg *arg = (void *)v;
rb_io_t *fptr;
int fd;
struct addrinfo *res;
@@ -147,8 +149,9 @@ struct udp_send_arg {
};
static VALUE
-udp_send_internal(struct udp_send_arg *arg)
+udp_send_internal(VALUE v)
{
+ struct udp_send_arg *arg = (void *)v;
rb_io_t *fptr;
int n;
struct addrinfo *res;
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index e84e565932..afd761f1c1 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -85,6 +85,7 @@ static void zstream_passthrough_input(struct zstream*);
static VALUE zstream_detach_input(struct zstream*);
static void zstream_reset(struct zstream*);
static VALUE zstream_end(struct zstream*);
+static VALUE zstream_ensure_end(VALUE v);
static void zstream_run(struct zstream*, Bytef*, long, int);
static VALUE zstream_sync(struct zstream*, Bytef*, long);
static void zstream_mark(void*);
@@ -955,6 +956,12 @@ zstream_end(struct zstream *z)
return Qnil;
}
+static VALUE
+zstream_ensure_end(VALUE v)
+{
+ return zstream_end((struct zstream *)v);
+}
+
static void *
zstream_run_func(void *ptr)
{
@@ -1640,7 +1647,7 @@ rb_deflate_s_deflate(int argc, VALUE *argv, VALUE klass)
args[0] = (VALUE)&z;
args[1] = src;
- dst = rb_ensure(deflate_run, (VALUE)args, zstream_end, (VALUE)&z);
+ dst = rb_ensure(deflate_run, (VALUE)args, zstream_ensure_end, (VALUE)&z);
OBJ_INFECT(dst, src);
return dst;
@@ -1955,7 +1962,7 @@ rb_inflate_s_inflate(VALUE obj, VALUE src)
args[0] = (VALUE)&z;
args[1] = src;
- dst = rb_ensure(inflate_run, (VALUE)args, zstream_end, (VALUE)&z);
+ dst = rb_ensure(inflate_run, (VALUE)args, zstream_ensure_end, (VALUE)&z);
OBJ_INFECT(dst, src);
return dst;
@@ -2919,7 +2926,7 @@ gzfile_writer_end(struct gzfile *gz)
if (ZSTREAM_IS_CLOSING(&gz->z)) return;
gz->z.flags |= ZSTREAM_FLAG_CLOSING;
- rb_ensure(gzfile_writer_end_run, (VALUE)gz, zstream_end, (VALUE)&gz->z);
+ rb_ensure(gzfile_writer_end_run, (VALUE)gz, zstream_ensure_end, (VALUE)&gz->z);
}
static VALUE
@@ -2941,7 +2948,7 @@ gzfile_reader_end(struct gzfile *gz)
if (ZSTREAM_IS_CLOSING(&gz->z)) return;
gz->z.flags |= ZSTREAM_FLAG_CLOSING;
- rb_ensure(gzfile_reader_end_run, (VALUE)gz, zstream_end, (VALUE)&gz->z);
+ rb_ensure(gzfile_reader_end_run, (VALUE)gz, zstream_ensure_end, (VALUE)&gz->z);
}
static void
diff --git a/gc.c b/gc.c
index d655e362dc..654a6c85e3 100644
--- a/gc.c
+++ b/gc.c
@@ -2755,7 +2755,7 @@ objspace_each_objects_protected(VALUE arg)
}
static VALUE
-incremental_enable(void)
+incremental_enable(VALUE _)
{
rb_objspace_t *objspace = &rb_objspace;
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index b1e5b0dc51..ae073222d0 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1968,7 +1968,7 @@ 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(*)(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_ensure(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE),VALUE);
VALUE rb_catch(const char*,VALUE(*)(ANYARGS),VALUE);
VALUE rb_catch_obj(VALUE,VALUE(*)(ANYARGS),VALUE);
NORETURN(void rb_throw(const char*,VALUE));
diff --git a/internal.h b/internal.h
index 01009b616a..bd9ee44ddc 100644
--- a/internal.h
+++ b/internal.h
@@ -1469,7 +1469,7 @@ struct rb_thread_struct;
/* cont.c */
VALUE rb_obj_is_fiber(VALUE);
void rb_fiber_reset_root_local_storage(struct rb_thread_struct *);
-void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS));
+void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(VALUE), VALUE (*rollback_func)(VALUE));
/* debug.c */
PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
diff --git a/io.c b/io.c
index 8f48ba1dd6..1b37723b26 100644
--- a/io.c
+++ b/io.c
@@ -10379,8 +10379,9 @@ open_key_args(VALUE klass, int argc, VALUE *argv, VALUE opt, struct foreach_arg
}
static VALUE
-io_s_foreach(struct getline_arg *arg)
+io_s_foreach(VALUE v)
{
+ struct getline_arg *arg = (void *)v;
VALUE str;
while (!NIL_P(str = rb_io_getline_1(arg->rs, arg->limit, arg->chomp, arg->io))) {
@@ -10437,8 +10438,9 @@ rb_io_s_foreach(int argc, VALUE *argv, VALUE self)
}
static VALUE
-io_s_readlines(struct getline_arg *arg)
+io_s_readlines(VALUE v)
{
+ struct getline_arg *arg = (void *)v;
return io_readlines(arg, arg->io);
}
@@ -10489,8 +10491,9 @@ rb_io_s_readlines(int argc, VALUE *argv, VALUE io)
}
static VALUE
-io_s_read(struct foreach_arg *arg)
+io_s_read(VALUE v)
{
+ struct foreach_arg *arg = (void *)v;
return io_read(arg->argc, arg->argv, arg->io);
}
@@ -10626,8 +10629,9 @@ rb_io_s_binread(int argc, VALUE *argv, VALUE io)
}
static VALUE
-io_s_write0(struct write_arg *arg)
+io_s_write0(VALUE v)
{
+ struct write_arg *arg = (void * )v;
return io_write(arg->io,arg->str,arg->nosync);
}
diff --git a/thread_sync.c b/thread_sync.c
index c2612c1415..f98a7655c0 100644
--- a/thread_sync.c
+++ b/thread_sync.c
@@ -1363,8 +1363,9 @@ do_sleep(VALUE args)
}
static VALUE
-delete_from_waitq(struct sync_waiter *w)
+delete_from_waitq(VALUE v)
{
+ struct sync_waiter *w = (void *)v;
list_del(&w->node);
return Qnil;
diff --git a/variable.c b/variable.c
index 2a3862fca1..3db3e3d5ef 100644
--- a/variable.c
+++ b/variable.c
@@ -671,8 +671,9 @@ struct trace_data {
};
static VALUE
-trace_ev(struct trace_data *data)
+trace_ev(VALUE v)
{
+ struct trace_data *data = (void *)v;
struct trace_var *trace = data->trace;
while (trace) {
@@ -684,8 +685,9 @@ trace_ev(struct trace_data *data)
}
static VALUE
-trace_en(struct rb_global_variable *var)
+trace_en(VALUE v)
{
+ struct rb_global_variable *var = (void *)v;
var->block_trace = 0;
remove_trace(var);
return Qnil; /* not reached */
diff --git a/vm_core.h b/vm_core.h
index 987d1b15c5..74700f37f0 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -839,7 +839,7 @@ typedef struct rb_thread_list_struct{
typedef struct rb_ensure_entry {
VALUE marker;
- VALUE (*e_proc)(ANYARGS);
+ VALUE (*e_proc)(VALUE);
VALUE data2;
} rb_ensure_entry_t;