Re: [PATCH] LoongArch: Fix use of logical '&&' with constant operand
From: WangYuli
Date: Tue Mar 11 2025 - 22:39:14 EST
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*
*
Attachment:
OpenPGP_0xC5DA1F3046F40BEE.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature