]> granicus.if.org Git - gc/commitdiff
Eliminate 'cast to void* from int' compiler warnings (Darwin/x64)
authorIvan Maidanski <ivmai@mail.ru>
Thu, 18 Aug 2016 22:43:25 +0000 (01:43 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 18 Aug 2016 22:43:25 +0000 (01:43 +0300)
* darwin_stop_world.c (GC_stack_range_for, GC_suspend_thread_list,
GC_stop_world, GC_thread_resume, GC_start_world): Cast thread variable
to pointer via word type.
* darwin_stop_world.c (GC_stop_world): Cast stop_info.mach_thread to
pointer via word type.

darwin_stop_world.c

index 21e7e1ce4273b97aa8a9b45e0c00a9ad5893db6e..e3c05480f327c908381aacf7a8b9fda3685e8aca 100644 (file)
@@ -314,7 +314,7 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p,
   }
 # ifdef DEBUG_THREADS
     GC_log_printf("Darwin: Stack for thread %p = [%p,%p)\n",
-                  (void *)thread, lo, *phi);
+                  (void *)(word)thread, lo, *phi);
 # endif
   return lo;
 }
@@ -452,7 +452,8 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
 #   endif
 
 #   ifdef DEBUG_THREADS
-      GC_log_printf("Attempting to suspend thread %p\n", (void *)thread);
+      GC_log_printf("Attempting to suspend thread %p\n",
+                    (void *)(word)thread);
 #   endif
     /* find the current thread in the old list */
     found = FALSE;
@@ -496,7 +497,8 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
       continue;
     }
 #   ifdef DEBUG_THREADS
-      GC_log_printf("Thread state for %p = %d\n", (void *)thread, info.run_state);
+      GC_log_printf("Thread state for %p = %d\n", (void *)(word)thread,
+                    info.run_state);
 #   endif
     if (info.suspend_count != 0) {
       /* thread is already suspended. */
@@ -506,7 +508,7 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
     }
 
 #   ifdef DEBUG_THREADS
-      GC_log_printf("Suspending %p\n", (void *)thread);
+      GC_log_printf("Suspending %p\n", (void *)(word)thread);
 #   endif
     kern_result = thread_suspend(thread);
     if (kern_result != KERN_SUCCESS) {
@@ -519,7 +521,7 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
     if (!found)
       GC_mach_threads_count++;
     if (GC_on_thread_event)
-      GC_on_thread_event(GC_EVENT_THREAD_SUSPENDED, (void *)thread);
+      GC_on_thread_event(GC_EVENT_THREAD_SUSPENDED, (void *)(word)thread);
   }
   return changed;
 }
@@ -535,7 +537,8 @@ GC_INNER void GC_stop_world(void)
   kern_return_t kern_result;
 
 # ifdef DEBUG_THREADS
-    GC_log_printf("Stopping the world from thread %p\n", (void *)my_thread);
+    GC_log_printf("Stopping the world from thread %p\n",
+                  (void *)(word)my_thread);
 # endif
 # ifdef PARALLEL_MARK
     if (GC_parallel) {
@@ -610,7 +613,7 @@ GC_INNER void GC_stop_world(void)
             ABORT("thread_suspend failed");
           if (GC_on_thread_event)
             GC_on_thread_event(GC_EVENT_THREAD_SUSPENDED,
-                               (void *)p->stop_info.mach_thread);
+                               (void *)(word)p->stop_info.mach_thread);
         }
       }
     }
@@ -627,7 +630,7 @@ GC_INNER void GC_stop_world(void)
 # endif
 
 # ifdef DEBUG_THREADS
-    GC_log_printf("World stopped from %p\n", (void *)my_thread);
+    GC_log_printf("World stopped from %p\n", (void *)(word)my_thread);
 # endif
   mach_port_deallocate(my_task, my_thread);
 }
@@ -644,7 +647,7 @@ GC_INLINE void GC_thread_resume(thread_act_t thread)
       ABORT("thread_info failed");
 # endif
 # ifdef DEBUG_THREADS
-    GC_log_printf("Resuming thread %p with state %d\n", (void *)thread,
+    GC_log_printf("Resuming thread %p with state %d\n", (void *)(word)thread,
                   info.run_state);
 # endif
   /* Resume the thread */
@@ -652,7 +655,7 @@ GC_INLINE void GC_thread_resume(thread_act_t thread)
   if (kern_result != KERN_SUCCESS)
     ABORT("thread_resume failed");
   if (GC_on_thread_event)
-    GC_on_thread_event(GC_EVENT_THREAD_UNSUSPENDED, (void *)thread);
+    GC_on_thread_event(GC_EVENT_THREAD_UNSUSPENDED, (void *)(word)thread);
 }
 
 /* Caller holds allocation lock, and has held it continuously since     */
@@ -705,7 +708,7 @@ GC_INNER void GC_start_world(void)
           if (GC_mach_threads[j].already_suspended) {
 #           ifdef DEBUG_THREADS
               GC_log_printf("Not resuming already suspended thread %p\n",
-                            (void *)thread);
+                            (void *)(word)thread);
 #           endif
           } else {
             GC_thread_resume(thread);