mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
Get pybind11 test suite to compile on the Intel compiler (more or less..)
- ICPC can't handle the NCVirt trampoline which returns a non-copyable type, which is likely due to a constexpr/SFINAE issue. This disables the test on that compiler so that at least the rest can be tested.
This commit is contained in:
parent
ce55683084
commit
1ffce7422d
@ -12,14 +12,16 @@
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
|
||||
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
|
||||
# pragma warning(disable: 4512) // warning C4512: Assignment operator was implicitly defined as deleted
|
||||
# pragma warning(disable: 4800) // warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
|
||||
# pragma warning(disable: 4996) // warning C4996: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
|
||||
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
|
||||
# pragma warning(disable: 4512) // warning C4512: Assignment operator was implicitly defined as deleted
|
||||
#elif defined(__ICC) || defined(__INTEL_COMPILER)
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:2196) // warning #2196: routine is both "inline" and "noinline"
|
||||
# pragma warning(disable: 186) // pointless comparison of unsigned integer with zero
|
||||
# pragma warning(disable: 1334) // the "template" keyword used for syntactic disambiguation may only be used within a template
|
||||
# pragma warning(disable: 2196) // warning #2196: routine is both "inline" and "noinline"
|
||||
#elif defined(__GNUG__) && !defined(__clang__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
|
||||
@ -1414,8 +1416,8 @@ NAMESPACE_END(pybind11)
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#elif defined(__ICC) || defined(__INTEL_COMPILER)
|
||||
# pragma warning(pop)
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
/* Leave ignored warnings on */
|
||||
#elif defined(__GNUG__) && !defined(__clang__)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -46,8 +46,7 @@ void bind_ConstructorStats(py::module &m) {
|
||||
.def_readwrite("move_assignments", &ConstructorStats::move_assignments)
|
||||
.def_readwrite("copy_constructions", &ConstructorStats::copy_constructions)
|
||||
.def_readwrite("move_constructions", &ConstructorStats::move_constructions)
|
||||
.def_static("get", (ConstructorStats &(*)(py::object)) &ConstructorStats::get, py::return_value_policy::reference_internal)
|
||||
;
|
||||
.def_static("get", (ConstructorStats &(*)(py::object)) &ConstructorStats::get, py::return_value_policy::reference_internal);
|
||||
}
|
||||
|
||||
PYBIND11_PLUGIN(pybind11_tests) {
|
||||
|
@ -106,9 +106,11 @@ public:
|
||||
std::string print_movable(int a, int b) { return get_movable(a, b).get_value(); }
|
||||
};
|
||||
class NCVirtTrampoline : public NCVirt {
|
||||
#if !defined(__INTEL_COMPILER)
|
||||
virtual NonCopyable get_noncopyable(int a, int b) {
|
||||
PYBIND11_OVERLOAD(NonCopyable, NCVirt, get_noncopyable, a, b);
|
||||
}
|
||||
#endif
|
||||
virtual Movable get_movable(int a, int b) {
|
||||
PYBIND11_OVERLOAD_PURE(Movable, NCVirt, get_movable, a, b);
|
||||
}
|
||||
@ -288,18 +290,19 @@ void init_ex_virtual_functions(py::module &m) {
|
||||
.def("pure_virtual", &ExampleVirt::pure_virtual);
|
||||
|
||||
py::class_<NonCopyable>(m, "NonCopyable")
|
||||
.def(py::init<int, int>())
|
||||
;
|
||||
.def(py::init<int, int>());
|
||||
|
||||
py::class_<Movable>(m, "Movable")
|
||||
.def(py::init<int, int>())
|
||||
;
|
||||
.def(py::init<int, int>());
|
||||
|
||||
#if !defined(__INTEL_COMPILER)
|
||||
py::class_<NCVirt, std::unique_ptr<NCVirt>, NCVirtTrampoline>(m, "NCVirt")
|
||||
.def(py::init<>())
|
||||
.def("get_noncopyable", &NCVirt::get_noncopyable)
|
||||
.def("get_movable", &NCVirt::get_movable)
|
||||
.def("print_nc", &NCVirt::print_nc)
|
||||
.def("print_movable", &NCVirt::print_movable)
|
||||
;
|
||||
.def("print_movable", &NCVirt::print_movable);
|
||||
#endif
|
||||
|
||||
m.def("runExampleVirt", &runExampleVirt);
|
||||
m.def("runExampleVirtBool", &runExampleVirtBool);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
import pybind11_tests
|
||||
from pybind11_tests import ConstructorStats
|
||||
|
||||
|
||||
@ -150,7 +151,7 @@ def test_inheriting_repeat():
|
||||
assert obj.unlucky_number() == 1234
|
||||
assert obj.lucky_number() == -4.25
|
||||
|
||||
|
||||
@pytest.mark.skipif(not hasattr(pybind11_tests, 'NCVirt'))
|
||||
def test_move_support():
|
||||
from pybind11_tests import NCVirt, NonCopyable, Movable
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user