Workaround 'name var reassign before old value use' cppcheck false positive
authorIvan Maidanski <ivmai@mail.ru>
Thu, 6 Dec 2018 08:14:37 +0000 (11:14 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 6 Dec 2018 08:14:37 +0000 (11:14 +0300)
* os_dep.c [NEED_CALLINFO && LINUX && !SMALL_CONFIG && CPPCHECK]
(GC_print_callers): Call GC_noop1(name[0]) before reassigning name;
add comment.

os_dep.c

index 6d01684..5cbf8de 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -4794,6 +4794,10 @@ GC_INNER void GC_print_callers(struct callinfo info[NFRAMES])
                                  " [0x%lx]", (unsigned long)info[i].ci_pc);
                   result_buf[sizeof(result_buf) - 1] = '\0';
                 }
+#               if defined(CPPCHECK)
+                  GC_noop1((unsigned char)name[0]);
+                                /* name computed previously is discarded */
+#               endif
                 name = result_buf;
                 pclose(pipe);
                 out:;