Skip to contentSkip to conversation

gcc4 warnings: miscellaneous minor things

PATCH New Andre Przywara 1 participant 1 message Dec 6, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 gcc4 warnings: miscellaneous minor things

some things found on the way:
- missing include in hw/adlib.c
- avoid double definition of NDEBUG in aes.h
- fix some strange pointer acrobatics in hw/ide.c#padstr
- fix getsockopt socklen_t warning
- fix uninitialized variable warning in monitor.c
- fix wrong signedness in le16_to_cpus calls in hw/pcnet.c

Signature · 9 lines
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy

Index: aes.c
===================================================================
RCS file: /sources/qemu/qemu/aes.c,v
retrieving revision 1.4

aes.c +3 -0
diff -p -u -r1.4 aes.c
@@ -30,7 +30,10 @@
 #include "qemu-common.h"
 #include "aes.h"
 
+#ifndef NDEBUG
 #define NDEBUG
+#endif
+
 #include <assert.h>
 
 typedef uint32_t u32;

Index: hw/adlib.c
===================================================================
RCS file: /sources/qemu/qemu/hw/adlib.c,v
retrieving revision 1.10

adlib.c +1 -0
diff -p -u -r1.10 adlib.c
@@ -26,6 +26,7 @@
 #include "hw.h"
 #include "audiodev.h"
 #include "audio/audio.h"
+#include "isa.h"
 
 //#define DEBUG
 

Index: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.72

ide.c +1 -2
diff -p -u -r1.72 ide.c
@@ -430,8 +430,7 @@ static void padstr(char *str, const char
             v = *src++;
         else
             v = ' ';
-        *(char *)((long)str ^ 1) = v;
-        str++;
+        str[i^1] = v;
     }
 }
 

Index: hw/pcnet.c
===================================================================
RCS file: /sources/qemu/qemu/hw/pcnet.c,v
retrieving revision 1.20

pcnet.c +4 -4
diff -p -u -r1.20 pcnet.c
@@ -350,8 +350,8 @@ static inline void pcnet_tmd_load(PCNetS
     } else {
         s->phys_mem_read(s->dma_opaque, addr, (void *)tmd, sizeof(*tmd), 0);
         le32_to_cpus(&tmd->tbadr);
-        le16_to_cpus(&tmd->length);
-        le16_to_cpus(&tmd->status);
+        le16_to_cpus((uint16_t *)&tmd->length);
+        le16_to_cpus((uint16_t *)&tmd->status);
         le32_to_cpus(&tmd->misc);
         le32_to_cpus(&tmd->res);
         if (BCR_SWSTYLE(s) == 3) {
@@ -416,8 +416,8 @@ static inline void pcnet_rmd_load(PCNetS
     } else {
         s->phys_mem_read(s->dma_opaque, addr, (void *)rmd, sizeof(*rmd), 0);
         le32_to_cpus(&rmd->rbadr);
-        le16_to_cpus(&rmd->buf_length);
-        le16_to_cpus(&rmd->status);
+        le16_to_cpus((uint16_t *)&rmd->buf_length);
+        le16_to_cpus((uint16_t *)&rmd->status);
         le32_to_cpus(&rmd->msg_length);
         le32_to_cpus(&rmd->res);
         if (BCR_SWSTYLE(s) == 3) {

Index: monitor.c
===================================================================
RCS file: /sources/qemu/qemu/monitor.c,v
retrieving revision 1.91

monitor.c +1 -1
diff -p -u -r1.91 monitor.c
@@ -1824,7 +1824,7 @@ static int64_t expr_unary(void)
     case '$':
         {
             char buf[128], *q;
-            target_long reg;
+            target_long reg=0;
 
             pch++;
             q = buf;

Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.376

vl.c +2 -1
diff -p -u -r1.376 vl.c
@@ -4397,7 +4398,8 @@ static NetSocketState *net_socket_fd_ini
 {
     int so_type=-1, optlen=sizeof(so_type);
 
-    if(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type, &optlen)< 0) {
+    if(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type,
+        (socklen_t *)&optlen)< 0) {
 	fprintf(stderr, "qemu: error: getsockopt(SO_TYPE) for fd=%d failed\n", fd);
 	return NULL;
     }