From b51bdee1ff7a561a1efb8a2ec514e79be1dfec98 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 30 Jan 2018 11:11:45 +0300 Subject: [PATCH] Workaround 'address of auto-variable returned' cppcheck error * mark_rts.c [CPPCHECK] (GC_approx_sp): Use __builtin_frame_address. * mark_rts.c (GC_approx_sp): Replace GC_GNUC_PREREQ(4,0) with __GNUC__>=4; add TODO item. --- mark_rts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mark_rts.c b/mark_rts.c index 5aca8be6..d585f384 100644 --- a/mark_rts.c +++ b/mark_rts.c @@ -391,7 +391,8 @@ STATIC void GC_remove_tmp_roots(void) GC_INNER ptr_t GC_approx_sp(void) { volatile word sp; -# if GC_GNUC_PREREQ(4, 0) +# if defined(CPPCHECK) || (__GNUC__ >= 4) /* GC_GNUC_PREREQ(4, 0) */ + /* TODO: Use GC_GNUC_PREREQ after fixing a bug in cppcheck. */ sp = (word)__builtin_frame_address(0); # else sp = (word)&sp; -- 2.40.0