Help CLion IDE evaluate PYBIND11_NUMPY_DTYPE

CLion slows to a crawl when evaluating the intricate `PYBIND11_NUMPY_DTYPE`
macro. This commit replaces the macro cascade with a simple `(void)0`
to ease IDE evaluation.
This commit is contained in:
Dean Moldovan 2017-05-31 16:44:41 +02:00
parent e067c5842b
commit 24dec80b44

View File

@ -1147,6 +1147,11 @@ private:
} }
}; };
#ifdef __CLION_IDE__ // replace heavy macro with dummy code for the IDE (doesn't affect code)
# define PYBIND11_NUMPY_DTYPE(Type, ...) ((void)0)
# define PYBIND11_NUMPY_DTYPE_EX(Type, ...) ((void)0)
#else
#define PYBIND11_FIELD_DESCRIPTOR_EX(T, Field, Name) \ #define PYBIND11_FIELD_DESCRIPTOR_EX(T, Field, Name) \
::pybind11::detail::field_descriptor { \ ::pybind11::detail::field_descriptor { \
Name, offsetof(T, Field), sizeof(decltype(std::declval<T>().Field)), \ Name, offsetof(T, Field), sizeof(decltype(std::declval<T>().Field)), \
@ -1214,6 +1219,8 @@ private:
::pybind11::detail::npy_format_descriptor<Type>::register_dtype \ ::pybind11::detail::npy_format_descriptor<Type>::register_dtype \
({PYBIND11_MAP2_LIST (PYBIND11_FIELD_DESCRIPTOR_EX, Type, __VA_ARGS__)}) ({PYBIND11_MAP2_LIST (PYBIND11_FIELD_DESCRIPTOR_EX, Type, __VA_ARGS__)})
#endif // __CLION_IDE__
template <class T> template <class T>
using array_iterator = typename std::add_pointer<T>::type; using array_iterator = typename std::add_pointer<T>::type;