Re: [PATCH] init/main.c: silence some -Wunused-parameter warnings

From: Andrew Halaney
Date: Thu May 20 2021 - 09:03:56 EST


On Wed, May 19, 2021 at 09:37:31PM -0700, Andrew Morton wrote:
> On Wed, 19 May 2021 11:23:41 -0500 Andrew Halaney <ahalaney@xxxxxxxxxx> wrote:
>
> > There's a bunch of callbacks with unused arguments, go ahead and silence
> > those so "make KCFLAGS=-W init/main.o" is a little quieter.
> > Here's a little sample:
>
> Do we care about -Wunused-parameter? I suppose we do, as it might
> point us at small code optimizations.
>
> How voluminous is the warning output from -Wunused-parameter? Small
> enough to be useful or large enough to be useless?
>

That's something I was wondering too. The output from compiling with -W
is _very_ loud, to the point where it is almost pointless to do it. Even
with this patch applied I get 1679 warnings generated when doing a
recompile of init/main.o - all but one of them from headers included.

The motivation was brought up because item 20 in [1] says:

20) Newly-added code has been compiled with ``gcc -W`` (use
``make KCFLAGS=-W``). This will generate lots of noise, but is good
for finding bugs like "warning: comparison between signed and unsigned".

and while none of this is newly added code, I found it pretty hard to
discern in a prior patch here if I was causing extra noise or not.
Thought I'd chip away at the noise.

If we decide we don't care about such warnings then feel free to ignore
this patch, but since I was playing around here anyways I thought I'd
clean it up a little. My preference would be to care, but the output is
so loud it is easy to make the argument that it is too late to start
caring.

Thanks,
Andrew

[1] https://www.kernel.org/doc/html/latest/process/submit-checklist.html#submitchecklist