mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +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:
@@ -15,7 +15,7 @@
|
||||
#include <string>
|
||||
|
||||
// Test with `std::variant` in C++17 mode, or with `boost::variant` in C++11/14
|
||||
#if PYBIND11_HAS_VARIANT
|
||||
#if defined(PYBIND11_HAS_VARIANT)
|
||||
using std::variant;
|
||||
#elif defined(PYBIND11_TEST_BOOST) && (!defined(_MSC_VER) || _MSC_VER >= 1910)
|
||||
# include <boost/variant.hpp>
|
||||
|
||||
Reference in New Issue
Block a user