From: Ivan Maidanski Date: Wed, 24 Jun 2015 11:51:14 +0000 (+0300) Subject: Eliminate warning about 64-bit pointer-to-int cast (Win64/pthreads-w32) X-Git-Tag: gc7_6_0~187 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6936df7;p=gc Eliminate warning about 64-bit pointer-to-int cast (Win64/pthreads-w32) * 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. --- diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index 6507609b..3337b9ec 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -99,7 +99,7 @@ # define NUMERIC_THREAD_ID_UNIQUE # endif # else /* pthreads-win32 */ -# define NUMERIC_THREAD_ID(id) ((unsigned long)(id.p)) +# define NUMERIC_THREAD_ID(id) ((unsigned long)(word)(id.p)) /* Using documented internal details of pthreads-win32 library. */ /* Faster than pthread_equal(). Should not change with */ /* future versions of pthreads-win32 library. */ diff --git a/win32_threads.c b/win32_threads.c index 24d07f32..2fed5d46 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1744,8 +1744,8 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, # ifdef GC_PTHREADS_PARAMARK # include -# 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