From: Ivan Maidanski Date: Fri, 4 Oct 2019 20:25:19 +0000 (+0300) Subject: Workaround 'condition *flh==0 is always true' cppcheck false positive X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=890ad2c9930458392e19bba7964c69a405b6d3e0;p=gc Workaround 'condition *flh==0 is always true' cppcheck false positive * alloc.c [CPPCHECK] (GC_allocobj): Call GC_noop1(flh) between *flh==0 checks. --- diff --git a/alloc.c b/alloc.c index 75e71cfb..0a221c46 100644 --- a/alloc.c +++ b/alloc.c @@ -1604,9 +1604,15 @@ GC_INNER ptr_t GC_allocobj(size_t gran, int kind) || NULL == GC_obj_kinds[kind].ok_reclaim_list[gran]); GC_continue_reclaim(gran, kind); EXIT_GC(); - if (*flh == 0) { +# if defined(CPPCHECK) + GC_noop1((word)flh); +# endif + if (NULL == *flh) { GC_new_hblk(gran, kind); - if (*flh == 0) { +# if defined(CPPCHECK) + GC_noop1((word)flh); +# endif + if (NULL == *flh) { ENTER_GC(); if (GC_incremental && GC_time_limit == GC_TIME_UNLIMITED && !tried_minor) {