1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

comparing function pointer versus void* is a GCCism

However dlsym() requires such feature so this function is non-
portable by nature.  Cannot but suppress warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shyouhei 2018-01-02 06:41:55 +00:00
parent 1f76918a33
commit 8dc0c7c035

24
dln.c
View file

@ -1242,6 +1242,27 @@ rb_w32_check_imported(HMODULE ext, HMODULE mine)
#define translit_separator(str) (void)(str)
#endif
MAYBE_UNUSED(static bool xmalloc_mismatch_p(void *handle));
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpedantic"
#elif defined(__GNUC__) && (__GNUC__ >= 5)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
bool
xmalloc_mismatch_p(void *handle)
{
void *ex = dlsym(handle, EXTERNAL_PREFIX"ruby_xmalloc");
return ex && ex != ruby_xmalloc;
}
#ifdef __clang__
#pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ >= 5)
#pragma GCC diagnostic pop
#endif
void*
dln_load(const char *file)
{
@ -1329,8 +1350,7 @@ dln_load(const char *file)
}
# if defined RUBY_EXPORT
{
void *ex = dlsym(handle, EXTERNAL_PREFIX"ruby_xmalloc");
if (ex && ex != ruby_xmalloc) {
if (xmalloc_mismatch_p(handle)) {
# if defined __APPLE__ && \
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \