* [PATCH] configure: disable -Wxor-used-as-pow
@ 2020-06-23 17:37 Paolo Bonzini
2020-06-23 18:41 ` Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2020-06-23 17:37 UTC (permalink / raw)
To: qemu-devel
Clang being clang and adding more pointless warnings. In a hardware
emulator there are going to be plenty of bitwise operations, and the
chance of someone writing ^ for pow and not being caught is basically
zero.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure b/configure
index 8d9435a0e0..d42f060ee7 100755
--- a/configure
+++ b/configure
@@ -2062,6 +2062,7 @@ add_to nowarn_flags -Wno-string-plus-int
add_to nowarn_flags -Wno-typedef-redefinition
add_to nowarn_flags -Wno-tautological-type-limit-compare
add_to nowarn_flags -Wno-psabi
+add_to nowarn_flags -Wno-xor-used-as-pow
gcc_flags="$warn_flags $nowarn_flags"
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] configure: disable -Wxor-used-as-pow
2020-06-23 17:37 [PATCH] configure: disable -Wxor-used-as-pow Paolo Bonzini
@ 2020-06-23 18:41 ` Eric Blake
2020-06-23 19:53 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2020-06-23 18:41 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 6/23/20 12:37 PM, Paolo Bonzini wrote:
> Clang being clang and adding more pointless warnings. In a hardware
> emulator there are going to be plenty of bitwise operations, and the
> chance of someone writing ^ for pow and not being caught is basically
> zero.
Did this warning actually fire?
My understanding (from a quick glance of
https://reviews.llvm.org/D63423) is that it is supposed to catch
instances of '2 ^ 16' where someone meant '1 << 16' instead of 18. I
don't know if it is supposed to flag 'a ^ 16' (if it does, then it is
indeed useless), or only when both lhs and rhs are constants and where
lhs is 2 or 10, so my initial reaction is that without seeing an actual
false positive, we are premature in disabling it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> configure | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/configure b/configure
> index 8d9435a0e0..d42f060ee7 100755
> --- a/configure
> +++ b/configure
> @@ -2062,6 +2062,7 @@ add_to nowarn_flags -Wno-string-plus-int
> add_to nowarn_flags -Wno-typedef-redefinition
> add_to nowarn_flags -Wno-tautological-type-limit-compare
> add_to nowarn_flags -Wno-psabi
> +add_to nowarn_flags -Wno-xor-used-as-pow
Pre-existing, but is it worth ordering flag additions in alphabetical
order (the three preceding lines are in the wrong order if so).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] configure: disable -Wxor-used-as-pow
2020-06-23 18:41 ` Eric Blake
@ 2020-06-23 19:53 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-06-23 19:53 UTC (permalink / raw)
To: Eric Blake, qemu-devel
On 23/06/20 20:41, Eric Blake wrote:
> On 6/23/20 12:37 PM, Paolo Bonzini wrote:
>> Clang being clang and adding more pointless warnings. In a hardware
>> emulator there are going to be plenty of bitwise operations, and the
>> chance of someone writing ^ for pow and not being caught is basically
>> zero.
>
> Did this warning actually fire?
>
> My understanding (from a quick glance of
> https://reviews.llvm.org/D63423) is that it is supposed to catch
> instances of '2 ^ 16' where someone meant '1 << 16' instead of 18. I
> don't know if it is supposed to flag 'a ^ 16' (if it does, then it is
> indeed useless), or only when both lhs and rhs are constants and where
> lhs is 2 or 10, so my initial reaction is that without seeing an actual
> false positive, we are premature in disabling it.
There is an instance of 2 ^ 20.
But it's actually a bug. Objection (and faith in humanity) retracted.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-23 19:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 17:37 [PATCH] configure: disable -Wxor-used-as-pow Paolo Bonzini
2020-06-23 18:41 ` Eric Blake
2020-06-23 19:53 ` Paolo Bonzini
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).