From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9yQc-0002ui-A0 for qemu-devel@nongnu.org; Tue, 30 Jun 2015 12:30:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9yGa-0005Zt-Ho for qemu-devel@nongnu.org; Tue, 30 Jun 2015 12:20:18 -0400 Received: from smtp4-g21.free.fr ([212.27.42.4]:37723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9yGa-0005UO-CT for qemu-devel@nongnu.org; Tue, 30 Jun 2015 12:20:12 -0400 From: Laurent Vivier Date: Tue, 30 Jun 2015 18:19:59 +0200 Message-Id: <1435681199-14392-1-git-send-email-laurent@vivier.eu> Subject: [Qemu-devel] [PATCH] linux-user: Avoid compilation error with --disable-guest-base List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: riku.voipio@iki.fi, Laurent Vivier 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 --- 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