summaryrefslogtreecommitdiffstats
path: root/src/sanity.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-06-19 16:56:56 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-06-20 14:09:46 -0400
commite062158e0a855cddcd3838fef415a7531929686b (patch)
treeb1d594e8ab791565c5efd468dc8e0b02f35c2af1 /src/sanity.h
parentcf2682b4012c397dec79c4998713dfe12744b1a1 (diff)
downloadbfs-e062158e0a855cddcd3838fef415a7531929686b.tar.xz
sanity: Suppress unused variable warnings with sanitizers off
Diffstat (limited to 'src/sanity.h')
-rw-r--r--src/sanity.h9
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