summaryrefslogtreecommitdiffstats
path: root/src/config.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-12-09 12:51:00 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-12-09 12:51:00 -0500
commite477e12ade9544c31779f007faee169aae22e145 (patch)
tree5c120f93435a5e0c5c09fd2b9f2cdadbe5cff2c3 /src/config.h
parentee5d250d27bb1def69077a784bfeb2b444735448 (diff)
downloadbfs-e477e12ade9544c31779f007faee169aae22e145.tar.xz
config: New BFS_UNINIT() macro for intentionally uninitialized variables
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/config.h b/src/config.h
index 229f593..810f913 100644
--- a/src/config.h
+++ b/src/config.h
@@ -213,4 +213,13 @@
# define BFS_UNSUPPRESS()
#endif
+/**
+ * Initialize a variable, unless sanitizers would detect uninitialized uses.
+ */
+#if __has_feature(memory_sanitizer)
+# define BFS_UNINIT(var, value) var = var
+#else
+# define BFS_UNINIT(var, value) var = value
+#endif
+
#endif // BFS_CONFIG_H