mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
1st manual pass, builds & tests with unix_clang, before pre-commit.
This commit is contained in:
parent
21212ce5e1
commit
2ba40fc50b
@ -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<instance>::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<T> *holder_value_ptr) {
|
||||
|
||||
// For silencing "unused" compiler warnings in special situations.
|
||||
template <typename... Args>
|
||||
#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
|
||||
|
@ -3,12 +3,6 @@
|
||||
#include <pybind11/eval.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
@ -356,11 +356,7 @@ TEST_SUBMODULE(class_, m) {
|
||||
|
||||
py::class_<ProtectedA>(m, "ProtectedA")
|
||||
.def(py::init<>())
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1910
|
||||
.def("foo", &PublicistA::foo);
|
||||
#else
|
||||
.def("foo", static_cast<int (ProtectedA::*)() const>(&PublicistA::foo));
|
||||
#endif
|
||||
|
||||
class ProtectedB {
|
||||
public:
|
||||
@ -391,11 +387,7 @@ TEST_SUBMODULE(class_, m) {
|
||||
|
||||
py::class_<ProtectedB, TrampolineB>(m, "ProtectedB")
|
||||
.def(py::init<>())
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1910
|
||||
.def("foo", &PublicistB::foo);
|
||||
#else
|
||||
.def("foo", static_cast<int (ProtectedB::*)() const>(&PublicistB::foo));
|
||||
#endif
|
||||
|
||||
// test_brace_initialization
|
||||
struct BraceInitialization {
|
||||
|
@ -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.";
|
||||
|
@ -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
|
||||
|
||||
|
@ -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_<NoisyAlloc> pyNoisyAlloc(m, "NoisyAlloc");
|
||||
|
@ -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 <pybind11/iostream.h>
|
||||
|
||||
#include "pybind11_tests.h"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -37,7 +37,7 @@ struct type_caster<boost::none_t> : void_caster<boost::none_t> {};
|
||||
// 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 <boost/variant.hpp>
|
||||
# define PYBIND11_HAS_VARIANT 1
|
||||
using boost::variant;
|
||||
|
Loading…
Reference in New Issue
Block a user