[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <98c54e34-ae65-4492-8e2f-9601b477a8c6@gmail.com>
Date: Fri, 28 Feb 2025 12:14:11 +0000
From: Pavel Begunkov <asml.silence@...il.com>
To: Arnd Bergmann <arnd@...db.de>, Arnd Bergmann <arnd@...nel.org>,
Jens Axboe <axboe@...nel.dk>
Cc: Gabriel Krisman Bertazi <krisman@...e.de>, David Wei <dw@...idwei.uk>,
io-uring@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] io_uring/net: fix build warning for !CONFIG_COMPAT
On 2/27/25 13:58, Arnd Bergmann wrote:
> On Thu, Feb 27, 2025, at 14:49, Pavel Begunkov wrote:
>> On 2/27/25 13:20, Arnd Bergmann wrote:
>>> | ^~~
>>>
>>> Since io_is_compat() turns into a compile-time 'false', the #ifdef
>>> here is completely unnecessary, and removing it avoids the warning.
>>
>> I don't think __get_compat_msghdr() and other helpers are
>> compiled for !COMPAT.
>
> They are not defined without CONFIG_COMPAT. My point in the
> message is that io_is_compat() turning into a compile-time
> 'false' value means that they also don't get called, because
> compilers are really good at this type of dead code elimination.
>
>> I'd just silence it like:
>>
>> if (io_is_compat(req->ctx)) {
>> ret = -EFAULT;
>> #ifdef CONFIG_COMPAT
>> ...
>> #endif CONFIG_COMPAT
>> }
>
> That seems even less readable. If you want to be explicit
> about it, you could use
>
> if (IS_ENABLED(CONFIG_COMPAT) && io_is_compat(req->ctx)) {
>
> to replace the #ifdef, but as I wrote in the patch
> description, the compile-time check is really redundant
> because io_is_compat() is meant to do exactly that.
I do like getting rid of #ifdef, just a bit surprised that we're
relying on dead code elimination, even though it's what any
reasonable compiler must do.
Btw, sth went wrong with the reply: (delivered after 24733 seconds)
--
Pavel Begunkov
Powered by blists - more mailing lists