[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <D5778071F336E5F6+5c5fc5ae-1ef3-45e7-8b01-c1e496bcfd58@uniontech.com>
Date: Wed, 12 Mar 2025 10:38:36 +0800
From: WangYuli <wangyuli@...ontech.com>
To: Huacai Chen <chenhuacai@...nel.org>
Cc: kernel@...0n.name, yangtiezhu@...ngson.cn, maobibo@...ngson.cn,
guoweikang.kernel@...il.com, agordeev@...ux.ibm.com, ast@...nel.org,
usamaarif642@...il.com, jiaxun.yang@...goat.com, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org, zhanjun@...ontech.com,
niecheng1@...ontech.com, chenlinxuan@...ontech.com, donmor3000@...mail.com,
Wentao Guan <guanwentao@...ontech.com>
Subject: Re: [PATCH] LoongArch: Fix use of logical '&&' with constant operand
Hi Huacai,
On 2025/3/4 20:00, Huacai Chen wrote:
> Are you kidding me?
nope
> CONFIG_CMDLINE[0] is a constant for a specific
> config but the config is variable across buildings. So the "constant"
> for compilers is not as "constant" for people.
Perhaps I'm not fully understanding your point.
From my vantage point, it appears that all that's necessary is to
ascertain whether CONFIG_CMDLINE[0] is a null value.
Given that the ASCII representation of NUL is indeed 0, this method of
boolean coercion followed by a logical conjunction with the antecedent
boolean value should not impinge upon the intended operationality of
this line of code, and it further obviates a compilation warning.
To be precise, amending !!CONFIG_CMDLINE[0] to (CONFIG_CMDLINE[0] == 0)
or converting the logical AND to a bitwise AND operation would also
likely engender a commensurate outcome.
I merely opted for one modification strategy and patched it.
> Compiler warnings
> should be double-checked by people, right?
Naturally.
Compilers are, in essence, just sophisticated software programs, and are
susceptible to numerous imperfections.
Nonetheless, for the most part, the warnings and error reports they
output are typically justified.
Thanks.
--
Yuli Wang*
*
Download attachment "OpenPGP_0xC5DA1F3046F40BEE.asc" of type "application/pgp-keys" (633 bytes)
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)
Powered by blists - more mailing lists