From: David Laight <david.laight.linux@gmail.com>
To: WangYuli <wangyuli@uniontech.com>
Cc: chenhuacai@kernel.org, kernel@xen0n.name, yangtiezhu@loongson.cn,
maobibo@loongson.cn, guoweikang.kernel@gmail.com,
agordeev@linux.ibm.com, ast@kernel.org, usamaarif642@gmail.com,
jiaxun.yang@flygoat.com, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org, zhanjun@uniontech.com,
niecheng1@uniontech.com, chenlinxuan@uniontech.com,
donmor3000@hotmail.com, Wentao Guan <guanwentao@uniontech.com>
Subject: Re: [PATCH] LoongArch: Fix use of logical '&&' with constant operand
Date: Thu, 13 Mar 2025 21:57:44 +0000 [thread overview]
Message-ID: <20250313215744.69a976aa@pumpkin> (raw)
In-Reply-To: <EEBE30D1ACFF646F+20250304105246.766404-1-wangyuli@uniontech.com>
On Tue, 4 Mar 2025 18:52:46 +0800
WangYuli <wangyuli@uniontech.com> wrote:
> Fix follow error with clang-19:
>
> arch/loongarch/kernel/setup.c:335:40: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
> 335 | if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) && CONFIG_CMDLINE[0]) {
> | ^ ~~~~~~~~~~~~~~~~~
> arch/loongarch/kernel/setup.c:335:40: note: use '&' for a bitwise operation
> 335 | if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) && CONFIG_CMDLINE[0]) {
> | ^~
> | &
> arch/loongarch/kernel/setup.c:335:40: note: remove constant to silence this warning
> 335 | if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) && CONFIG_CMDLINE[0]) {
> | ^~~~~~~~~~~~~~~~~~~~
> 1 error generated.
Isn't that just 'an error too far' ?
There is nothing really wrong with compile-time constants in conditionals.
The kernel is full of them.
Why not just disable the warning?
David
prev parent reply other threads:[~2025-03-13 21:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 10:52 [PATCH] LoongArch: Fix use of logical '&&' with constant operand WangYuli
2025-03-04 12:00 ` Huacai Chen
2025-03-12 2:38 ` WangYuli
2025-03-13 21:57 ` David Laight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250313215744.69a976aa@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=agordeev@linux.ibm.com \
--cc=ast@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=chenlinxuan@uniontech.com \
--cc=donmor3000@hotmail.com \
--cc=guanwentao@uniontech.com \
--cc=guoweikang.kernel@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=maobibo@loongson.cn \
--cc=niecheng1@uniontech.com \
--cc=usamaarif642@gmail.com \
--cc=wangyuli@uniontech.com \
--cc=yangtiezhu@loongson.cn \
--cc=zhanjun@uniontech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox