From cb63770978151a89e07c38e7a131ad3de3927020 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Tue, 13 Dec 2016 19:09:08 -0500 Subject: [PATCH] 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. --- include/pybind11/eigen.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/pybind11/eigen.h b/include/pybind11/eigen.h index 0a1208e1..72e876a8 100644 --- a/include/pybind11/eigen.h +++ b/include/pybind11/eigen.h @@ -17,18 +17,17 @@ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wconversion" # pragma GCC diagnostic ignored "-Wdeprecated-declarations" +# if __GNUC__ >= 7 +# pragma GCC diagnostic ignored "-Wint-in-bool-context" +# endif #endif #include #include -#if defined(__GNUG__) || defined(__clang__) -# pragma GCC diagnostic pop -#endif - #if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable: 4127) // warning C4127: Conditional expression is constant +# pragma warning(push) +# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant #endif NAMESPACE_BEGIN(pybind11) @@ -234,6 +233,8 @@ struct type_caster::value>> { NAMESPACE_END(detail) NAMESPACE_END(pybind11) -#if defined(_MSC_VER) -#pragma warning(pop) +#if defined(__GNUG__) || defined(__clang__) +# pragma GCC diagnostic pop +#elif defined(_MSC_VER) +# pragma warning(pop) #endif