Skip to content

Commit 02bb4d5

Browse files
committed
Silence warnings from eigen under g++ 7
-Wint-in-bool-context triggers many warnings when compiling eigen code, so disable it locally in eigen.h.
1 parent f4b81b3 commit 02bb4d5

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

include/pybind11/eigen.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@
1717
# pragma GCC diagnostic push
1818
# pragma GCC diagnostic ignored "-Wconversion"
1919
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
20+
# if __GNUC__ >= 7
21+
# pragma GCC diagnostic ignored "-Wint-in-bool-context"
22+
# endif
2023
#endif
2124

2225
#include <Eigen/Core>
2326
#include <Eigen/SparseCore>
2427

25-
#if defined(__GNUG__) || defined(__clang__)
26-
# pragma GCC diagnostic pop
27-
#endif
28-
2928
#if defined(_MSC_VER)
30-
#pragma warning(push)
31-
#pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
29+
# pragma warning(push)
30+
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
3231
#endif
3332

3433
NAMESPACE_BEGIN(pybind11)
@@ -234,6 +233,8 @@ struct type_caster<Type, enable_if_t<is_eigen_sparse<Type>::value>> {
234233
NAMESPACE_END(detail)
235234
NAMESPACE_END(pybind11)
236235

237-
#if defined(_MSC_VER)
238-
#pragma warning(pop)
236+
#if defined(__GNUG__) || defined(__clang__)
237+
# pragma GCC diagnostic pop
238+
#elif defined(_MSC_VER)
239+
# pragma warning(pop)
239240
#endif

0 commit comments

Comments
 (0)