From: Ivan Maidanski Date: Tue, 13 Sep 2016 18:04:47 +0000 (+0300) Subject: Eliminate 'assigned value never used' CSA warning in min_bytes_allocd X-Git-Tag: v7.6.2~395 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b30353087e348448134b767d35232c838efb1b1d;p=gc Eliminate 'assigned value never used' CSA warning in min_bytes_allocd The warning was reported only if GC_ALWAYS_MULTITHREADED. * alloc.c (min_bytes_allocd): Assign stack_size value for the single-threaded case only if GC_need_to_lock is false. --- diff --git a/alloc.c b/alloc.c index 41e4a804..e9de9113 100644 --- a/alloc.c +++ b/alloc.c @@ -202,15 +202,7 @@ GC_API GC_stop_func GC_CALL GC_get_stop_func(void) static word min_bytes_allocd(void) { word result; -# ifdef STACK_NOT_SCANNED - word stack_size = 0; -# elif defined(STACK_GROWS_UP) - word stack_size = GC_approx_sp() - GC_stackbottom; - /* GC_stackbottom is used only for a single-threaded case. */ -# else - word stack_size = GC_stackbottom - GC_approx_sp(); -# endif - + word stack_size; word total_root_size; /* includes double stack size, */ /* since the stack is expensive */ /* to scan. */ @@ -226,8 +218,17 @@ static word min_bytes_allocd(void) GC_log_printf("Total stacks size: %lu\n", (unsigned long)stack_size); # endif - } + } else # endif + /* else*/ { +# ifdef STACK_NOT_SCANNED + stack_size = 0; +# elif defined(STACK_GROWS_UP) + stack_size = GC_approx_sp() - GC_stackbottom; +# else + stack_size = GC_stackbottom - GC_approx_sp(); +# endif + } total_root_size = 2 * stack_size + GC_root_size; scan_size = 2 * GC_composite_in_use + GC_atomic_in_use / 4