]> granicus.if.org Git - gc/commitdiff
Fix 'incompatible pointer' compiler warning in GC_init_dyld (OS X 64-bit)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 17 Aug 2016 06:44:31 +0000 (09:44 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 1 Nov 2016 23:22:13 +0000 (02:22 +0300)
* dyn_load.c (GC_init_dyld): Cast _dyld_register_func_for_add_image
and _dyld_register_func_for_remove_image argument to void compiler
warning about incompatible pointer types; update relevant comment.

dyn_load.c

index 4f8f7da38f1d448d6ac9ba1e54558ad2e02c5459..6e74063bdf491571f84fc68084ea7e24a077deeb 100644 (file)
@@ -1431,12 +1431,13 @@ GC_INNER void GC_init_dyld(void)
      This WILL properly register already linked libraries and libraries
      linked in the future.
   */
-
-  _dyld_register_func_for_add_image(GC_dyld_image_add);
-  _dyld_register_func_for_remove_image(GC_dyld_image_remove);
-      /* Ignore 2 compiler warnings here: passing argument 1 of       */
-      /* '_dyld_register_func_for_add/remove_image' from incompatible */
-      /* pointer type.                                                */
+  _dyld_register_func_for_add_image(
+        (void (*)(const struct mach_header*, intptr_t))GC_dyld_image_add);
+  _dyld_register_func_for_remove_image(
+        (void (*)(const struct mach_header*, intptr_t))GC_dyld_image_remove);
+                        /* Structure mach_header64 has the same fields  */
+                        /* as mach_header except for the reserved one   */
+                        /* at the end, so these casts are OK.           */
 
   /* Set this early to avoid reentrancy issues. */
   initialized = TRUE;