From e54528155a3c4159b01327534691c3342a371cab Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Thu, 21 Apr 2016 16:16:19 -0400 Subject: [PATCH] Remove dead code in win32.h. There's no longer a need for the MSVC-version-specific code stanza that forcibly redefines errno code symbols, because since commit 73838b52 we're unconditionally redefining them in the stanza before this one anyway. Now it's merely confusing and ugly, so get rid of it; and improve the comment that explains what's going on here. Although this is just cosmetic, back-patch anyway since I'm intending to back-patch some less-cosmetic changes in this same hunk of code. --- src/include/port/win32.h | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/include/port/win32.h b/src/include/port/win32.h index 708d47ab3e5..c9390d11247 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -267,11 +267,18 @@ typedef int pid_t; /* * Supplement to <errno.h>. + * + * We redefine network-related Berkeley error symbols as the corresponding WSA + * constants. This allows elog.c to recognize them as being in the Winsock + * error code range and pass them off to pgwin32_socket_strerror(), since + * Windows' version of plain strerror() won't cope. Note that this will break + * if these names are used for anything else besides Windows Sockets errors. + * See TranslateSocketError() when changing this list. */ #undef EAGAIN +#define EAGAIN WSAEWOULDBLOCK #undef EINTR #define EINTR WSAEINTR -#define EAGAIN WSAEWOULDBLOCK #undef EMSGSIZE #define EMSGSIZE WSAEMSGSIZE #undef EAFNOSUPPORT @@ -293,26 +300,6 @@ typedef int pid_t; #undef EOPNOTSUPP #define EOPNOTSUPP WSAEOPNOTSUPP -/* - * For Microsoft Visual Studio 2010 and above we intentionally redefine - * the regular Berkeley error constants and set them to the WSA constants. - * Note that this will break if those constants are used for anything else - * than Windows Sockets errors. - */ -#if _MSC_VER >= 1600 -#pragma warning(disable:4005) -#define EMSGSIZE WSAEMSGSIZE -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define EWOULDBLOCK WSAEWOULDBLOCK -#define EPROTONOSUPPORT WSAEPROTONOSUPPORT -#define ECONNRESET WSAECONNRESET -#define EINPROGRESS WSAEINPROGRESS -#define ENOBUFS WSAENOBUFS -#define ECONNREFUSED WSAECONNREFUSED -#define EOPNOTSUPP WSAEOPNOTSUPP -#pragma warning(default:4005) -#endif - /* * Extended locale functions with gratuitous underscore prefixes. * (These APIs are nevertheless fully documented by Microsoft.) -- GitLab