summaryrefslogtreecommitdiffstats
path: root/src/config.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-11-15 10:04:57 -0500
committerTavian Barnes <tavianator@tavianator.com>2023-11-15 10:04:57 -0500
commitf4e8084414e07a8e03cb279090bbcf9eea76ed1e (patch)
treeabdd3472df66c5661e494a0e5bf358b1ee8124ea /src/config.h
parentfb4760db85c552b0f538f7af2ad40fa631c20540 (diff)
downloadbfs-f4e8084414e07a8e03cb279090bbcf9eea76ed1e.tar.xz
config: New attr_maybe_unused macro
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/config.h b/src/config.h
index a474fb3..9f95674 100644
--- a/src/config.h
+++ b/src/config.h
@@ -186,7 +186,7 @@ typedef long double max_align_t;
// Wrappers for attributes
/**
- * Silence compiler warnings about switch/case fall-throughs.
+ * Silence warnings about switch/case fall-throughs.
*/
#if __has_c_attribute(fallthrough)
# define fallthru [[fallthrough]]
@@ -197,6 +197,17 @@ typedef long double max_align_t;
#endif
/**
+ * Silence warnings about unused declarations.
+ */
+#if __has_c_attribute(maybe_unused)
+# define attr_maybe_unused [[maybe_unused]]
+#elif __has_attribute(unused)
+# define attr_maybe_unused __attribute__((unused))
+#else
+# define attr_maybe_unused
+#endif
+
+/**
* Warn if a value is unused.
*/
#if __has_c_attribute(nodiscard)