]> granicus.if.org Git - gc/commitdiff
Workaround 'if condition is the same as the previous one' cppcheck warnings
authorIvan Maidanski <ivmai@mail.ru>
Tue, 15 Jan 2019 16:52:15 +0000 (19:52 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 15 Jan 2019 16:52:15 +0000 (19:52 +0300)
* alloc.c [THREAD_LOCAL_ALLOC] (GC_stopped_mark): Set GC_world_stopped
to FALSE after GC_on_collection_event(GC_EVENT_PRE_START_WORLD).
* alloc.c [THREAD_LOCAL_ALLOC] (GC_stopped_mark): Collapse adjacent
"if" statements.
* mark.c [!GC_DISABLE_INCREMENTAL] (GC_initiate_gc): Likewise.
* pthread_stop_world.c [!NACL && !GC_OPENBSD_UTHREADS
&& !GC_NETBSD_THREADS_WORKAROUND] (GC_start_world): Likewise.

alloc.c
mark.c
pthread_stop_world.c

diff --git a/alloc.c b/alloc.c
index 5259cb872a9df86621f389aa873ef244af27203c..840e1704617fb471c6cc762355323563c2dc1050 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -832,18 +832,16 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
     if (GC_debugging_started) {
       (*GC_check_heap)();
     }
-    if (GC_on_collection_event)
+    if (GC_on_collection_event) {
       GC_on_collection_event(GC_EVENT_MARK_END);
-
+#     ifdef THREADS
+        GC_on_collection_event(GC_EVENT_PRE_START_WORLD);
+#     endif
+    }
 #   ifdef THREAD_LOCAL_ALLOC
       GC_world_stopped = FALSE;
 #   endif
 
-#   ifdef THREADS
-      if (GC_on_collection_event)
-        GC_on_collection_event(GC_EVENT_PRE_START_WORLD);
-#   endif
-
     START_WORLD();
 
 #   ifdef THREADS
diff --git a/mark.c b/mark.c
index 72223bb61f6b85ff1b38a6358320b2c0207d6040..9cc9d11c7c1766840d14c51edc4ade00a83de72b 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -253,15 +253,11 @@ GC_INNER void GC_initiate_gc(void)
         if (GC_incremental) {
 #         ifdef CHECKSUMS
             GC_read_dirty(FALSE);
+            GC_check_dirty();
 #         else
             GC_read_dirty(GC_mark_state == MS_INVALID);
 #         endif
         }
-#   endif
-#   ifdef CHECKSUMS
-        if (GC_incremental) GC_check_dirty();
-#   endif
-#   if !defined(GC_DISABLE_INCREMENTAL)
         GC_n_rescuing_pages = 0;
 #   endif
     if (GC_mark_state == MS_NONE) {
index 4b2c429751eb6609642ce4ff6e0f97c1d5cf00ec..fd1b6073dcfc5ac8c91613a93f369c67a147001c 100644 (file)
@@ -1179,17 +1179,17 @@ GC_INNER void GC_start_world(void)
                     /* the list of functions which synchronize memory). */
 #   endif
     n_live_threads = GC_restart_all();
-#   ifndef GC_OPENBSD_UTHREADS
+#   ifdef GC_OPENBSD_UTHREADS
+      (void)n_live_threads;
+#   elif defined(GC_NETBSD_THREADS_WORKAROUND)
       if (GC_retry_signals)
         n_live_threads = resend_lost_signals(n_live_threads, GC_restart_all);
-#     ifdef GC_NETBSD_THREADS_WORKAROUND
-        suspend_restart_barrier(n_live_threads);
-#     else
-        if (GC_retry_signals)
-          suspend_restart_barrier(n_live_threads);
-#     endif
+      suspend_restart_barrier(n_live_threads);
 #   else
-      (void)n_live_threads;
+      if (GC_retry_signals) {
+        n_live_threads = resend_lost_signals(n_live_threads, GC_restart_all);
+        suspend_restart_barrier(n_live_threads);
+      }
 #   endif
 #   ifdef DEBUG_THREADS
       GC_log_printf("World started\n");