mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-24 22:25:10 +00:00
3793c7ed9a
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).
23 lines
643 B
C++
23 lines
643 B
C++
// The Catch implementation is compiled here. This is a standalone
|
|
// translation unit to avoid recompiling it for every test change.
|
|
|
|
#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
|
|
#include <catch.hpp>
|
|
|
|
namespace py = pybind11;
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
py::scoped_interpreter guard{};
|
|
auto result = Catch::Session().run(argc, argv);
|
|
|
|
return result < 0xff ? result : 0xff;
|
|
}
|