From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Blue Swirl <blauwirbel@gmail.com>,
Hollis Blanchard <hollis@penguinppc.org>
Subject: [Qemu-devel] [PATCH] tcg: Fix compiler error (comparison of unsigned expression)
Date: Fri, 8 Oct 2010 10:32:23 +0200 [thread overview]
Message-ID: <1286526743-10253-1-git-send-email-weil@mail.berlios.de> (raw)
In-Reply-To: <AANLkTi=AFOyVNAtvQ_1s6LW=S9WiW4Z6vkGOZWExctE6@mail.gmail.com>
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>
---
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
next prev parent reply other threads:[~2010-10-08 8:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-26 17:40 [Qemu-devel] fix unsigned comparison warning in TCG Hollis Blanchard
2010-09-26 18:33 ` Blue Swirl
2010-10-07 23:15 ` Venkateswararao Jujjuri (JV)
2010-10-08 8:32 ` Stefan Weil [this message]
2010-10-08 16:57 ` [Qemu-devel] Re: [PATCH] tcg: Fix compiler error (comparison of unsigned expression) Hollis Blanchard
2010-10-08 21:43 ` Stefan Weil
2010-10-13 18:58 ` Stefan Weil
2010-10-13 19:22 ` Hollis Blanchard
2010-10-13 19:33 ` Blue Swirl
2010-10-20 20:56 ` Blue Swirl
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=1286526743-10253-1-git-send-email-weil@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=blauwirbel@gmail.com \
--cc=hollis@penguinppc.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).