]> granicus.if.org Git - gc/commitdiff
Eliminate 'stop variable is always 0' compiler warning in print_callers
authorIvan Maidanski <ivmai@mail.ru>
Wed, 19 Dec 2018 19:50:57 +0000 (22:50 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 19 Dec 2018 19:50:57 +0000 (22:50 +0300)
* os_dep.c [NEED_CALLINFO] (GC_print_callers): Declare (and use value
of) stop local variable only if LINUX && !SMALL_CONFIG; move stop local
variable to the scope of its use.

os_dep.c

index 8477f3a7bc17496c7cb21bb6b5b88247326577b4..f71469c4d11accafe6523487a2100a90b8c1c652 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -4654,7 +4654,6 @@ GC_INNER void GC_print_callers(struct callinfo info[NFRAMES])
 {
     int i;
     static int reentry_count = 0;
-    GC_bool stop = FALSE;
     DCL_LOCK_STATE;
 
     /* FIXME: This should probably use a different lock, so that we     */
@@ -4668,8 +4667,13 @@ GC_INNER void GC_print_callers(struct callinfo info[NFRAMES])
 #   else
       GC_err_printf("\tCall chain at allocation:\n");
 #   endif
-    for (i = 0; i < NFRAMES && !stop; i++) {
-        if (info[i].ci_pc == 0) break;
+    for (i = 0; i < NFRAMES; i++) {
+#       if defined(LINUX) && !defined(SMALL_CONFIG)
+          GC_bool stop = FALSE;
+#       endif
+
+        if (0 == info[i].ci_pc)
+          break;
 #       if NARGS > 0
         {
           int j;
@@ -4811,6 +4815,10 @@ GC_INNER void GC_print_callers(struct callinfo info[NFRAMES])
               free(sym_name);   /* May call GC_[debug_]free; that's OK  */
 #         endif
         }
+#       if defined(LINUX) && !defined(SMALL_CONFIG)
+          if (stop)
+            break;
+#       endif
     }
     LOCK();
       --reentry_count;