Commit ae951ca0 by Henry Schreiner Committed by Wenzel Jakob

CI fixes (#1744)

* Fix warning that not including a cmake source or build dir will be a fatal error (it is now on newest CMakes)
    * Fixes appveyor
* Travis uses CMake 3.9 for more than a year now
* Travis dropped sudo: false in December
* Dropping Sphinx 2
- clang7: Suppress self-assign warnings; fix missing virtual dtors
- pypy:
  - Keep old version (newer stuff breaks)
  - Pin packages to extra index for speed
- travis:
  - Make docker explicit; remove docker if not needed
  - Make commands more verbose (for debugging / repro)
  - Make Ubuntu dist explicit per job
- Fix Windows
- Add names to travis
parent 25abf7ef
...@@ -62,6 +62,7 @@ build_script: ...@@ -62,6 +62,7 @@ build_script:
-DPYBIND11_WERROR=ON -DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON -DDOWNLOAD_CATCH=ON
-DCMAKE_SUPPRESS_REGENERATION=1 -DCMAKE_SUPPRESS_REGENERATION=1
.
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cmake --build . --config %CONFIG% --target pytest -- /m /v:m /logger:%MSBuildLogger% - cmake --build . --config %CONFIG% --target pytest -- /m /v:m /logger:%MSBuildLogger%
- cmake --build . --config %CONFIG% --target cpptest -- /m /v:m /logger:%MSBuildLogger% - cmake --build . --config %CONFIG% --target cpptest -- /m /v:m /logger:%MSBuildLogger%
......
...@@ -1509,7 +1509,7 @@ private: ...@@ -1509,7 +1509,7 @@ private:
if (trivial == broadcast_trivial::f_trivial) result = array_t<Return, array::f_style>(shape); if (trivial == broadcast_trivial::f_trivial) result = array_t<Return, array::f_style>(shape);
else result = array_t<Return>(shape); else result = array_t<Return>(shape);
if (size == 0) return result; if (size == 0) return std::move(result);
/* Call the function */ /* Call the function */
if (trivial == broadcast_trivial::non_trivial) if (trivial == broadcast_trivial::non_trivial)
...@@ -1517,7 +1517,7 @@ private: ...@@ -1517,7 +1517,7 @@ private:
else else
apply_trivial(buffers, params, result.mutable_data(), size, i_seq, vi_seq, bi_seq); apply_trivial(buffers, params, result.mutable_data(), size, i_seq, vi_seq, bi_seq);
return result; return std::move(result);
} }
template <size_t... Index, size_t... VIndex, size_t... BIndex> template <size_t... Index, size_t... VIndex, size_t... BIndex>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
class VirtClass { class VirtClass {
public: public:
virtual ~VirtClass() {}
virtual void virtual_func() {} virtual void virtual_func() {}
virtual void pure_virtual_func() = 0; virtual void pure_virtual_func() = 0;
}; };
......
...@@ -34,7 +34,9 @@ TEST_SUBMODULE(kwargs_and_defaults, m) { ...@@ -34,7 +34,9 @@ TEST_SUBMODULE(kwargs_and_defaults, m) {
m.def("kw_func_udl_z", kw_func, "x"_a, "y"_a=0); m.def("kw_func_udl_z", kw_func, "x"_a, "y"_a=0);
// test_args_and_kwargs // test_args_and_kwargs
m.def("args_function", [](py::args args) -> py::tuple { return args; }); m.def("args_function", [](py::args args) -> py::tuple {
return std::move(args);
});
m.def("args_kwargs_function", [](py::args args, py::kwargs kwargs) { m.def("args_kwargs_function", [](py::args args, py::kwargs kwargs) {
return py::make_tuple(args, kwargs); return py::make_tuple(args, kwargs);
}); });
......
...@@ -62,6 +62,25 @@ namespace std { ...@@ -62,6 +62,25 @@ namespace std {
}; };
} }
// MSVC warns about unknown pragmas, and warnings are errors.
#ifndef _MSC_VER
#pragma GCC diagnostic push
// clang 7.0.0 and Apple LLVM 10.0.1 introduce `-Wself-assign-overloaded` to
// `-Wall`, which is used here for overloading (e.g. `py::self += py::self `).
// Here, we suppress the warning using `#pragma diagnostic`.
// Taken from: https://github.com/RobotLocomotion/drake/commit/aaf84b46
// TODO(eric): This could be resolved using a function / functor (e.g. `py::self()`).
#if (__APPLE__) && (__clang__)
#if (__clang_major__ >= 10) && (__clang_minor__ >= 0) && (__clang_patchlevel__ >= 1)
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
#endif
#elif (__clang__)
#if (__clang_major__ >= 7)
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
#endif
#endif
#endif
TEST_SUBMODULE(operators, m) { TEST_SUBMODULE(operators, m) {
// test_operator_overloading // test_operator_overloading
...@@ -144,3 +163,7 @@ TEST_SUBMODULE(operators, m) { ...@@ -144,3 +163,7 @@ TEST_SUBMODULE(operators, m) {
.def_readwrite("b", &NestC::b); .def_readwrite("b", &NestC::b);
m.def("get_NestC", [](const NestC &c) { return c.value; }); m.def("get_NestC", [](const NestC &c) { return c.value; });
} }
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif
...@@ -336,7 +336,9 @@ TEST_SUBMODULE(smart_ptr, m) { ...@@ -336,7 +336,9 @@ TEST_SUBMODULE(smart_ptr, m) {
// test_shared_ptr_gc // test_shared_ptr_gc
// #187: issue involving std::shared_ptr<> return value policy & garbage collection // #187: issue involving std::shared_ptr<> return value policy & garbage collection
struct ElementBase { virtual void foo() { } /* Force creation of virtual table */ }; struct ElementBase {
virtual ~ElementBase() { } /* Force creation of virtual table */
};
py::class_<ElementBase, std::shared_ptr<ElementBase>>(m, "ElementBase"); py::class_<ElementBase, std::shared_ptr<ElementBase>>(m, "ElementBase");
struct ElementA : ElementBase { struct ElementA : ElementBase {
......
...@@ -129,6 +129,7 @@ private: ...@@ -129,6 +129,7 @@ private:
class NCVirt { class NCVirt {
public: public:
virtual ~NCVirt() { }
virtual NonCopyable get_noncopyable(int a, int b) { return NonCopyable(a, b); } virtual NonCopyable get_noncopyable(int a, int b) { return NonCopyable(a, b); }
virtual Movable get_movable(int a, int b) = 0; virtual Movable get_movable(int a, int b) = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment