Skip to content

Commit e545281

Browse files
committed
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 73838b5 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.
1 parent 1421664 commit e545281

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

src/include/port/win32.h

+8-21
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,18 @@ typedef int pid_t;
267267

268268
/*
269269
* Supplement to <errno.h>.
270+
*
271+
* We redefine network-related Berkeley error symbols as the corresponding WSA
272+
* constants. This allows elog.c to recognize them as being in the Winsock
273+
* error code range and pass them off to pgwin32_socket_strerror(), since
274+
* Windows' version of plain strerror() won't cope. Note that this will break
275+
* if these names are used for anything else besides Windows Sockets errors.
276+
* See TranslateSocketError() when changing this list.
270277
*/
271278
#undef EAGAIN
279+
#define EAGAIN WSAEWOULDBLOCK
272280
#undef EINTR
273281
#define EINTR WSAEINTR
274-
#define EAGAIN WSAEWOULDBLOCK
275282
#undef EMSGSIZE
276283
#define EMSGSIZE WSAEMSGSIZE
277284
#undef EAFNOSUPPORT
@@ -293,26 +300,6 @@ typedef int pid_t;
293300
#undef EOPNOTSUPP
294301
#define EOPNOTSUPP WSAEOPNOTSUPP
295302

296-
/*
297-
* For Microsoft Visual Studio 2010 and above we intentionally redefine
298-
* the regular Berkeley error constants and set them to the WSA constants.
299-
* Note that this will break if those constants are used for anything else
300-
* than Windows Sockets errors.
301-
*/
302-
#if _MSC_VER >= 1600
303-
#pragma warning(disable:4005)
304-
#define EMSGSIZE WSAEMSGSIZE
305-
#define EAFNOSUPPORT WSAEAFNOSUPPORT
306-
#define EWOULDBLOCK WSAEWOULDBLOCK
307-
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
308-
#define ECONNRESET WSAECONNRESET
309-
#define EINPROGRESS WSAEINPROGRESS
310-
#define ENOBUFS WSAENOBUFS
311-
#define ECONNREFUSED WSAECONNREFUSED
312-
#define EOPNOTSUPP WSAEOPNOTSUPP
313-
#pragma warning(default:4005)
314-
#endif
315-
316303
/*
317304
* Extended locale functions with gratuitous underscore prefixes.
318305
* (These APIs are nevertheless fully documented by Microsoft.)

0 commit comments

Comments
 (0)