]> git.proxmox.com Git - qemu.git/commitdiff
tcg: Fix compiler error (comparison of unsigned expression)
authorStefan Weil <weil@mail.berlios.de>
Fri, 8 Oct 2010 08:32:23 +0000 (10:32 +0200)
committerBlue Swirl <blauwirbel@gmail.com>
Wed, 20 Oct 2010 20:52:12 +0000 (20:52 +0000)
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 <hollis@penguinppc.org>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg/tcg.c

index e0a90302a7e98577496584e2b45d207929dde4f8..0cdef0d2135c9e2f4ca1db072295c4341176d138 100644 (file)
--- 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? */