diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-06-19 16:56:56 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-06-20 14:09:46 -0400 |
commit | e062158e0a855cddcd3838fef415a7531929686b (patch) | |
tree | b1d594e8ab791565c5efd468dc8e0b02f35c2af1 /src | |
parent | cf2682b4012c397dec79c4998713dfe12744b1a1 (diff) | |
download | bfs-e062158e0a855cddcd3838fef415a7531929686b.tar.xz |
sanity: Suppress unused variable warnings with sanitizers off
Diffstat (limited to 'src')
-rw-r--r-- | src/sanity.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sanity.h b/src/sanity.h index f2cf0a4..29b3519 100644 --- a/src/sanity.h +++ b/src/sanity.h @@ -73,11 +73,16 @@ #define sanitize_uninit(...) SANITIZE_CALL(__msan_allocated_memory, __VA_ARGS__) #else -# define sanitize_init(...) ((void)0) -# define sanitize_uninit(...) ((void)0) +# define sanitize_init(...) SANITIZE_CALL(sanitize_ignore, __VA_ARGS__) +# define sanitize_uninit(...) SANITIZE_CALL(sanitize_ignore, __VA_ARGS__) #endif /** + * Squelch unused variable warnings when not sanitizing. + */ +#define sanitize_ignore(ptr, size) ((void)(ptr), (void)(size)) + +/** * Initialize a variable, unless sanitizers would detect uninitialized uses. */ #if SANITIZE_MEMORY |