]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[debug] Don't define g_debuglevel in the kernel
authorNick Terrell <terrelln@meta.com>
Fri, 17 Nov 2023 01:15:25 +0000 (17:15 -0800)
committerNick Terrell <nickrterrell@gmail.com>
Fri, 17 Nov 2023 17:54:10 +0000 (09:54 -0800)
We only use this constant when `DEBUGLEVEL>=2`, but we get
-Werror=pedantic errors for empty translation units, so still define it
except in kernel environments.

Backport from the kernel:

https://lore.kernel.org/lkml/20230616144400.172683-1-ben.dooks@codethink.co.uk/

lib/common/debug.c

index ebf7bfccfa6f964b8dbf4eab82ec64d4850d1d5a..9d0b7d229c14ca63dc365c53b2089570ae958e43 100644 (file)
 
 #include "debug.h"
 
+#if !defined(ZSTD_LINUX_KERNEL) || (DEBUGLEVEL>=2)
+/* We only use this when DEBUGLEVEL>=2, but we get -Werror=pedantic errors if a
+ * translation unit is empty. So remove this from Linux kernel builds, but
+ * otherwise just leave it in.
+ */
 int g_debuglevel = DEBUGLEVEL;
+#endif