diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 4ef0ea8d2..947ef4a0e 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -47,7 +47,7 @@ // or newer. # if _MSVC_LANG >= 201402L # define PYBIND11_CPP14 -# if _MSVC_LANG > 201402L && _MSC_VER >= 1910 +# if _MSVC_LANG > 201402L # define PYBIND11_CPP17 # if _MSVC_LANG >= 202002L # define PYBIND11_CPP20 @@ -147,7 +147,7 @@ /* Don't let Python.h #define (v)snprintf as macro because they are implemented properly in Visual Studio since 2015. */ -#if defined(_MSC_VER) && _MSC_VER >= 1900 +#if defined(_MSC_VER) # define HAVE_SNPRINTF 1 #endif @@ -559,7 +559,7 @@ static_assert(std::is_standard_layout::value, "Internal error: `pybind11::detail::instance` is not standard layout!"); /// from __cpp_future__ import (convenient aliases from C++14/17) -#if defined(PYBIND11_CPP14) && (!defined(_MSC_VER) || _MSC_VER >= 1910) +#if defined(PYBIND11_CPP14) using std::conditional_t; using std::enable_if_t; using std::remove_cv_t; @@ -1116,7 +1116,7 @@ try_get_shared_from_this(std::enable_shared_from_this *holder_value_ptr) { // For silencing "unused" compiler warnings in special situations. template -#if defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER < 1920 // MSVC 2017 +#if defined(_MSC_VER) && _MSC_VER < 1920 // MSVC 2017 constexpr #endif inline void diff --git a/tests/pybind11_tests.h b/tests/pybind11_tests.h index 283801a1b..a7c00c2f9 100644 --- a/tests/pybind11_tests.h +++ b/tests/pybind11_tests.h @@ -3,12 +3,6 @@ #include #include -#if defined(_MSC_VER) && _MSC_VER < 1910 -// We get some really long type names here which causes MSVC 2015 to emit warnings -# pragma warning( \ - disable : 4503) // NOLINT: warning C4503: decorated name length exceeded, name was truncated -#endif - namespace py = pybind11; using namespace pybind11::literals; diff --git a/tests/test_class.cpp b/tests/test_class.cpp index 329c9fe7b..11091afce 100644 --- a/tests/test_class.cpp +++ b/tests/test_class.cpp @@ -356,11 +356,7 @@ TEST_SUBMODULE(class_, m) { py::class_(m, "ProtectedA") .def(py::init<>()) -#if !defined(_MSC_VER) || _MSC_VER >= 1910 .def("foo", &PublicistA::foo); -#else - .def("foo", static_cast(&PublicistA::foo)); -#endif class ProtectedB { public: @@ -391,11 +387,7 @@ TEST_SUBMODULE(class_, m) { py::class_(m, "ProtectedB") .def(py::init<>()) -#if !defined(_MSC_VER) || _MSC_VER >= 1910 .def("foo", &PublicistB::foo); -#else - .def("foo", static_cast(&PublicistB::foo)); -#endif // test_brace_initialization struct BraceInitialization { diff --git a/tests/test_const_name.cpp b/tests/test_const_name.cpp index 5cb3d16c1..f1b13e276 100644 --- a/tests/test_const_name.cpp +++ b/tests/test_const_name.cpp @@ -4,13 +4,6 @@ #include "pybind11_tests.h" -#if defined(_MSC_VER) && _MSC_VER < 1910 - -// MSVC 2015 fails in bizarre ways. -# define PYBIND11_SKIP_TEST_CONST_NAME - -#else // Only test with MSVC 2017 or newer. - // IUT = Implementation Under Test # define CONST_NAME_TESTS(TEST_FUNC, IUT) \ std::string TEST_FUNC(int selector) { \ @@ -51,18 +44,10 @@ CONST_NAME_TESTS(const_name_tests, py::detail::const_name) CONST_NAME_TESTS(underscore_tests, py::detail::_) # endif -#endif // MSVC >= 2017 - TEST_SUBMODULE(const_name, m) { -#ifdef PYBIND11_SKIP_TEST_CONST_NAME - m.attr("const_name_tests") = "PYBIND11_SKIP_TEST_CONST_NAME"; -#else m.def("const_name_tests", const_name_tests); -#endif -#ifdef PYBIND11_SKIP_TEST_CONST_NAME - m.attr("underscore_tests") = "PYBIND11_SKIP_TEST_CONST_NAME"; -#elif defined(PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY) +#if defined(PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY) m.def("underscore_tests", underscore_tests); #else m.attr("underscore_tests") = "PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY not defined."; diff --git a/tests/test_eigen.cpp b/tests/test_eigen.cpp index 059843d3d..74e76eb7e 100644 --- a/tests/test_eigen.cpp +++ b/tests/test_eigen.cpp @@ -14,9 +14,6 @@ #include "pybind11_tests.h" #if defined(_MSC_VER) -# if _MSC_VER < 1910 // VS 2015's MSVC -# pragma warning(disable : 4127) // C4127: conditional expression is constant -# endif # pragma warning(disable : 4996) // C4996: std::unary_negation is deprecated #endif diff --git a/tests/test_factory_constructors.cpp b/tests/test_factory_constructors.cpp index 81e32f5ab..a387cd2e7 100644 --- a/tests/test_factory_constructors.cpp +++ b/tests/test_factory_constructors.cpp @@ -381,13 +381,6 @@ TEST_SUBMODULE(factory_constructors, m) { ::operator delete(p); } static void operator delete(void *, void *) { py::print("noisy placement delete"); } -#if defined(_MSC_VER) && _MSC_VER < 1910 - // MSVC 2015 bug: the above "noisy delete" isn't invoked (fixed in MSVC 2017) - static void operator delete(void *p) { - py::print("noisy delete"); - ::operator delete(p); - } -#endif }; py::class_ pyNoisyAlloc(m, "NoisyAlloc"); diff --git a/tests/test_iostream.cpp b/tests/test_iostream.cpp index dd0e19e0b..421eaa2dd 100644 --- a/tests/test_iostream.cpp +++ b/tests/test_iostream.cpp @@ -7,10 +7,6 @@ BSD-style license that can be found in the LICENSE file. */ -#if defined(_MSC_VER) && _MSC_VER < 1910 // VS 2015's MSVC -# pragma warning(disable : 4702) // unreachable code in system header (xatomic.h(382)) -#endif - #include #include "pybind11_tests.h" diff --git a/tests/test_smart_ptr.cpp b/tests/test_smart_ptr.cpp index f26c47c30..2c23a9a19 100644 --- a/tests/test_smart_ptr.cpp +++ b/tests/test_smart_ptr.cpp @@ -8,10 +8,6 @@ BSD-style license that can be found in the LICENSE file. */ -#if defined(_MSC_VER) && _MSC_VER < 1910 // VS 2015's MSVC -# pragma warning(disable : 4702) // unreachable code in system header (xatomic.h(382)) -#endif - #include "object.h" #include "pybind11_tests.h" diff --git a/tests/test_stl.cpp b/tests/test_stl.cpp index 44a6eb2e3..fd1824beb 100644 --- a/tests/test_stl.cpp +++ b/tests/test_stl.cpp @@ -37,7 +37,7 @@ struct type_caster : void_caster {}; // Test with `std::variant` in C++17 mode, or with `boost::variant` in C++11/14 #if defined(PYBIND11_HAS_VARIANT) using std::variant; -#elif defined(PYBIND11_TEST_BOOST) && (!defined(_MSC_VER) || _MSC_VER >= 1910) +#elif defined(PYBIND11_TEST_BOOST) # include # define PYBIND11_HAS_VARIANT 1 using boost::variant;