]> granicus.if.org Git - gc/commitdiff
Eliminate warning about 64-bit pointer-to-int cast (Win64/pthreads-w32)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 24 Jun 2015 11:51:14 +0000 (14:51 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 28 Jan 2016 08:21:23 +0000 (11:21 +0300)
(Apply commit 6936df7 from 'master' branch.)

* include/private/gc_locks.h (NUMERIC_THREAD_ID): Cast to unsigned long
through "word" type if GC_WIN32_PTHREADS but not winpthreads (to
suppress "cast from pointer to integer of different size" compiler
warning).
* win32_threads.c (NUMERIC_THREAD_ID): Likewise.
* win32_threads.c (NUMERIC_THREAD_ID): Do not define unless
GC_ASSERTIONS.

include/private/gc_locks.h
win32_threads.c

index 328d13c20ddf9b0c54aa6549addf34d92a7bf056..bea2881109b7d238fb71ddc9dbcfcf387b186eea 100644 (file)
@@ -92,7 +92,7 @@
 #      define THREAD_EQUAL(id1, id2) ((id1) == (id2))
 #      define NUMERIC_THREAD_ID_UNIQUE
 #    else
-#      define NUMERIC_THREAD_ID(id) ((unsigned long)(id.p))
+#      define NUMERIC_THREAD_ID(id) ((unsigned long)(word)(id.p))
        /* Using documented internal details of win32-pthread library.   */
        /* Faster than pthread_equal(). Should not change with           */
        /* future versions of win32-pthread library.                     */
index bfaca358463444c3da5b051b51be2dc353558d88..42c4920f9eeedc77af014f13baa74278b978643a 100644 (file)
@@ -1728,8 +1728,9 @@ GC_INNER void GC_get_next_stack(char *start, char *limit,
 # ifdef GC_PTHREADS_PARAMARK
 #   include <pthread.h>
 
-#   ifndef NUMERIC_THREAD_ID
-#     define NUMERIC_THREAD_ID(id) (unsigned long)GC_PTHREAD_PTRVAL(id)
+#   if defined(GC_ASSERTIONS) && !defined(NUMERIC_THREAD_ID)
+#     define NUMERIC_THREAD_ID(id) (unsigned long)(word)GC_PTHREAD_PTRVAL(id)
+      /* Id not guaranteed to be unique. */
 #   endif
 
     /* start_mark_threads is the same as in pthread_support.c except    */