]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
linux-user: avoid -Werror=int-in-bool-context
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 19 Sep 2025 08:20:54 +0000 (10:20 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 23 Sep 2025 10:17:39 +0000 (12:17 +0200)
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 be too useful and we could even disable it,
but the workaround is simple in this case.

Cc: qemu-stable@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
linux-user/strace.c

index 1233ebceb08b13b1c2698c6e1d54b8d98cbc511b..758c5d32b6c0f98902f2c900dd424ef173d25e0e 100644 (file)
@@ -54,7 +54,7 @@ struct flags {
 };
 
 /* No 'struct flags' element should have a zero mask. */
-#define FLAG_BASIC(V, M, N)      { V, M | QEMU_BUILD_BUG_ON_ZERO(!(M)), N }
+#define FLAG_BASIC(V, M, N)      { V, M | QEMU_BUILD_BUG_ON_ZERO((M) == 0), N }
 
 /* common flags for all architectures */
 #define FLAG_GENERIC_MASK(V, M)  FLAG_BASIC(V, M, #V)