[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wibYLDep=BPrUaw_wuZRDXnq5BVtG-6gLuBq6+3fdMhOQ@mail.gmail.com>
Date: Wed, 17 Nov 2021 08:45:54 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Nick Terrell <nickrterrell@...il.com>
Cc: Nick Terrell <terrelln@...com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-parisc <linux-parisc@...r.kernel.org>,
Helge Deller <deller@....de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH 1/3] lib: zstd: Fix unused variable warning
On Tue, Nov 16, 2021 at 5:43 PM Nick Terrell <nickrterrell@...il.com> wrote:
>
> From: Nick Terrell <terrelln@...com>
>
> Backport the fix from upstream PR #2838 [0]. Found by the Kernel test
> robot in [1].
Ugh. Mind having a better commit message?
This just tells you that it's a backport. It doesn't actually talk
about what it fixes.
Yes, the summary line says "Fix unused variable warning", but it
doesn't talk about why that variable is unused and why it's not
removed entirely.
And it's not obvious in the diff either, because the context isn't
sufficiently large.
So a comment along the lines of "the variable is only used by an
'assert()', so when asserts are disabled the compiler sees no use at
all" or similar would be appreciated.
Of course, the alternative would be to make the backup definition of
'assert()' actually evaluate the argument. That's not what the
standard assert() is supposed to do, but whatever, and the zstd use
doesn't care.
So using
#define assert(condition) ((void)(condition))
instead would also fix the warning at least in kernel use (but not
necessarily outside the kernel - the standard C 'assert.h' is just
evil).
Linus
Powered by blists - more mailing lists