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 76dab59..b9d92b9 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 a9053a7..2c64da9 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.                                           */