qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: riku.voipio@iki.fi, Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH] linux-user: Avoid compilation error with --disable-guest-base
Date: Tue, 30 Jun 2015 18:19:59 +0200	[thread overview]
Message-ID: <1435681199-14392-1-git-send-email-laurent@vivier.eu> (raw)

When guest base is disabled, RESERVED_VA is 0, and
(__guest < RESERVED_VA) is always false as __guest is unsigned.

With -Werror=type-limits, this triggers an error:

    include/exec/cpu_ldst.h:60:31: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
         (!RESERVED_VA || (__guest < RESERVED_VA)); \

This patch removes this comparison when guest base is disabled.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 include/exec/cpu_ldst.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 1239c60..f278126 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -54,11 +54,16 @@
 #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
 #define h2g_valid(x) 1
 #else
+#if defined(CONFIG_USE_GUEST_BASE)
 #define h2g_valid(x) ({ \
     unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \
     (__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \
     (!RESERVED_VA || (__guest < RESERVED_VA)); \
 })
+#else
+#define h2g_valid(x) \
+    ((unsigned long)(x) < (1ul << TARGET_VIRT_ADDR_SPACE_BITS))
+#endif
 #endif
 
 #define h2g_nocheck(x) ({ \
-- 
2.4.3

             reply	other threads:[~2015-06-30 16:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 16:19 Laurent Vivier [this message]
2015-06-30 16:45 ` [Qemu-devel] [PATCH] linux-user: Avoid compilation error with --disable-guest-base Peter Maydell
2015-06-30 17:13   ` Laurent Vivier
2015-06-30 17:20     ` Peter Maydell
2015-06-30 23:58       ` Laurent Vivier
2015-07-01 11:12         ` Peter Maydell
2015-07-01 13:15         ` Aurelien Jarno
2015-07-01 18:21           ` Laurent Vivier
2015-07-01 19:46             ` Aurelien Jarno
2015-07-21  6:51             ` Richard Henderson

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=1435681199-14392-1-git-send-email-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).