From 9ec0f5f6c1853ff3e63546e0009b98aebb8ee546 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 21 Oct 2016 20:27:51 +0300 Subject: [PATCH] Eliminate 'value of NEED_FIXUP_POINTER unknown' cppcheck info messages * include/private/gc_pmark.h: Replace #if NEED_FIXUP_POINTER to #ifdef NEED_FIXUP_POINTER. * include/private/gcconfig.h (NEED_FIXUP_POINTER): If FIXUP_POINTER then define to empty else leave undefined. * mark.c (GC_push_all_stack): Replace if(!NEED_FIXUP_POINTER) to #ifndef NEED_FIXUP_POINTER. * mark_rts.c (GC_push_all_stack_partially_eager): Likewise. --- include/private/gc_pmark.h | 2 +- include/private/gcconfig.h | 3 +-- mark.c | 9 ++++++--- mark_rts.c | 7 +++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/private/gc_pmark.h b/include/private/gc_pmark.h index 1cfa5ad..65f7ef8 100644 --- a/include/private/gc_pmark.h +++ b/include/private/gc_pmark.h @@ -359,7 +359,7 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp); * if the mark stack overflows. */ -#if NEED_FIXUP_POINTER +#ifdef NEED_FIXUP_POINTER /* Try both the raw version and the fixed up one. */ # define GC_PUSH_ONE_STACK(p, source) \ do { \ diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index fddc5c4..c977b89 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -3136,9 +3136,8 @@ #endif #if defined(FIXUP_POINTER) -# define NEED_FIXUP_POINTER 1 +# define NEED_FIXUP_POINTER #else -# define NEED_FIXUP_POINTER 0 # define FIXUP_POINTER(p) #endif diff --git a/mark.c b/mark.c index f86c986..8b999aa 100644 --- a/mark.c +++ b/mark.c @@ -1558,9 +1558,12 @@ GC_INNER void GC_push_all_stack(ptr_t bottom, ptr_t top) # if defined(THREADS) && defined(MPROTECT_VDB) GC_push_all_eager(bottom, top); # else - if (!NEED_FIXUP_POINTER && GC_all_interior_pointers) { - GC_push_all(bottom, top); - } else { +# ifndef NEED_FIXUP_POINTER + if (GC_all_interior_pointers) { + GC_push_all(bottom, top); + } else +# endif + /* else */ { GC_push_all_eager(bottom, top); } # endif diff --git a/mark_rts.c b/mark_rts.c index feead46..6186807 100644 --- a/mark_rts.c +++ b/mark_rts.c @@ -591,7 +591,8 @@ GC_INNER void GC_push_all_stack_sections(ptr_t lo, ptr_t hi, STATIC void GC_push_all_stack_partially_eager(ptr_t bottom, ptr_t top, ptr_t cold_gc_frame) { - if (!NEED_FIXUP_POINTER && GC_all_interior_pointers) { +#ifndef NEED_FIXUP_POINTER + if (GC_all_interior_pointers) { /* Push the hot end of the stack eagerly, so that register values */ /* saved inside GC frames are marked before they disappear. */ /* The rest of the marking can be deferred until later. */ @@ -608,7 +609,9 @@ STATIC void GC_push_all_stack_partially_eager(ptr_t bottom, ptr_t top, GC_push_all(bottom, cold_gc_frame + sizeof(ptr_t)); GC_push_all_eager(cold_gc_frame, top); # endif /* STACK_GROWS_UP */ - } else { + } else +#endif + /* else */ { GC_push_all_eager(bottom, top); } # ifdef TRACE_BUF -- 2.7.4