Disable warnings inside winsock2.h when using MSVC too

We already disabled the warnings inside windows.h, but since bf5090bcf3
(Enable Winsock 2 and IPv6 build options by default, 2021-04-24) we
could get warnings from winsock2.h, so move its inclusion inside the
region where the warnings were disabled too.

For the record, the warnings were, rather surprisingly, C4668, which is
disabled by default, but apparently was enabled somewhere inside (at
least some versions of) SDK headers.

This commit is best viewed with --color-moved git option.
This commit is contained in:
Vadim Zeitlin 2021-05-18 00:11:57 +01:00
parent 94b399418c
commit a352dee1f1

View File

@ -27,6 +27,10 @@
#define NOMINMAX
#endif // NOMINMAX
// Disable any warnings inside Windows headers.
#ifdef __VISUALC__
#pragma warning(push, 1)
#endif
// When the application wants to use <winsock2.h> (this is required for IPv6
// support, for example), we must include it before winsock.h, and as windows.h
@ -38,12 +42,8 @@
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#endif
#include <winsock2.h>
#endif
// Disable any warnings inside Windows headers.
#ifdef __VISUALC__
#pragma warning(push, 1)
#include <winsock2.h>
#endif
#include <windows.h>