From e122fcbf58e142e837a2bba382ef7ca4f5eaa13b Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Thu, 16 Nov 2023 17:15:25 -0800 Subject: [PATCH] [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/ --- lib/common/debug.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.47.2