зеркало из https://github.com/github/ruby.git
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); ```
This commit is contained in:
Родитель
04c53a1d03
Коммит
4ffcadd39c
|
@ -44,14 +44,14 @@ rb_debug_counter_show_results(const char *msg)
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -349,8 +349,8 @@ rb_debug_counter_add(enum rb_debug_counter_type type, int add, int cond)
|
|||
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)))
|
||||
|
|
Загрузка…
Ссылка в новой задаче