From: Ivan Maidanski Date: Wed, 7 Jun 2017 07:18:28 +0000 (+0300) Subject: Eliminate 'unused variable' compiler warning in remove_all_threads_but_me X-Git-Tag: v7.6.2~144 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=827014a351cfa6b6344c1509563a7dae0e49aeab;p=gc Eliminate 'unused variable' compiler warning in remove_all_threads_but_me (fix commit 0fc61f2) * pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me): Declare "res" local variable only if THREAD_LOCAL_ALLOC and not USE_CUSTOM_SPECIFIC. --- diff --git a/pthread_support.c b/pthread_support.c index 5853de20..67754d0a 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -728,8 +728,6 @@ STATIC void GC_remove_all_threads_but_me(void) for (p = GC_threads[hv]; 0 != p; p = next) { next = p -> next; if (THREAD_EQUAL(p -> id, self)) { - int res; - me = p; p -> next = 0; # ifdef GC_DARWIN_THREADS @@ -742,6 +740,9 @@ STATIC void GC_remove_all_threads_but_me(void) me -> kernel_id = gettid(); # endif # if defined(THREAD_LOCAL_ALLOC) && !defined(USE_CUSTOM_SPECIFIC) + { + int res; + /* Some TLS implementations might be not fork-friendly, so */ /* we re-assign thread-local pointer to 'tlfs' for safety */ /* instead of the assertion check (again, it is OK to call */ @@ -749,6 +750,7 @@ STATIC void GC_remove_all_threads_but_me(void) res = GC_setspecific(GC_thread_key, &me->tlfs); if (COVERT_DATAFLOW(res) != 0) ABORT("GC_setspecific failed (in child)"); + } # endif } else { # ifdef THREAD_LOCAL_ALLOC