From: Tom Lane Date: Thu, 16 Nov 2017 17:03:04 +0000 (-0500) Subject: Define _WINSOCK_DEPRECATED_NO_WARNINGS in all MSVC builds. X-Git-Tag: REL_11_BETA1~1222 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff2d4356f8b18f5489e5d7b1f8b4b5357d088c8c;p=postgresql Define _WINSOCK_DEPRECATED_NO_WARNINGS in all MSVC builds. Commit 0fb54de9a thought that this was only needed in VS2015 and later, but buildfarm member woodlouse shows that at least VS2013 whines as well. Let's just define it regardless of MSVC version; it should be harmless enough in older releases. Also, in the wake of ed9b3606d, it seems better to put it in win32_port.h where is included. Since this is only suppressing a pedantic compiler warning, I don't feel a need for a back-patch. Discussion: https://postgr.es/m/20124.1510850225@sss.pgh.pa.us --- diff --git a/src/include/port/win32.h b/src/include/port/win32.h index 123b2100f8..611e04fac6 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -15,11 +15,8 @@ * Studio 2015 the minimum requirement is Windows Vista (0x0600) to * get support for GetLocaleInfoEx() with locales. For everything else * the minimum version is Windows XP (0x0501). - * Also for VS2015, add a define that stops compiler complaints about - * using the old Winsock API. */ #if defined(_MSC_VER) && _MSC_VER >= 1900 -#define _WINSOCK_DEPRECATED_NO_WARNINGS #define MIN_WINNT 0x0600 #else #define MIN_WINNT 0x0501 diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h index db7dc16932..46d7b0035f 100644 --- a/src/include/port/win32_port.h +++ b/src/include/port/win32_port.h @@ -27,6 +27,14 @@ #undef ERROR +/* + * VS2013 and later issue warnings about using the old Winsock API, + * which we don't really want to hear about. + */ +#ifdef _MSC_VER +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif + /* * The MinGW64 headers choke if this is already defined - they * define it themselves.