* [PATCH] zstd: fix g_debuglevel export warning
@ 2023-06-16 14:44 Ben Dooks
2023-11-21 15:02 ` Nick Terrell
0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2023-06-16 14:44 UTC (permalink / raw)
To: linux-kernel, Nick Terrell; +Cc: Ben Dooks
The g_debuglevel variable in debug.c is only used when DEBUGLEVEL is
defined to be above 2. This means by default there's no actual definition
of this in the headers, so sparse is giving the following warning:
lib/zstd/common/debug.c:24:5: warning: symbol 'g_debuglevel' was not declared. Should it be static?
We can use the same check as in the header to remove this if it isn't
going to be used, silencing the warning and removing a small bit of unused
data.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
lib/zstd/common/debug.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/zstd/common/debug.c b/lib/zstd/common/debug.c
index bb863c9ea616..820520b93d2b 100644
--- a/lib/zstd/common/debug.c
+++ b/lib/zstd/common/debug.c
@@ -21,4 +21,6 @@
#include "debug.h"
+#if (DEBUGLEVEL>=2)
int g_debuglevel = DEBUGLEVEL;
+#endif
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] zstd: fix g_debuglevel export warning
2023-06-16 14:44 [PATCH] zstd: fix g_debuglevel export warning Ben Dooks
@ 2023-11-21 15:02 ` Nick Terrell
0 siblings, 0 replies; 2+ messages in thread
From: Nick Terrell @ 2023-11-21 15:02 UTC (permalink / raw)
To: Ben Dooks; +Cc: Nick Terrell, Linux Kernel Mailing List, Nick Terrell
> On Jun 16, 2023, at 10:44 AM, Ben Dooks <ben.dooks@codethink.co.uk> wrote:
>
> >
> The g_debuglevel variable in debug.c is only used when DEBUGLEVEL is
> defined to be above 2. This means by default there's no actual definition
> of this in the headers, so sparse is giving the following warning:
>
> lib/zstd/common/debug.c:24:5: warning: symbol 'g_debuglevel' was not declared. Should it be static?
>
> We can use the same check as in the header to remove this if it isn't
> going to be used, silencing the warning and removing a small bit of unused
> data.
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Thanks for the patch, I’ve applied it to my tree for v6.8.
Best,
Nick Terrell
> ---
> lib/zstd/common/debug.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/zstd/common/debug.c b/lib/zstd/common/debug.c
> index bb863c9ea616..820520b93d2b 100644
> --- a/lib/zstd/common/debug.c
> +++ b/lib/zstd/common/debug.c
> @@ -21,4 +21,6 @@
>
> #include "debug.h"
>
> +#if (DEBUGLEVEL>=2)
> int g_debuglevel = DEBUGLEVEL;
> +#endif
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-21 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-16 14:44 [PATCH] zstd: fix g_debuglevel export warning Ben Dooks
2023-11-21 15:02 ` Nick Terrell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®