Dead code in win32.h - Mailing list pgsql-hackers

From Tom Lane
Subject Dead code in win32.h
Date
Msg-id 17633.1461266738@sss.pgh.pa.us
Whole thread Raw
Responses Re: Dead code in win32.h
List pgsql-hackers
src/include/port/win32.h contains (starting around line 270):


/** Supplement to <errno.h>.*/
#undef EAGAIN
#undef EINTR
#define EINTR WSAEINTR
#define EAGAIN WSAEWOULDBLOCK
#undef EMSGSIZE
#define EMSGSIZE WSAEMSGSIZE
#undef EAFNOSUPPORT
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#undef EWOULDBLOCK
#define EWOULDBLOCK WSAEWOULDBLOCK
#undef ECONNRESET
#define ECONNRESET WSAECONNRESET
#undef EINPROGRESS
#define EINPROGRESS WSAEINPROGRESS
#undef ENOBUFS
#define ENOBUFS WSAENOBUFS
#undef EPROTONOSUPPORT
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#undef ECONNREFUSED
#define ECONNREFUSED WSAECONNREFUSED
#undef EBADFD
#define EBADFD WSAENOTSOCK
#undef EOPNOTSUPP
#define EOPNOTSUPP WSAEOPNOTSUPP

/** For Microsoft Visual Studio 2010 and above we intentionally redefine* the regular Berkeley error constants and set
themto the WSA constants.* Note that this will break if those constants are used for anything else* than Windows
Socketserrors.*/
 
#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


Perhaps I'm missing something, but if so, in what way is the
"#if _MSC_VER >= 1600" stanza not totally useless given the
immediately preceding macro redefinitions?  And doesn't the
comment above it apply just as much to the preceding definitions
(other than the claim that it only happens in newer MSVC versions)?
        regards, tom lane



pgsql-hackers by date:

Previous
From: Ants Aasma
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Next
From: Alvaro Herrera
Date:
Subject: Re: kqueue