]> granicus.if.org Git - python/commitdiff
closes bpo-34581 : Conditionalize use of __pragma in Modules/socketmodule.c. (GH...
authorErik Janssens <erik.janssens@conceptive.be>
Wed, 5 Sep 2018 06:29:42 +0000 (08:29 +0200)
committerBenjamin Peterson <benjamin@python.org>
Wed, 5 Sep 2018 06:29:42 +0000 (23:29 -0700)
Misc/NEWS.d/next/Windows/2018-09-04-23-13-19.bpo-34581.lnbC0k.rst [new file with mode: 0644]
Modules/socketmodule.c

diff --git a/Misc/NEWS.d/next/Windows/2018-09-04-23-13-19.bpo-34581.lnbC0k.rst b/Misc/NEWS.d/next/Windows/2018-09-04-23-13-19.bpo-34581.lnbC0k.rst
new file mode 100644 (file)
index 0000000..2dfa1ae
--- /dev/null
@@ -0,0 +1 @@
+Guard MSVC-specific code in socketmodule.c with ``#ifdef _MSC_VER``.
index 3a439c4bfadc30f7b04b9a96de3b443cd4ee9f30..014f3ba8b5ea98b0f4d6217d81d15cf65d6cdfbe 100644 (file)
@@ -559,15 +559,18 @@ select_error(void)
 #  define SET_SOCK_ERROR(err) WSASetLastError(err)
 #  define SOCK_TIMEOUT_ERR WSAEWOULDBLOCK
 #  define SOCK_INPROGRESS_ERR WSAEWOULDBLOCK
-#  define SUPPRESS_DEPRECATED_CALL __pragma(warning(suppress: 4996))
 #else
 #  define GET_SOCK_ERROR errno
 #  define SET_SOCK_ERROR(err) do { errno = err; } while (0)
 #  define SOCK_TIMEOUT_ERR EWOULDBLOCK
 #  define SOCK_INPROGRESS_ERR EINPROGRESS
-#  define SUPPRESS_DEPRECATED_CALL
 #endif
 
+#ifdef _MSC_VER
+#  define SUPPRESS_DEPRECATED_CALL __pragma(warning(suppress: 4996))
+#else
+#  define SUPPRESS_DEPRECATED_CALL
+#endif
 
 #ifdef MS_WINDOWS
 /* Does WSASocket() support the WSA_FLAG_NO_HANDLE_INHERIT flag? */