qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 20/20] block: Avoid compiler warning for w64


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH 20/20] block: Avoid compiler warning for w64
Date: Sun, 15 Apr 2012 19:33:22 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.28) Gecko/20120313 Thunderbird/3.1.20

Am 15.04.2012 19:13, schrieb Blue Swirl:
On Sun, Apr 15, 2012 at 14:13, Stefan Weil<address@hidden>  wrote:
The MinGW-w64 compiler complains about a non-void function
which does not return a value.

This is not true, but we can help the compiler to
see that by rewriting the code.

Signed-off-by: Stefan Weil<address@hidden>
---
  block/raw-win32.c |    6 ++----
  1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/raw-win32.c b/block/raw-win32.c
index e4b0b75..a420f73 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -335,12 +335,10 @@ static int find_device_type(BlockDriverState *bs, const 
char *filename)
             return FTYPE_HARDDISK;
         case DRIVE_CDROM:
             return FTYPE_CD;
-        default:
-            return FTYPE_FILE;
If these DRIVE_ constants are enums (or later changed to such), a
compiler may complain about missing default case. I'd prefer then to
keep 'default:', but add 'break;' in place of the return. Would this
work in your case too?

         }
-    } else {
-        return FTYPE_FILE;
     }
+
+    return FTYPE_FILE;
This and else change is fine.


This patch is not strictly needed for w64 because it only fixes a
compiler warning, so I'll remove it from this patch series.

Introducing an enum (also for block/raw-posix.c) and re-writing
the switch statement can be done by separate patches.

Regards,
Stefan W.




reply via email to

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