summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-11-29 01:05:26 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-11-29 01:08:09 +0300
commit945afca717982db4363e6241a5da80a5999afed2 (patch)
treefbcadda722b2d827122f65767aef6564c43ae210
parent53aa42b3a1fedb85c191600a7aa5190f6b53cd28 (diff)
downloadbdwgc-945afca717982db4363e6241a5da80a5999afed2.tar.gz
Workaround 'var reassigned before old value use' cppcheck false positive
* extra/AmigaOS.c [!GC_AMIGA_ONLYFAST && CPPCHECK] (GC_amiga_allocwrapper_any): Add a dummy read of GC_amiga_dontalloc global variable; add comment. * pthread_support.c [CPPCHECK] (GC_do_blocking_inner): Add a dummy read of thread_blocked field of GC_thread. * pthread_support.c [CPPCHECK] (GC_call_with_gc_active): Add a dummy read of traced_stack_sect field of GC_thread.
-rw-r--r--extra/AmigaOS.c3
-rw-r--r--pthread_support.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/extra/AmigaOS.c b/extra/AmigaOS.c
index d8311eed..1daaa0ac 100644
--- a/extra/AmigaOS.c
+++ b/extra/AmigaOS.c
@@ -425,6 +425,9 @@ void *GC_amiga_allocwrapper_any(size_t size,void *(*AllocFunction)(size_t size2)
#endif
}
+# if defined(CPPCHECK)
+ if (GC_amiga_dontalloc) /* variable is actually used by AllocFunction */
+# endif
GC_amiga_dontalloc=FALSE;
return ret;
diff --git a/pthread_support.c b/pthread_support.c
index 61e0a10e..0ebe1b48 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -1392,6 +1392,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((unsigned)me->thread_blocked);
+# endif
me -> thread_blocked = FALSE;
# if defined(GC_DARWIN_THREADS) && !defined(DARWIN_DONT_PARSE_STACK)
if (topOfStackUnset)
@@ -1455,6 +1458,9 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
GC_ASSERT(me -> traced_stack_sect == &stacksect);
/* Restore original "stack section". */
+# if defined(CPPCHECK)
+ GC_noop1((word)me->traced_stack_sect);
+# endif
LOCK();
me -> traced_stack_sect = stacksect.prev;
# ifdef IA64