qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ide: fix enum comparison for gcc 4.7
@ 2017-09-20 19:41 John Snow
  2017-09-20 19:48 ` Eric Blake
  2017-09-20 21:28 ` Mark Cave-Ayland
  0 siblings, 2 replies; 5+ messages in thread
From: John Snow @ 2017-09-20 19:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, mark.cave-ayland, John Snow

Apparently GCC gets bent over comparing enum values against zero.
Replace the conditional with something less readable.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 hw/ide/core.c             | 2 +-
 include/hw/ide/internal.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index a19bd90..d63eb4a 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -68,7 +68,7 @@ const char *IDE_DMA_CMD_lookup[IDE_DMA__COUNT] = {
 
 static const char *IDE_DMA_CMD_str(enum ide_dma_cmd enval)
 {
-    if (enval >= IDE_DMA__BEGIN && enval < IDE_DMA__COUNT) {
+    if ((unsigned)enval < IDE_DMA__COUNT) {
         return IDE_DMA_CMD_lookup[enval];
     }
     return "DMA UNKNOWN CMD";
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index 180e00e..e641012 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -333,8 +333,7 @@ struct unreported_events {
 };
 
 enum ide_dma_cmd {
-    IDE_DMA__BEGIN = 0,
-    IDE_DMA_READ = IDE_DMA__BEGIN,
+    IDE_DMA_READ = 0,
     IDE_DMA_WRITE,
     IDE_DMA_TRIM,
     IDE_DMA_ATAPI,
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-20 21:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20 19:41 [Qemu-devel] [PATCH] ide: fix enum comparison for gcc 4.7 John Snow
2017-09-20 19:48 ` Eric Blake
2017-09-20 21:28 ` Mark Cave-Ayland
2017-09-20 21:33   ` John Snow
2017-09-20 21:41     ` Mark Cave-Ayland

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).