ruby-changes:57838
From: Takashi <ko1@a...>
Date: Fri, 20 Sep 2019 17:45:04 +0900 (JST)
Subject: [ruby-changes:57838] 4ffcadd39c (master): Fix rb_define_singleton_method warning
https://git.ruby-lang.org/ruby.git/commit/?id=4ffcadd39c From 4ffcadd39cb7061ff501478ed436a56e7f99f3dc Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Fri, 20 Sep 2019 17:44:16 +0900 Subject: Fix rb_define_singleton_method warning for debug counters ``` ../include/ruby/intern.h:1175:137: warning: passing argument 3 of 'rb_define_singleton_method0' from incompatible pointer type [-Wincompatible-pointer-types] #define rb_define_singleton_method(klass, mid, func, arity) rb_define_singleton_method_choose_prototypem3((arity),(func))((klass),(mid),(func),(arity)); ^ ../vm.c:2958:5: note: in expansion of macro 'rb_define_singleton_method' rb_define_singleton_method(rb_cRubyVM, "show_debug_counters", rb_debug_counter_show, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/ruby/intern.h:1139:99: note: expected 'VALUE (*)(VALUE) {aka long unsigned int (*)(long unsigned int)}' but argument is of type 'VALUE (*)(void) {aka long unsigned int (*)(void)}' __attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method0 (VALUE,const char*,VALUE(*)(VALUE),int); ``` diff --git a/debug_counter.c b/debug_counter.c index f17b3b4..60cc2c3 100644 --- a/debug_counter.c +++ b/debug_counter.c @@ -44,14 +44,14 @@ rb_debug_counter_show_results(const char *msg) https://github.com/ruby/ruby/blob/trunk/debug_counter.c#L44 } VALUE -rb_debug_counter_show(void) +rb_debug_counter_show(RB_UNUSED_VAR(VALUE klass)) { rb_debug_counter_show_results("method call"); return Qnil; } VALUE -rb_debug_counter_reset(void) +rb_debug_counter_reset(RB_UNUSED_VAR(VALUE klass)) { for (int i = 0; i < RB_DEBUG_COUNTER_MAX; i++) { switch (i) { diff --git a/debug_counter.h b/debug_counter.h index 3fa6448..2add2ac 100644 --- a/debug_counter.h +++ b/debug_counter.h @@ -349,8 +349,8 @@ rb_debug_counter_add(enum rb_debug_counter_type type, int add, int cond) https://github.com/ruby/ruby/blob/trunk/debug_counter.h#L349 return cond; } -VALUE rb_debug_counter_reset(void); -VALUE rb_debug_counter_show(void); +VALUE rb_debug_counter_reset(VALUE klass); +VALUE rb_debug_counter_show(VALUE klass); #define RB_DEBUG_COUNTER_INC(type) rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, 1) #define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (!rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, !(cond))) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/