From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56283 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P48Ny-0000JB-On for qemu-devel@nongnu.org; Fri, 08 Oct 2010 04:33:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P48Nx-0000dg-BK for qemu-devel@nongnu.org; Fri, 08 Oct 2010 04:33:02 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:58843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P48Nw-0000dN-U9 for qemu-devel@nongnu.org; Fri, 08 Oct 2010 04:33:01 -0400 From: Stefan Weil Date: Fri, 8 Oct 2010 10:32:23 +0200 Message-Id: <1286526743-10253-1-git-send-email-weil@mail.berlios.de> In-Reply-To: References: Subject: [Qemu-devel] [PATCH] tcg: Fix compiler error (comparison of unsigned expression) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers Cc: Blue Swirl , Hollis Blanchard When qemu is configured with --enable-debug-tcg, gcc throws this warning (or error with -Werror): tcg/tcg.c:1030: error: comparison of unsigned expression >= 0 is always true Fix it by removing the >= 0 part. The type cast to 'unsigned' catches negative values of op (which should never happen). This is a modification of Hollis Blanchard's patch. Cc: Hollis Blanchard Cc: Blue Swirl Signed-off-by: Stefan Weil --- tcg/tcg.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index e0a9030..0cdef0d 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1027,7 +1027,7 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs) if (tdefs->op == (TCGOpcode)-1) break; op = tdefs->op; - assert(op >= 0 && op < NB_OPS); + assert((unsigned)op < NB_OPS); def = &tcg_op_defs[op]; #if defined(CONFIG_DEBUG_TCG) /* Duplicate entry in op definitions? */ -- 1.7.1