]> granicus.if.org Git - gc/commitdiff
Eliminate 'ISO C forbids object to function pointer conversion' warning
authorIvan Maidanski <ivmai@mail.ru>
Thu, 16 Mar 2017 07:22:29 +0000 (10:22 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 7 Apr 2017 15:42:48 +0000 (18:42 +0300)
(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
pthread_support.c

index 79614bf14cc51019caeadca434b50fbb63be5438..5c198f20c94007839d026bd8edcab7ceda0e2175 100644 (file)
@@ -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;
index aa34c2c7626210abfcbf5963262ef7faeae9bc08..4009a572e3a379dc6e1bfd8f18b88abdd3625d22 100644 (file)
       }
       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)
               " (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;