Received: from [140.186.70.92] (port=53116 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ou4DH-0000sw-EI for qemu-devel@nongnu.org; Fri, 10 Sep 2010 10:04:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ou4DG-0001e1-3b for qemu-devel@nongnu.org; Fri, 10 Sep 2010 10:04:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10574) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ou4DF-0001dr-Ri for qemu-devel@nongnu.org; Fri, 10 Sep 2010 10:04:22 -0400 From: Jes.Sorensen@redhat.com Date: Fri, 10 Sep 2010 16:04:11 +0200 Message-Id: <1284127451-22092-2-git-send-email-Jes.Sorensen@redhat.com> In-Reply-To: <1284127451-22092-1-git-send-email-Jes.Sorensen@redhat.com> References: <1284127451-22092-1-git-send-email-Jes.Sorensen@redhat.com> Subject: [Qemu-devel] [PATCH 1/1] Avoid compiler error when building block/blkdebug.c with -Wtype-limits List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: blauwirbel@gmail.com From: Jes Sorensen Signed-off-by: Jes Sorensen --- block/blkdebug.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index 2a63df9..17d796d 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -439,7 +439,12 @@ static void blkdebug_debug_event(BlockDriverState *bs, BlkDebugEvent event) struct BlkdebugRule *rule; BlkdebugVars old_vars = s->vars; - if (event < 0 || event >= BLKDBG_EVENT_MAX) { + /* + * enum is not guaranteed to be signed on all archs, so cast to + * int before the comparison against zero to avoid compiler + * warning when building with -Wtype-limits + */ + if ((int)event < 0 || event >= BLKDBG_EVENT_MAX) { return; } -- 1.7.1