lkml.org 
[lkml]   [2021]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] [RFC] io_uring: warning about unused-but-set parameter
On Mon, Sep 20, 2021 at 02:13:44PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When enabling -Wunused warnings by building with W=1, I get an
> instance of the -Wunused-but-set-parameter warning in the io_uring code:
>
> fs/io_uring.c: In function 'io_queue_async_work':
> fs/io_uring.c:1445:61: error: parameter 'locked' set but not used [-Werror=unused-but-set-parameter]
> 1445 | static void io_queue_async_work(struct io_kiocb *req, bool *locked)
> | ~~~~~~^~~~~~
>
> There are very few warnings of this type, so it would be nice to enable
> this by default and fix all the existing instances. I was almost
> done, but this was added recently as a precaution to prevent code
> from using the parameter, which could be done by either removing
> the initialization, or by adding a (fake) use of the variable, which
> I do here with the cast to void.

Please don't. These warning are utterly stupid and should not be
enabled. For anything that is a "method" of sorts (that is assigned
to a function pointer), unused argument are perfectly normal.

\
 
 \ /
  Last update: 2021-09-20 14:20    [W:0.087 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site