From: Ivan Maidanski Date: Wed, 19 Dec 2018 19:50:57 +0000 (+0300) Subject: Eliminate 'stop variable is always 0' compiler warning in print_callers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0031a614c3154d574dd55b4e32c141130a65afb1;p=gc Eliminate 'stop variable is always 0' compiler warning in print_callers * 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. --- diff --git a/os_dep.c b/os_dep.c index 8477f3a7..f71469c4 100644 --- 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;