]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Silence compiler warnings in gc.c (#117422)
authorGuido van Rossum <guido@python.org>
Mon, 1 Apr 2024 16:13:38 +0000 (09:13 -0700)
committerGitHub <noreply@github.com>
Mon, 1 Apr 2024 16:13:38 +0000 (16:13 +0000)
Python/gc.c

index 36e20d05c205a5f2ff1217d72e23dfe3cdd10468..a37c1b144e57e9aaa577c55c15955d90e4f863f3 100644 (file)
@@ -1317,6 +1317,7 @@ gc_collect_young(PyThreadState *tstate,
             survivor_count++;
         }
     }
+    (void)survivor_count;  // Silence compiler warning
     gc_list_merge(&survivors, visited);
     validate_old(gcstate);
     gcstate->young.count = 0;
@@ -1329,12 +1330,14 @@ gc_collect_young(PyThreadState *tstate,
     add_stats(gcstate, 0, stats);
 }
 
+#ifndef NDEBUG
 static inline int
 IS_IN_VISITED(PyGC_Head *gc, int visited_space)
 {
     assert(visited_space == 0 || flip_old_space(visited_space) == 0);
     return gc_old_space(gc) == visited_space;
 }
+#endif
 
 struct container_and_flag {
     PyGC_Head *container;