From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [PATCH] linux-user: avoid -Werror=int-in-bool-context
Date: Fri, 19 Sep 2025 11:45:41 +0200 [thread overview]
Message-ID: <b5f23bd5-de2c-4f1f-870a-c74993ea05f8@redhat.com> (raw)
In-Reply-To: <CAFEAcA8BBisMO3VJF=bb0a7oQCK16P4NhtTxcWRNRg0yMTWtwg@mail.gmail.com>
On 9/19/25 11:33, Peter Maydell wrote:
> On Fri, 19 Sept 2025 at 09:37, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> linux-user is failing to compile on Fedora 43:
>>
>> ../linux-user/strace.c:57:66: error: enum constant in boolean context [-Werror=int-in-bool-context]
>> 57 | #define FLAG_BASIC(V, M, N) { V, M | QEMU_BUILD_BUG_ON_ZERO(!(M)), N }
>>
>> The warning does not seem to useful and we could even disable it, but
>> the workaround is simple in this case.
>
> I'm surprised this is the only place in the codebase
> where we treat an int as a bool...
There are some heuristics about suspicious uses. Examples in the
documentation include "if (a <= b ? 2 : 3)" and "1 << a" in boolean context.
Paolo
prev parent reply other threads:[~2025-09-19 9:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 8:36 [PATCH] linux-user: avoid -Werror=int-in-bool-context Paolo Bonzini
2025-09-19 9:31 ` Daniel P. Berrangé
2025-09-19 9:33 ` Peter Maydell
2025-09-19 9:45 ` Markus Armbruster
2025-09-19 9:45 ` Paolo Bonzini [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=b5f23bd5-de2c-4f1f-870a-c74993ea05f8@redhat.com \
--to=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=richard.henderson@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).