]> granicus.if.org Git - gc/commitdiff
Workaround 'me assigned value never used' cppcheck FP in register_my_thread
authorIvan Maidanski <ivmai@mail.ru>
Sat, 29 Dec 2018 07:12:44 +0000 (10:12 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 29 Dec 2018 07:12:44 +0000 (10:12 +0300)
* pthread_support.c [CPPCHECK] (GC_register_my_thread): Call
GC_noop1(me->flags) after reassigning me to the result of
GC_register_my_thread_inner(sb,self).
* win32_threads.c [CPPCHECK] (GC_register_my_thread): Likewise.

pthread_support.c
win32_threads.c

index 76dab59f068e07fdfb322d3e0f40ebd076433b87..b9d92b9ea327c2854bd2b064552335a57a9c1a6c 100644 (file)
@@ -1726,6 +1726,9 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
     me = GC_lookup_thread(self);
     if (0 == me) {
         me = GC_register_my_thread_inner(sb, self);
+#       if defined(CPPCHECK)
+          GC_noop1(me->flags);
+#       endif
         me -> flags |= DETACHED;
           /* Treat as detached, since we do not need to worry about     */
           /* pointer results.                                           */
index a9053a7767d92337959d35dead1e18bf99de03a8..2c64da9cf358ed6c728de5d9957687b02545c736 100644 (file)
@@ -764,6 +764,9 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
   if (me == 0) {
 #   ifdef GC_PTHREADS
       me = GC_register_my_thread_inner(sb, thread_id);
+#     if defined(CPPCHECK)
+        GC_noop1(me->flags);
+#     endif
       me -> flags |= DETACHED;
           /* Treat as detached, since we do not need to worry about     */
           /* pointer results.                                           */