diff --git a/dune/common/debugalign.hh b/dune/common/debugalign.hh index f4d7615a5a8ba5e0994ffb1f90627c04322f3e08..f2b5409b37122887d25891f5447944d653f53da8 100644 --- a/dune/common/debugalign.hh +++ b/dune/common/debugalign.hh @@ -170,9 +170,20 @@ namespace Dune { class = void_t<decltype(-std::declval<const U&>())> > decltype(auto) operator-() const { return aligned<align>(-value_); } + /* + * silence warnings from GCC about using `~` on a bool + * (when instantiated for T=bool) + */ +#if __GNUC__ >= 7 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wbool-operation" +#endif template<class U = T, class = void_t<decltype(~std::declval<const U&>())> > decltype(auto) operator~() const { return aligned<align>(~value_); } +#if __GNUC__ >= 7 +# pragma GCC diagnostic pop +#endif template<class U = T, class = void_t<decltype(!std::declval<const U&>())> > diff --git a/dune/common/simd/loop.hh b/dune/common/simd/loop.hh index a2d124cfdb22c06f6a71721fe7acd0843c440ddf..ffa491d16236bb63f2bad069b4ca1eebcb71d19a 100644 --- a/dune/common/simd/loop.hh +++ b/dune/common/simd/loop.hh @@ -12,6 +12,16 @@ namespace Dune { +/* + * silence warnings from GCC about using integer operands on a bool + * (when instantiated for T=bool) + */ +#if __GNUC__ >= 7 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wbool-operation" +# pragma GCC diagnostic ignored "-Wint-in-bool-context" +#endif + /** * This class specifies a vector-like type deriving from std::array * for memory management and basic accessibility. @@ -505,6 +515,10 @@ namespace Dune { public std::integral_constant<bool, IsNumber<T>::value>{ }; +#if __GNUC__ >= 7 +# pragma GCC diagnostic pop +#endif + } //namespace Dune #endif diff --git a/dune/common/test/arithmetictestsuite.hh b/dune/common/test/arithmetictestsuite.hh index b986fe125df0425987128502ebaa5e14a70e99fe..6cb3e1f559c49952f6c4abc9e5f4c3b67f6c459b 100644 --- a/dune/common/test/arithmetictestsuite.hh +++ b/dune/common/test/arithmetictestsuite.hh @@ -13,6 +13,16 @@ namespace Dune { +/* + * silence warnings from GCC about using integer operands on a bool + * (when instantiated for T=bool) + */ +#if __GNUC__ >= 7 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wbool-operation" +# pragma GCC diagnostic ignored "-Wint-in-bool-context" +#endif + //! Test suite for arithmetic types /** * You usually want to call the member function `checkArithmetic()`. The @@ -780,6 +790,10 @@ namespace Dune { } }; +#if __GNUC__ >= 7 +# pragma GCC diagnostic pop +#endif + } // namespace Dune #endif // DUNE_COMMON_TEST_ARITHMETICTESTSUITE_HH diff --git a/dune/common/test/densematrixassignmenttest.cc b/dune/common/test/densematrixassignmenttest.cc index 9fc34eeb16ba0f11e254c97ce43deff5fcad1901..4ea3a6c2e2642d6f436a4afb40cd0223f38ab1c3 100644 --- a/dune/common/test/densematrixassignmenttest.cc +++ b/dune/common/test/densematrixassignmenttest.cc @@ -244,7 +244,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } @@ -255,7 +255,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } @@ -266,7 +266,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } @@ -281,7 +281,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } @@ -295,7 +295,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } @@ -309,7 +309,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } @@ -342,7 +342,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } @@ -352,7 +352,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } @@ -362,7 +362,7 @@ bool run() { std::cout << "(line " << __LINE__ << ") Error: No exception thrown." << std::endl; passed = false; - } catch (Dune::RangeError) { + } catch (const Dune::RangeError&) { std::cout << "(line " << __LINE__ << ") All good: Exception thrown as expected." << std::endl; } diff --git a/dune/common/test/parameterizedobjectfactorysingleton.cc b/dune/common/test/parameterizedobjectfactorysingleton.cc index df2108fdf43847f3533e2a06b5cf909de7b00253..13826060d1b70ff2bea014caa07573594a0e4441 100644 --- a/dune/common/test/parameterizedobjectfactorysingleton.cc +++ b/dune/common/test/parameterizedobjectfactorysingleton.cc @@ -18,4 +18,4 @@ int init_Factory() return 0; } -static const int DUNE_UNUSED(init) = init_Factory(); +static const int DUNE_UNUSED init = init_Factory();