Skip to content

Commit

Permalink
Avoid warning about parameter type
Browse files Browse the repository at this point in the history
In file included from /home/local/COMCARD-NT/kanis/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby.h:33:0,
                 from ../../../../ext/ffi_c/MethodHandle.c:48:
../../../../ext/ffi_c/MethodHandle.c: In function ‘prep_trampoline’:
../../../../ext/ffi_c/MethodHandle.c:315:18: warning: ISO C forbids passing argument 2 of ‘ruby_nonempty_memcpy’ between function pointer and ‘void *’ [-Wpedantic]
     memcpy(code, &ffi_trampoline, trampoline_size());
                  ^
/home/local/COMCARD-NT/kanis/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1763:50: note: in definition of macro ‘memcpy’
. #define memcpy(p1,p2,n) ruby_nonempty_memcpy(p1, p2, n)
                                                  ^~
/home/local/COMCARD-NT/kanis/.rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1758:1: note: expected ‘const void *’ but argument is of type ‘void (*)(int,  VALUE *, VALUE) {aka void (*)(int,  long unsigned int *, long unsigned int)}’
 ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
 ^~~~~~~~~~~~~~~~~~~~
  • Loading branch information
larskanis committed Feb 5, 2020
1 parent 333da91 commit 143c72f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/ffi_c/MethodHandle.c
Expand Up @@ -311,7 +311,7 @@ trampoline_offsets(long* ctxOffset, long* fnOffset)
static bool
prep_trampoline(void* ctx, void* code, Closure* closure, char* errmsg, size_t errmsgsize)
{
memcpy(code, &ffi_trampoline, trampoline_size());
memcpy(code, (void*) &ffi_trampoline, trampoline_size());
/* Patch the context and function addresses into the stub code */
*(intptr_t *)((char*)code + trampoline_ctx_offset) = (intptr_t) closure;
*(intptr_t *)((char*)code + trampoline_func_offset) = (intptr_t) custom_trampoline;
Expand Down

0 comments on commit 143c72f

Please sign in to comment.