aboutsummaryrefslogtreecommitdiff
path: root/src/zenbase/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenbase/include')
-rw-r--r--src/zenbase/include/zenbase/zenbase.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/zenbase/include/zenbase/zenbase.h b/src/zenbase/include/zenbase/zenbase.h
index 2aec1f314..1d5051c5b 100644
--- a/src/zenbase/include/zenbase/zenbase.h
+++ b/src/zenbase/include/zenbase/zenbase.h
@@ -211,7 +211,24 @@ char (&ZenArrayCountHelper(const T (&)[N]))[N + 1];
# define ZEN_EXE_SUFFIX_LITERAL ""
#endif
-#define ZEN_UNUSED(...) ((void)__VA_ARGS__)
+#if ZEN_COMPILER_CLANG
+// Clang warns about the comma operator in ((void)a, b) with -Wunused-value.
+// Use a fold expression via a helper to suppress each argument individually.
+namespace zen::detail {
+inline void
+unused_impl()
+{
+}
+template<typename... T>
+inline void
+unused_impl(T&&...)
+{
+}
+} // namespace zen::detail
+# define ZEN_UNUSED(...) ::zen::detail::unused_impl(__VA_ARGS__)
+#else
+# define ZEN_UNUSED(...) ((void)__VA_ARGS__)
+#endif
//////////////////////////////////////////////////////////////////////////