Skip to content

Commit

Permalink
[debug] Don't define g_debuglevel in the kernel
Browse files Browse the repository at this point in the history
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/[email protected]/
  • Loading branch information
Nick Terrell committed Nov 17, 2023
1 parent d8ae0a6 commit 4b243e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/common/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4b243e6

Please sign in to comment.