Skip to contentSkip to conversation

w32: Undefine error constants before their redefinition

PATCH Applied Jan Kiszka 3 participants 4 messages Mar 28, 2012 – Mar 29, 2012

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 w32: Undefine error constants before their redefinition

Avoids lots of warnings.

---
 qemu_socket.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
qemu_socket.h +2 -0
index fe4cf6c..51ad210 100644
@@ -8,7 +8,9 @@
 #include <ws2tcpip.h>
 
 #define socket_error() WSAGetLastError()
+#undef EWOULDBLOCK
 #undef EINTR
+#undef EINPROGRESS
 #define EWOULDBLOCK WSAEWOULDBLOCK
 #define EINTR       WSAEINTR
 #define EINPROGRESS WSAEINPROGRESS
Signature · 1 line
1.7.3.4
#2 lore raw
In reply to Jan Kiszka

Am 28.03.2012 20:56, schrieb Jan Kiszka:

Quoted 12 lines

Avoids lots of warnings.

---
qemu_socket.h | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
qemu_socket.h +0 -0
index fe4cf6c..51ad210 100644

qemu_socket.h line 16

Quoted 9 lines
qemu_socket.h +2 -0
@@ -8,7 +8,9 @@
 #include <ws2tcpip.h>
 
 #define socket_error() WSAGetLastError()
+#undef EWOULDBLOCK
 #undef EINTR
+#undef EINPROGRESS
 #define EWOULDBLOCK WSAEWOULDBLOCK
 #define EINTR WSAEINTR
 #define EINPROGRESS WSAEINPROGRESS

Hi,

I am curious: with which version of MinGW or Cygwin do you get warnings? I don't see them in my native and cross MinGW / MinGW-w64 builds.

Where do the original definitions come from, and are they compatible with the redefined values? If yes, it might be possible to put the new definitions in a conditionally compiled code block (#if !defined(EWOULDBLOCK) ... #endif).

Could slirp/slirp.h also use qemu_socket.h? That would simplify the code. Is it possible to move those definitions to qemu-os-win32.h? I'd prefer to have them in some w32 specific header file instead of qemu_socket.h and slirp/slirp.h.

If the current two patches help you for the moment, I don't mind when they are committed, but we should have a better solution later.

Regards,

Stefan W.

author
#3 lore raw
Quoted 25 lines · Stefan Weil

Am 28.03.2012 20:56, schrieb Jan Kiszka:

Quoted 12 lines

Avoids lots of warnings.

---
qemu_socket.h | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
qemu_socket.h +0 -0
index fe4cf6c..51ad210 100644

qemu_socket.h line 16

Quoted 9 lines
qemu_socket.h +2 -0
@@ -8,7 +8,9 @@
 #include <ws2tcpip.h>
 
 #define socket_error() WSAGetLastError()
+#undef EWOULDBLOCK
 #undef EINTR
+#undef EINPROGRESS
 #define EWOULDBLOCK WSAEWOULDBLOCK
 #define EINTR WSAEINTR
 #define EINPROGRESS WSAEINPROGRESS

Hi,

Quoted 2 lines

I am curious: with which version of MinGW or Cygwin do you get warnings? I don't see them in my native and cross MinGW / MinGW-w64 builds.

Not sure if that is what you are looking for, but my runtime rpm claims to be mingw32-runtime-20120126-1.4.

Quoted 6 lines

Where do the original definitions come from, and are they compatible with the redefined values? If yes, it might be possible to put the new definitions
in a conditionally compiled code block (#if !defined(EWOULDBLOCK) ... #endif).

/usr/i686-w64-mingw32/sys-root/mingw/include/errno.h:158:0: note: this is the location of the previous definition

And there we have e.g.

#ifndef EINPROGRESS
#define EINPROGRESS 112
#endif

vs.

#define WSAEINPROGRESS 10036L

Quoted 5 lines

Could slirp/slirp.h also use qemu_socket.h? That would simplify the code. Is it possible to move those definitions to qemu-os-win32.h? I'd prefer to have them in some w32 specific header file instead of qemu_socket.h and slirp/slirp.h.

/me too. But as I cannot test w32, I would welcome to receive a tested patch for the slirp queue. :)

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux