From: Ivan Maidanski Date: Tue, 25 Oct 2016 08:37:40 +0000 (+0300) Subject: Workaround 'condition is always false' cppcheck warning in get_next_stack X-Git-Tag: v8.0.0~1076 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6b25ee92adcde3398f27456eb1f09788133edda;p=gc 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. --- diff --git a/win32_threads.c b/win32_threads.c index 14ac9d60..60f2f63d 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 {