mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-28 08:02:00 +00:00
Silence new MSVC C++17 deprecation warnings
In the latest MSVC in C++17 mode including Eigen causes warnings: warning C4996: 'std::unary_negate<_Fn>': warning STL4008: std::not1(), std::not2(), std::unary_negate, and std::binary_negate are deprecated in C++17. They are superseded by std::not_fn(). You can define _SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. This disables 4996 for the Eigen includes. Catch generates a similar warning for std::uncaught_exception, so disable the warning there, too. In both cases this is temporary; we can (and should) remove the warnings disabling once new upstream versions of Eigen and Catch are available that address the warning. (The Catch one, in particular, looks to be fixed in upstream master, so will probably be fixed in the next (2.0.2) release).
This commit is contained in:
parent
7ab1cd34b1
commit
3793c7ed9a
@ -22,14 +22,15 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Eigen/Core>
|
|
||||||
#include <Eigen/SparseCore>
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
|
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
|
||||||
|
# pragma warning(disable: 4996) // warning C4996: std::unary_negate is deprecated in C++17
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <Eigen/Core>
|
||||||
|
#include <Eigen/SparseCore>
|
||||||
|
|
||||||
// Eigen prior to 3.2.7 doesn't have proper move constructors--but worse, some classes get implicit
|
// Eigen prior to 3.2.7 doesn't have proper move constructors--but worse, some classes get implicit
|
||||||
// move constructors that break things. We could detect this an explicitly copy, but an extra copy
|
// move constructors that break things. We could detect this an explicitly copy, but an extra copy
|
||||||
// of matrices seems highly undesirable.
|
// of matrices seems highly undesirable.
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
#include "constructor_stats.h"
|
#include "constructor_stats.h"
|
||||||
#include <pybind11/eigen.h>
|
#include <pybind11/eigen.h>
|
||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# pragma warning(disable: 4996) // C4996: std::unary_negation is deprecated
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Eigen/Cholesky>
|
#include <Eigen/Cholesky>
|
||||||
|
|
||||||
using MatrixXdR = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
|
using MatrixXdR = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
|
||||||
|
@ -3,6 +3,12 @@
|
|||||||
|
|
||||||
#include <pybind11/embed.h>
|
#include <pybind11/embed.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch
|
||||||
|
// 2.0.1; this should be fixed in the next catch release after 2.0.1).
|
||||||
|
# pragma warning(disable: 4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CATCH_CONFIG_RUNNER
|
#define CATCH_CONFIG_RUNNER
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
#include <pybind11/embed.h>
|
#include <pybind11/embed.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch
|
||||||
|
// 2.0.1; this should be fixed in the next catch release after 2.0.1).
|
||||||
|
# pragma warning(disable: 4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
Loading…
Reference in New Issue
Block a user