[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 44/47] fix GCC 5.0.0 logical-not-parentheses warnings
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 44/47] fix GCC 5.0.0 logical-not-parentheses warnings |
Date: |
Wed, 4 Mar 2015 20:07:01 +0300 |
From: Radim Krčmář <address@hidden>
man gcc:
Warn about logical not used on the left hand side operand of a
comparison. This option does not warn if the RHS operand is of a
boolean type.
By preferring bool over int where sensible, but without modifying any
depending code, make GCC happy in cases like this,
qemu-img.c: In function ‘compare_sectors’:
qemu-img.c:992:39: error: logical not is only applied to the left hand
side of comparison [-Werror=logical-not-parentheses]
if (!!memcmp(buf1, buf2, 512) != res) {
hw/ide/core.c:1836 doesn't throw an error,
assert(!!s->error == !!(s->status & ERR_STAT));
even thought the second operand is int (and first hunk of this patch has
a very similar case), maybe GCC developers still have a little faith in
C programmers.
Signed-off-by: Radim Krčmář <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
hw/net/virtio-net.c | 4 ++--
kvm-all.c | 2 +-
qemu-img.c | 3 ++-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 45da34a..9381867 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -120,8 +120,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t
status)
return;
}
- if (!!n->vhost_started ==
- (virtio_net_started(n, status) && !nc->peer->link_down)) {
+ if ((virtio_net_started(n, status) && !nc->peer->link_down) ==
+ !!n->vhost_started) {
return;
}
if (!n->vhost_started) {
diff --git a/kvm-all.c b/kvm-all.c
index 05a79c2..07ef62c 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -366,7 +366,7 @@ static void kvm_log_stop(MemoryListener *listener,
}
}
-static int kvm_set_migration_log(int enable)
+static int kvm_set_migration_log(bool enable)
{
KVMState *s = kvm_state;
KVMSlot *mem;
diff --git a/qemu-img.c b/qemu-img.c
index 6d17755..5af6f45 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -976,7 +976,8 @@ static int is_allocated_sectors_min(const uint8_t *buf, int
n, int *pnum,
static int compare_sectors(const uint8_t *buf1, const uint8_t *buf2, int n,
int *pnum)
{
- int res, i;
+ bool res;
+ int i;
if (n <= 0) {
*pnum = 0;
--
2.1.4
- [Qemu-devel] [PULL 26/47] qapi-schema: Fix SpiceChannel docs, (continued)
- [Qemu-devel] [PULL 26/47] qapi-schema: Fix SpiceChannel docs, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 42/47] oslib-posix: Fix compiler warning (-Wclobbered) and simplify the code, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 01/47] xen-pt: fix Negative array index read, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 14/47] pl330.c: remove superfluous '\n' around error_setg, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 07/47] qemu-options: fix/document -incoming options, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 18/47] vfio: Remove superfluous '\n' around error_report(), Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 45/47] milkymist-pfpu: fix GCC 5.0.0 aggressive-loop-optimizations warning, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 22/47] vhost: Remove superfluous '\n' around error_report(), Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 33/47] sysbus: fix memory leak, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 31/47] macio: fix possible memory leak, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 44/47] fix GCC 5.0.0 logical-not-parentheses warnings,
Michael Tokarev <=
- [Qemu-devel] [PULL 38/47] vhost_net: Add missing 'static' attribute, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 24/47] ui/vnc: Remove vnc_stop_worker_thread(), Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 34/47] microblaze: fix memory leak, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 29/47] nbd: fix resource leak, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 35/47] gitignore: Track common.env in iotests gitignore, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 23/47] ui: Removed unused functions, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 41/47] disas/microblaze: Fix warnings caused by missing 'static' attribute, Michael Tokarev, 2015/03/04