]> granicus.if.org Git - gc/commitdiff
Workaround 'uninitialized variable: info' cppcheck false positive (OS X)
authorIvan Maidanski <ivmai@mail.ru>
Thu, 14 Feb 2019 20:17:36 +0000 (23:17 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 14 Feb 2019 20:17:36 +0000 (23:17 +0300)
* darwin_stop_world.c [DEBUG_THREADS && CPPCHECK] (GC_thread_resume):
Initialize info.run_state value (to 0) before thread_info() call.

darwin_stop_world.c

index 2872bc03c43ec944d6b2418e5f87bbac4e46e88d..05463461062abb87c55b9e4acf039206e1735d78 100644 (file)
@@ -658,6 +658,9 @@ GC_INLINE void GC_thread_resume(thread_act_t thread)
     struct thread_basic_info info;
     mach_msg_type_number_t outCount = THREAD_BASIC_INFO_COUNT;
 
+#   if defined(CPPCHECK) && defined(DEBUG_THREADS)
+      info.run_state = 0;
+#   endif
     kern_result = thread_info(thread, THREAD_BASIC_INFO,
                               (thread_info_t)&info, &outCount);
     if (kern_result != KERN_SUCCESS)