mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 14:45:12 +00:00
Improve PYBIND11_DEPRECATED by showing the message on all compilers
GCC supports `deprecated(msg)` since v4.5 and VS supports the standard [[deprecated(msg)]] since 2015 RTM. The deprecated constructor change from `= default` to `{}` is a workaround for a VS2015 bug.
This commit is contained in:
parent
36f0a15a49
commit
0c4e0372a3
@ -58,7 +58,7 @@ struct metaclass {
|
||||
handle value;
|
||||
|
||||
PYBIND11_DEPRECATED("py::metaclass() is no longer required. It's turned on by default now.")
|
||||
metaclass() = default;
|
||||
metaclass() {}
|
||||
|
||||
/// Override pybind11's default metaclass
|
||||
explicit metaclass(handle value) : value(value) { }
|
||||
|
@ -69,14 +69,10 @@
|
||||
# define PYBIND11_NOINLINE __attribute__ ((noinline))
|
||||
#endif
|
||||
|
||||
#if defined(PYBIND11_CPP14)
|
||||
#if defined(PYBIND11_CPP14) || defined(_MSC_VER)
|
||||
# define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
|
||||
#elif defined(__clang__)
|
||||
#else
|
||||
# define PYBIND11_DEPRECATED(reason) __attribute__((deprecated(reason)))
|
||||
#elif defined(__GNUG__)
|
||||
# define PYBIND11_DEPRECATED(reason) __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
# define PYBIND11_DEPRECATED(reason) __declspec(deprecated)
|
||||
#endif
|
||||
|
||||
#define PYBIND11_VERSION_MAJOR 2
|
||||
|
Loading…
Reference in New Issue
Block a user