]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
switched to a sizeof() version 1211/head
authorYann Collet <cyan@fb.com>
Tue, 26 Jun 2018 21:08:35 +0000 (14:08 -0700)
committerYann Collet <cyan@fb.com>
Tue, 26 Jun 2018 21:08:35 +0000 (14:08 -0700)
avoid -Werror=unused-variable issue

lib/common/debug.h

index 9b5878cfcd36321a58b65a33204e80e9b1d50c01..0c04ad2cc98c4b949035141c56a6385ed9797012 100644 (file)
@@ -58,8 +58,9 @@ extern "C" {
 
 
 /* static assert is triggered at compile time, leaving no runtime artefact,
- * but can only work with compile-time constants */
-#define DEBUG_STATIC_ASSERT(c) { extern char DEBUG_static_assert[(c) ? 1 : -1]; }
+ * but can only work with compile-time constants.
+ * This variant can only be used inside a function. */
+#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
 
 
 /* DEBUGLEVEL is expected to be defined externally,