From 109faef380b2b26b5ceb507d9427f04e0a7719f6 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sat, 22 Oct 2016 01:11:30 +0300 Subject: [PATCH] Eliminate 'value of GC_RETURN_ADDR_PARENT unknown' cppcheck info messages * dbg_mlc.c [GC_ADD_CALLER]: Replace defined(GC_RETURN_ADDR_PARENT) with defined(GC_HAVE_RETURN_ADDR_PARENT). * include/private/gc_priv.h (GC_DBG_EXTRAS): Likewise. * include/gc_config_macros.h [GC_RETURN_ADDR_PARENT] (GC_HAVE_RETURN_ADDR_PARENT): New macro. --- dbg_mlc.c | 2 +- include/gc_config_macros.h | 1 + include/private/gc_priv.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dbg_mlc.c b/dbg_mlc.c index bd8590c1..7a6ac460 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -503,7 +503,7 @@ GC_API void GC_CALL GC_debug_register_displacement(size_t offset) } #ifdef GC_ADD_CALLER -# if defined(HAVE_DLADDR) && defined(GC_RETURN_ADDR_PARENT) +# if defined(HAVE_DLADDR) && defined(GC_HAVE_RETURN_ADDR_PARENT) # include STATIC void GC_caller_func_offset(word ad, const char **symp, int *offp) diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h index 0009b7be..9f7f7d74 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h @@ -330,6 +330,7 @@ # define GC_RETURN_ADDR (GC_word)__builtin_return_address(0) # if (__GNUC__ >= 4) && (defined(__i386__) || defined(__amd64__) \ || defined(__x86_64__) /* and probably others... */) +# define GC_HAVE_RETURN_ADDR_PARENT # define GC_RETURN_ADDR_PARENT \ (GC_word)__builtin_extract_return_addr(__builtin_return_address(1)) # endif diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 62ac0e38..1207b80f 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1892,7 +1892,7 @@ GC_INNER ptr_t GC_allocobj(size_t sz, int kind); /* GC_DBG_EXTRAS is used by GC debug API functions (unlike GC_EXTRAS */ /* used by GC debug API macros) thus GC_RETURN_ADDR_PARENT (pointing */ /* to client caller) should be used if possible. */ -# ifdef GC_RETURN_ADDR_PARENT +# ifdef GC_HAVE_RETURN_ADDR_PARENT # define GC_DBG_EXTRAS GC_RETURN_ADDR_PARENT, NULL, 0 # else # define GC_DBG_EXTRAS GC_RETURN_ADDR, NULL, 0 -- 2.40.0