Skip to contentSkip to conversation

Silence passing arg x of `xxxx' from incompatible pointer type warnings on Windows

Qemu-devel Consul 2 participants 4 messages May 4, 2009 – May 6, 2009

lore
Share & tools
lore

Consul

author
#0 lore raw

Silence "passing arg x of `xxxx' from incompatible pointer type" warnings on Windows.

---
 migration-tcp.c |    2 +-
 nbd.c           |    2 +-
 slirp/misc.c    |    2 +-
 slirp/slirp.c   |    2 +-
 slirp/socket.c  |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
migration-tcp.c +1 -1
index d9c4c98..fcd4d5f 100644
@@ -58,7 +58,7 @@ static void tcp_wait_for_connect(void *opaque)
 
     dprintf("connect completed\n");
     do {
-        ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, &val, &valsize);
+        ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, (void*) &val, &valsize);
     } while (ret == -1 && (s->get_error(s)) == EINTR);
 
     if (ret < 0) {
nbd.c +1 -1
index 1586ea7..6659eef 100644
@@ -169,7 +169,7 @@ int tcp_socket_incoming(const char *address, uint16_t port)
     memcpy(&addr.sin_addr.s_addr, &in, sizeof(in));
 
     opt = 1;
-    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1) {
+    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void*) &opt, sizeof(opt)) == -1) {
         goto error;
     }
 
slirp/misc.c +1 -1
index 0137e75..7420725 100644
@@ -799,7 +799,7 @@ fd_block(int fd)
 #ifdef FIONBIO
        int opt = 0;
 
-       ioctlsocket(fd, FIONBIO, &opt);
+       ioctlsocket(fd, FIONBIO, (void*) &opt);
 #else
        int opt;
 
slirp/slirp.c +1 -1
index 4ca35b2..4b744f8 100644
@@ -468,7 +468,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
                            /* Connected */
                            so->so_state &= ~SS_ISFCONNECTING;
 
-                           ret = send(so->s, &ret, 0, 0);
+                           ret = send(so->s, (void*) &ret, 0, 0);
                            if (ret < 0) {
                              /* XXXXX Must fix, zero bytes is a NOP */
                              if (errno == EAGAIN || errno == EWOULDBLOCK ||
slirp/socket.c +1 -1
index 098132a..a5313e5 100644
@@ -485,7 +485,7 @@ sorecvfrom(struct socket *so)
           */
          len = M_FREEROOM(m);
          /* if (so->so_fport != htons(53)) { */
-         ioctlsocket(so->s, FIONREAD, &n);
+         ioctlsocket(so->s, FIONREAD, (void*) &n);
 
          if (n > len) {
            n = (m->m_data - m->m_dat) + m->m_len + n + 1;
Signature · 1 line
1.6.2.2.1669.g7eaf8
#1 lore raw

Hi,

Quoted 2 lines · Consul

Silence "passing arg x of `xxxx' from incompatible pointer type" warnings on Windows.

Umm, I think you need to be a bit more specific which compiler you are using. For example, I imagine that this issue just goes away if you use TDM-GCC 4.4.0-2.

Ciao,
Dscho

author
#2 lore raw
Quoted 13 lines · Johannes Schindelin

Hi,

Quoted 1 line · Consul

Silence "passing arg x of `xxxx' from incompatible pointer type" warnings on Windows.

Umm, I think you need to be a bit more specific which compiler you are using. For example, I imagine that this issue just goes away if you use TDM-GCC 4.4.0-2.

Ciao,
Dscho

gcc.exe (GCC) 3.4.2 (mingw-special)

I have not tried TDM-GCC 4.4.0. Does it have these types of warnings fixed? There is a lot of those produced by 4.3.3-tdm-1 mingw32

block.c:1254: warning: format '%I64d' expects type 'int', but argument 4 has type 'int64_t'

Thanks,
Alex

author
#3 lore raw
Quoted 9 lines · Consul
Quoted 8 lines · Johannes Schindelin

Hi,

Quoted 1 line · Consul

Silence "passing arg x of `xxxx' from incompatible pointer type" warnings on Windows.

Umm, I think you need to be a bit more specific which compiler you are using. For example, I imagine that this issue just goes away if you use TDM-GCC 4.4.0-2.

Well, gcc 4.4.0 even more noisy in this context. My patch shuts it up as well. On Linux it expects void* anyway, probably on other *nix variants as well, so the cast is justified, isn't it?

migration-tcp.c: In function 'tcp_wait_for_connect':
migration-tcp.c:61: warning: passing argument 4 of 'getsockopt' from incompatible pointer type /mingw/lib/gcc/mingw32/../../../include/winsock2.h:543: note: expected 'char *' but argument is of type 'int *'