From: Ivan Maidanski Date: Tue, 18 Oct 2016 21:42:29 +0000 (+0300) Subject: Workaround 'variable reassigned before old value used' cppcheck warnings X-Git-Tag: v8.0.0~1094 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6970a6261cb8c13d167b1d2bb0e7bfd24e21c48;p=platform%2Fupstream%2Flibgc.git Workaround 'variable reassigned before old value used' cppcheck warnings * misc.c (GC_call_with_gc_active): Call GC_noop1 for GC_traced_stack_sect and GC_blocked_sp (before restoring their original values) if CPPCHECK. * win32_threads.c (GC_do_blocking_inner): Call GC_noop1 for thread_blocked_sp field (before restoring its original value) if CPPCHECK. * win32_threads.c (GC_call_with_gc_active): Call GC_noop1 for traced_stack_sect field (before restoring its original value) if CPPCHECK. --- diff --git a/misc.c b/misc.c index 33131bd..7c6b1cd 100644 --- a/misc.c +++ b/misc.c @@ -1991,6 +1991,9 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, GC_ASSERT(GC_blocked_sp == NULL); GC_ASSERT(GC_traced_stack_sect == &stacksect); +# if defined(CPPCHECK) + GC_noop1((word)GC_traced_stack_sect - (word)GC_blocked_sp); +# endif /* Restore original "stack section". */ GC_traced_stack_sect = stacksect.prev; # ifdef IA64 @@ -2023,6 +2026,9 @@ STATIC void GC_do_blocking_inner(ptr_t data, void * context GC_ATTR_UNUSED) # else GC_ASSERT(GC_blocked_sp == (ptr_t) &d); # endif +# if defined(CPPCHECK) + GC_noop1((word)GC_blocked_sp); +# endif GC_blocked_sp = NULL; } diff --git a/win32_threads.c b/win32_threads.c index afd33c2..b801595 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -877,6 +877,9 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void * context GC_ATTR_UNUSED) UNLOCK(); d -> client_data = (d -> fn)(d -> client_data); LOCK(); /* This will block if the world is stopped. */ +# if defined(CPPCHECK) + GC_noop1((word)me->thread_blocked_sp); +# endif me -> thread_blocked_sp = NULL; UNLOCK(); } @@ -931,6 +934,9 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, /* Restore original "stack section". */ LOCK(); +# if defined(CPPCHECK) + GC_noop1((word)me->traced_stack_sect); +# endif me -> traced_stack_sect = stacksect.prev; # ifdef IA64 me -> backing_store_ptr = stacksect.saved_backing_store_ptr;