From 05a6cfeaeaca3365f455445a9b986673752309ab Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik <bubnikv@gmail.com> Date: Wed, 10 Feb 2021 18:04:16 +0100 Subject: [PATCH] Some more reduction of compiler warnings on MSVC --- src/libslic3r/GCodeSender.hpp | 2 +- src/libslic3r/Geometry.hpp | 2 +- src/libslic3r/OpenVDBUtils.cpp | 10 ++++++++++ src/libslic3r/OpenVDBUtils.hpp | 9 +++++++++ src/libslic3r/pchheader.hpp | 9 ++++++++- src/slic3r/GUI/NotificationManager.cpp | 2 +- src/slic3r/pchheader.hpp | 7 +++++++ 7 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCodeSender.hpp b/src/libslic3r/GCodeSender.hpp index d7663ca55..3a2055e54 100644 --- a/src/libslic3r/GCodeSender.hpp +++ b/src/libslic3r/GCodeSender.hpp @@ -6,7 +6,7 @@ #include <string> #include <vector> #include <boost/asio.hpp> -#include <boost/bind.hpp> +#include <boost/bind/bind.hpp> #include <boost/thread.hpp> namespace Slic3r { diff --git a/src/libslic3r/Geometry.hpp b/src/libslic3r/Geometry.hpp index 8b062276e..9d98ea6ae 100644 --- a/src/libslic3r/Geometry.hpp +++ b/src/libslic3r/Geometry.hpp @@ -13,7 +13,7 @@ #define BOOST_VORONOI_USE_GMP 1 #ifdef _MSC_VER -// Suppress warning C4146 in include/gmp.h(2177,31): unary minus operator applied to unsigned type, result still unsigned +// Suppress warning C4146 in OpenVDB: unary minus operator applied to unsigned type, result still unsigned #pragma warning(push) #pragma warning(disable : 4146) #endif // _MSC_VER diff --git a/src/libslic3r/OpenVDBUtils.cpp b/src/libslic3r/OpenVDBUtils.cpp index 31ae203dd..0f5bfa157 100644 --- a/src/libslic3r/OpenVDBUtils.cpp +++ b/src/libslic3r/OpenVDBUtils.cpp @@ -1,6 +1,16 @@ #define NOMINMAX #include "OpenVDBUtils.hpp" + +#ifdef _MSC_VER +// Suppress warning C4146 in OpenVDB: unary minus operator applied to unsigned type, result still unsigned +#pragma warning(push) +#pragma warning(disable : 4146) +#endif // _MSC_VER #include <openvdb/tools/MeshToVolume.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif // _MSC_VER + #include <openvdb/tools/VolumeToMesh.h> #include <openvdb/tools/Composite.h> #include <openvdb/tools/LevelSetRebuild.h> diff --git a/src/libslic3r/OpenVDBUtils.hpp b/src/libslic3r/OpenVDBUtils.hpp index e35231d35..aa4b5154a 100644 --- a/src/libslic3r/OpenVDBUtils.hpp +++ b/src/libslic3r/OpenVDBUtils.hpp @@ -3,7 +3,16 @@ #include <libslic3r/TriangleMesh.hpp> #include <libslic3r/SLA/Contour3D.hpp> + +#ifdef _MSC_VER +// Suppress warning C4146 in include/gmp.h(2177,31): unary minus operator applied to unsigned type, result still unsigned +#pragma warning(push) +#pragma warning(disable : 4146) +#endif // _MSC_VER #include <openvdb/openvdb.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif // _MSC_VER namespace Slic3r { diff --git a/src/libslic3r/pchheader.hpp b/src/libslic3r/pchheader.hpp index a1d6da5fe..9386fdf36 100644 --- a/src/libslic3r/pchheader.hpp +++ b/src/libslic3r/pchheader.hpp @@ -60,7 +60,7 @@ #include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/trim.hpp> -#include <boost/bind.hpp> +#include <boost/bind/bind.hpp> #include <boost/config.hpp> #include <boost/config/warning_disable.hpp> #include <boost/container/small_vector.hpp> @@ -88,8 +88,15 @@ #include <boost/nowide/fstream.hpp> #include <boost/nowide/integration/filesystem.hpp> #include <boost/nowide/iostream.hpp> + +// boost/property_tree/json_parser/detail/parser.hpp includes boost/bind.hpp, which is deprecated. +// Suppress the following boost message: +// The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. +#define BOOST_BIND_GLOBAL_PLACEHOLDERS #include <boost/property_tree/ini_parser.hpp> #include <boost/property_tree/ptree.hpp> +#undef BOOST_BIND_GLOBAL_PLACEHOLDERS + #include <boost/thread.hpp> #include <boost/version.hpp> diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 78969d725..b7bc50d24 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -10,7 +10,7 @@ #include <boost/algorithm/string.hpp> #include <boost/log/trivial.hpp> -#include <boost/bind/placeholders.hpp> +#include <boost/bind/bind.hpp> #include <boost/nowide/convert.hpp> #include <iostream> diff --git a/src/slic3r/pchheader.hpp b/src/slic3r/pchheader.hpp index ebdabe836..816733f45 100644 --- a/src/slic3r/pchheader.hpp +++ b/src/slic3r/pchheader.hpp @@ -78,10 +78,17 @@ #include <boost/nowide/cstdio.hpp> #include <boost/nowide/fstream.hpp> #include <boost/optional.hpp> + +// boost/property_tree/json_parser/detail/parser.hpp includes boost/bind.hpp, which is deprecated. +// Suppress the following boost message: +// The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. +#define BOOST_BIND_GLOBAL_PLACEHOLDERS #include <boost/property_tree/ini_parser.hpp> #include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree_fwd.hpp> +#undef BOOST_BIND_GLOBAL_PLACEHOLDERS + #include <boost/system/error_code.hpp> #include <tbb/parallel_for.h>