From: Mike Frysinger <vapier@gentoo.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] fix gcc warnings when RESERVED_VA is 0
Date: Sat, 15 Sep 2012 20:05:06 -0400 [thread overview]
Message-ID: <1347753906-5261-1-git-send-email-vapier@gentoo.org> (raw)
The current code, while correct, triggers a bunch of gcc warnings when
RESERVED_VA is 0 like so:
linux-user/syscall.c: In function 'do_shmat':
linux-user/syscall.c:3058: warning: comparison of unsigned expression < 0 is always false
linux-user/syscall.c: In function 'open_self_maps':
linux-user/syscall.c:4960: warning: comparison of unsigned expression < 0 is always false
linux-user/syscall.c:4960: warning: comparison of unsigned expression < 0 is always false
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
cpu-all.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cpu-all.h b/cpu-all.h
index 5e07d28..0e5dcf0 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -202,10 +202,16 @@ extern unsigned long reserved_va;
#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
#define h2g_valid(x) 1
#else
+/* Gcc likes to warn about comparing unsigned longs to < 0, so cpp it away. */
+# if RESERVED_VA
+# define _h2g_reserved_va(x) ((x) < RESERVED_VA)
+# else
+# define _h2g_reserved_va(x) 1
+# endif
#define h2g_valid(x) ({ \
unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \
(__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \
- (!RESERVED_VA || (__guest < RESERVED_VA)); \
+ _h2g_reserved_va(__guest); \
})
#endif
--
1.7.9.7
next reply other threads:[~2012-09-16 0:05 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-16 0:05 Mike Frysinger [this message]
2012-09-16 9:58 ` [Qemu-devel] [PATCH] fix gcc warnings when RESERVED_VA is 0 Peter Maydell
2012-09-16 10:25 ` Blue Swirl
2012-09-17 15:28 ` [Qemu-devel] [PATCH v2 00/13] Sparc TCG cleanup Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 01/13] linux-user: Use memcpy in get_user/put_user Richard Henderson
2012-09-17 15:35 ` Peter Maydell
2012-09-17 15:40 ` Richard Henderson
2012-09-17 16:06 ` Peter Maydell
2012-09-17 15:28 ` [Qemu-devel] [PATCH 02/13] tcg-sparc: Hack in qemu_ld/st64 for 32-bit Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 03/13] tcg-sparc: Fix ADDX opcode Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 04/13] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode Richard Henderson
2012-09-17 16:04 ` Andreas Färber
2012-09-17 17:05 ` Richard Henderson
2012-09-17 19:25 ` Blue Swirl
2012-09-17 21:52 ` Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 05/13] tcg-sparc: Fix qemu_ld/st to handle 32-bit host Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 06/13] tcg-sparc: Support GUEST_BASE Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 07/13] tcg-sparc: Change AREG0 in generated code to %i0 Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 08/13] tcg-sparc: Clean up cruft stemming from attempts to use global registers Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 09/13] tcg-sparc: Mask shift immediates to avoid illegal insns Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 10/13] tcg-sparc: Use defines for temporaries Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 11/13] tcg-sparc: Add %g/%o registers to alloc_order Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 12/13] tcg-sparc: Fix and enable direct TB chaining Richard Henderson
2012-09-17 15:28 ` [Qemu-devel] [PATCH 13/13] tcg: Fix !USE_DIRECT_JUMP Richard Henderson
2012-09-17 15:50 ` Andreas Färber
2012-09-21 20:21 ` Stefan Weil
2012-09-21 10:28 ` Aurelien Jarno
2012-09-21 18:16 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1347753906-5261-1-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).