[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-trivial] [PATCH] Fix comparisons between implicit
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] [Qemu-trivial] [PATCH] Fix comparisons between implicit booleans and integers. |
Date: |
Tue, 10 Feb 2015 19:33:22 +0000 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Tue, Feb 10, 2015 at 10:15:35PM +0300, Michael Tokarev wrote:
> 30.01.2015 14:52, Richard W.M. Jones wrote:
> > In GCC 5 there is a new warning (-Wlogical-not-parentheses) which
> > prevents you from writing:
> >
> > if (<some implicitly boolean expression> == <an int>) ...
> >
> > A typical error would be:
> >
> > kvm-all.c: In function ‘kvm_set_migration_log’:
> > kvm-all.c:383:54: error: logical not is only applied to the left hand side
> > of comparison [-Werror=logical-not-parentheses]
> > if (!!(mem->flags & KVM_MEM_LOG_DIRTY_PAGES) == enable) {
> >
> > Fix a few places where the build is now broken in GCC 5.
> >
> > The warning isn't even consistent, as with the place in
> > hw/net/virtio-net.c where I had to cast an obviously boolean
> > expression to bool.
>
> Richard, I'd like to apply hunks 2 and 3, but leave out hunk 1
> for now. As a start, the hunk 1 looks a bit, well, ugly, don't
> you think? But if I just drop hunk 1, the commit message will
> be a bit misleading, since it describes exactly the hunk1 change...
Please feel free to apply and bits and modify the commit message as
you wish. I just want qemu to be fixed on gcc 5, I don't care how we
get there :-)
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html