From: Nick Terrell Date: Fri, 17 Nov 2023 01:15:25 +0000 (-0800) Subject: [debug] Don't define g_debuglevel in the kernel X-Git-Tag: v1.5.6^2~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e122fcbf58e142e837a2bba382ef7ca4f5eaa13b;p=thirdparty%2Fzstd.git [debug] Don't define g_debuglevel in the kernel 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/ --- diff --git a/lib/common/debug.c b/lib/common/debug.c index ebf7bfccf..9d0b7d229 100644 --- a/lib/common/debug.c +++ b/lib/common/debug.c @@ -21,4 +21,10 @@ #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