qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/1] Avoid compiler error when building block/blkdeb


From: Jes . Sorensen
Subject: [Qemu-devel] [PATCH 1/1] Avoid compiler error when building block/blkdebug.c with -Wtype-limits
Date: Fri, 10 Sep 2010 16:04:11 +0200

From: Jes Sorensen <address@hidden>

Signed-off-by: Jes Sorensen <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]