From d5cd57966d5532da3670d4c188be7df33585388f Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 16 Mar 2017 10:22:29 +0300 Subject: [PATCH] Eliminate 'ISO C forbids object to function pointer conversion' warning (Cherry-pick commit c69ae9c from 'release-7_6' branch.) * dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES && SUNOS53_SHARED_LIB] (GC_FirstDLOpenedLinkMap): Cast result of dlsym() to word type before casting it to a function pointer. * pthread_support.c [GC_USE_DLOPEN_WRAP] (GC_init_real_syms): Likewise. --- dyn_load.c | 2 +- pthread_support.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dyn_load.c b/dyn_load.c index 79614bf1..5c198f20 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -178,7 +178,7 @@ GC_FirstDLOpenedLinkMap(void) /* at program startup. */ if( dynStructureAddr == 0 ) { void* startupSyms = dlopen(0, RTLD_LAZY); - dynStructureAddr = (ElfW(Dyn)*)dlsym(startupSyms, "_DYNAMIC"); + dynStructureAddr = (ElfW(Dyn)*)(word)dlsym(startupSyms, "_DYNAMIC"); } # else dynStructureAddr = &_DYNAMIC; diff --git a/pthread_support.c b/pthread_support.c index aa34c2c7..4009a572 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -223,7 +223,7 @@ } if (NULL == dl_handle) ABORT("Couldn't open libpthread"); # endif - REAL_FUNC(pthread_create) = (GC_pthread_create_t) + REAL_FUNC(pthread_create) = (GC_pthread_create_t)(word) dlsym(dl_handle, "pthread_create"); # ifdef RTLD_NEXT if (REAL_FUNC(pthread_create) == 0) @@ -231,19 +231,19 @@ " (probably -lgc is specified after -lpthread)"); # endif # ifndef GC_NO_PTHREAD_SIGMASK - REAL_FUNC(pthread_sigmask) = (GC_pthread_sigmask_t) + REAL_FUNC(pthread_sigmask) = (GC_pthread_sigmask_t)(word) dlsym(dl_handle, "pthread_sigmask"); # endif - REAL_FUNC(pthread_join) = (GC_pthread_join_t) + REAL_FUNC(pthread_join) = (GC_pthread_join_t)(word) dlsym(dl_handle, "pthread_join"); - REAL_FUNC(pthread_detach) = (GC_pthread_detach_t) + REAL_FUNC(pthread_detach) = (GC_pthread_detach_t)(word) dlsym(dl_handle, "pthread_detach"); # ifndef GC_NO_PTHREAD_CANCEL - REAL_FUNC(pthread_cancel) = (GC_pthread_cancel_t) + REAL_FUNC(pthread_cancel) = (GC_pthread_cancel_t)(word) dlsym(dl_handle, "pthread_cancel"); # endif # ifdef GC_PTHREAD_EXIT_ATTRIBUTE - REAL_FUNC(pthread_exit) = (GC_pthread_exit_t) + REAL_FUNC(pthread_exit) = (GC_pthread_exit_t)(word) dlsym(dl_handle, "pthread_exit"); # endif GC_syms_initialized = TRUE; -- 2.40.0