Resolve empty statement warning when using PYBIND11_OVERLOAD_PURE_NAME and PYBIND11_OVERLOAD_PURE (#2325)

* Wrap PYBIND11_OVERLOAD_NAME and PYBIND11_OVERLOAD_PURE_NAME in do { ... } while (false), and resolve trailing semicolon

* Deprecate PYBIND11_OVERLOAD_* and get_overload in favor of PYBIND11_OVERRIDE_* and get_override

* Correct erroneous usage of 'overload' instead of 'override' in the implementation and internals

* Fix tests to use non-deprecated PYBIND11_OVERRIDE_* macros

* Update docs to use override instead of overload where appropriate, and add warning about deprecated aliases

* Add semicolons to deprecated PYBIND11_OVERLOAD macros to match original behavior

* Remove deprecation of PYBIND11_OVERLOAD_* macros and get_overload

* Add note to changelog and upgrade guide
This commit is contained in:
Yannick Jadoul
2020-09-15 14:56:20 +02:00
committed by GitHub
parent 9df13835c8
commit d65e34d61d
15 changed files with 169 additions and 119 deletions

View File

@@ -89,7 +89,7 @@ public:
PyTF6(const PyTF6 &f) : TestFactory6(f) { print_copy_created(this); }
PyTF6(std::string s) : TestFactory6((int) s.size()) { alias = true; print_created(this, s); }
virtual ~PyTF6() { print_destroyed(this); }
int get() override { PYBIND11_OVERLOAD(int, TestFactory6, get, /*no args*/); }
int get() override { PYBIND11_OVERRIDE(int, TestFactory6, get, /*no args*/); }
};
class TestFactory7 {
@@ -110,7 +110,7 @@ public:
PyTF7(PyTF7 &&f) : TestFactory7(std::move(f)) { print_move_created(this); }
PyTF7(const PyTF7 &f) : TestFactory7(f) { print_copy_created(this); }
virtual ~PyTF7() { print_destroyed(this); }
int get() override { PYBIND11_OVERLOAD(int, TestFactory7, get, /*no args*/); }
int get() override { PYBIND11_OVERRIDE(int, TestFactory7, get, /*no args*/); }
};