diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2015-02-20 17:06:15 +0100 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2015-03-10 08:15:34 +0300 |
commit | 8c1ac475e30091ba77a075d5e2136ece4f7c9cd0 (patch) | |
tree | ffe08b8da8cb4b3b6c83b18d8209643ef8c1fb1f /qemu-img.c | |
parent | 02942db7982541716131ca486ca0d59eae107553 (diff) |
fix GCC 5.0.0 logical-not-parentheses warnings
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ář <rkrcmar@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qemu-img.c b/qemu-img.c index 6d17755f49..5af6f455df 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; |