From a6b25ee92adcde3398f27456eb1f09788133edda Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 25 Oct 2016 11:37:40 +0300 Subject: [PATCH] Workaround 'condition is always false' cppcheck warning in get_next_stack * win32_threads.c [CPPCHECK] (GC_get_next_stack): Set thread a non-null value (near current_min assignment) even if GC_win32_dll_threads (to avoid cppcheck complain that if(thread!=0) is always false (thus UNPROTECT_THREAD(thread) is never reached) if GC_DISCOVER_TASK_THREADS. --- win32_threads.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/win32_threads.c b/win32_threads.c index 14ac9d6..60f2f63 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1617,6 +1617,10 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, plast_stack_min = (ptr_t * /* no volatile */) &dll_thread_table[i].last_stack_min; current_min = s; +# if defined(CPPCHECK) + /* To avoid a warning that thread is always null. */ + thread = (GC_thread)&dll_thread_table[i]; +# endif } } } else { -- 2.7.4