From 1dbdcfff4d63377f20fced4a71453be4d24ff8f3 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 8 Nov 2017 16:56:18 +1100 Subject: [PATCH] Attempt to silence warning about deprecated stuff in Boost For some reason, after d7302d684d9d a warning about Boost's use of gethostbyaddr and appeared when compiling wesnothd_connection.cpp on Windows. No idea what change in the above commit caused it, but it seems moving the _WINSOCK_DEPRECATED_NO_WARNINGS define to wesnothd_connection.hpp silences it. --- src/server/server_base.hpp | 5 ----- src/wesnothd_connection.hpp | 29 +++++++++++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/server/server_base.hpp b/src/server/server_base.hpp index 8e11cdccf24b9..451dd1fc9cdf7 100644 --- a/src/server/server_base.hpp +++ b/src/server/server_base.hpp @@ -21,11 +21,6 @@ #include "exceptions.hpp" -// MSVC compilation throws deprecation warnings on boost's use of gethostbyaddr and gethostbyname in socket_ops.ipp -#ifdef _WIN32 -#define _WINSOCK_DEPRECATED_NO_WARNINGS -#endif - #include #include #include diff --git a/src/wesnothd_connection.hpp b/src/wesnothd_connection.hpp index 9486f7c25e7ef..b42aba6472ae5 100644 --- a/src/wesnothd_connection.hpp +++ b/src/wesnothd_connection.hpp @@ -15,18 +15,27 @@ #pragma once #ifdef _WIN32 -# define BOOST_ASIO_DISABLE_IOCP -# ifdef INADDR_ANY -# undef INADDR_ANY -# endif -# ifdef INADDR_BROADCAST -# undef INADDR_BROADCAST -# endif -# ifdef INADDR_NONE -# undef INADDR_NONE -# endif + +// MSVC compilation throws deprecation warnings on boost's use of gethostbyaddr and +// gethostbyname in socket_ops.ipp. This define silences that. +#define _WINSOCK_DEPRECATED_NO_WARNINGS + +#define BOOST_ASIO_DISABLE_IOCP + +#ifdef INADDR_ANY +#undef INADDR_ANY +#endif + +#ifdef INADDR_BROADCAST +#undef INADDR_BROADCAST +#endif + +#ifdef INADDR_NONE +#undef INADDR_NONE #endif +#endif // endif _WIN32 + #include #include #include