mirror of
https://github.com/pybind/pybind11.git
synced 2026-06-06 07:51:47 +00:00
Use defined for some preprocessor variables that might be undefined (#2476)
The variables PYBIND11_HAS_OPTIONAL, PYBIND11_HAS_EXP_OPTIONAL, PYBIND11_HAS_VARIANT, __clang__, __APPLE__ were not checked for defined in a minortity of instances. If the project using pybind11 sets -Wundef, the warnings will show. The test build is also modified to catch the problem.
This commit is contained in:
@@ -88,11 +88,11 @@ std::string abs(const Vector2&) {
|
||||
// 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 defined(__APPLE__) && defined(__clang__)
|
||||
#if (__clang_major__ >= 10) && (__clang_minor__ >= 0) && (__clang_patchlevel__ >= 1)
|
||||
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
|
||||
#endif
|
||||
#elif (__clang__)
|
||||
#elif defined(__clang__)
|
||||
#if (__clang_major__ >= 7)
|
||||
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user