From 94ea02e1f551c57bcde284f38b76711cd4b36dc4 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 29 Sep 2024 00:13:39 +0300 Subject: [PATCH] Define a single macro which includes all GC_ATTR_NO_SANITIZE_x (refactoring) Issue #364 (bdwgc). * include/private/gc_priv.h (GC_ATTR_NO_SANITIZE_ADDR_MEM_THREAD): Define macro. * mark.c (GC_mark_from, GC_push_all_eager): Use GC_ATTR_NO_SANITIZE_ADDR_MEM_THREAD instead of GC_ATTR_NO_SANITIZE_ADDR, GC_ATTR_NO_SANITIZE_MEMORY and GC_ATTR_NO_SANITIZE_THREAD. * mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager): Likewise. --- include/private/gc_priv.h | 4 ++++ mark.c | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 17c233b1b..501bdd289 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -228,6 +228,10 @@ typedef struct hblkhdr hdr; # endif #endif /* !GC_ATTR_NO_SANITIZE_THREAD */ +#define GC_ATTR_NO_SANITIZE_ADDR_MEM_THREAD \ + GC_ATTR_NO_SANITIZE_ADDR GC_ATTR_NO_SANITIZE_MEMORY \ + GC_ATTR_NO_SANITIZE_THREAD + #ifndef UNUSED_ARG # define UNUSED_ARG(arg) ((void)(arg)) #endif diff --git a/mark.c b/mark.c index aae86d968..6c5651524 100644 --- a/mark.c +++ b/mark.c @@ -650,7 +650,7 @@ STATIC mse * GC_signal_mark_stack_overflow(mse *msp) * encoding, we optionally maintain a cache for the block address to * header mapping, we prefetch when an object is "grayed", etc. */ -GC_ATTR_NO_SANITIZE_ADDR GC_ATTR_NO_SANITIZE_MEMORY GC_ATTR_NO_SANITIZE_THREAD +GC_ATTR_NO_SANITIZE_ADDR_MEM_THREAD GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, mse *mark_stack_limit) { @@ -1639,7 +1639,7 @@ GC_INNER void /* A version of GC_push_all that treats all interior pointers as valid */ /* and scans the entire region immediately, in case the contents */ /* change. */ -GC_ATTR_NO_SANITIZE_ADDR GC_ATTR_NO_SANITIZE_MEMORY GC_ATTR_NO_SANITIZE_THREAD +GC_ATTR_NO_SANITIZE_ADDR_MEM_THREAD GC_API void GC_CALL GC_push_all_eager(void *bottom, void *top) { REGISTER ptr_t current_p; @@ -1683,8 +1683,7 @@ GC_INNER void GC_push_all_stack(ptr_t bottom, ptr_t top) #if defined(WRAP_MARK_SOME) && defined(PARALLEL_MARK) /* Similar to GC_push_conditional but scans the whole region immediately. */ - GC_ATTR_NO_SANITIZE_ADDR GC_ATTR_NO_SANITIZE_MEMORY - GC_ATTR_NO_SANITIZE_THREAD + GC_ATTR_NO_SANITIZE_ADDR_MEM_THREAD GC_INNER void GC_push_conditional_eager(void *bottom, void *top, GC_bool all) {