From 328b8f065bd705d7d6e0d99a69b951583a17f028 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Sun, 9 Apr 2023 00:09:38 +0000 Subject: [PATCH] Fix clang-tidy --- include/deal.II/base/utilities.h | 37 +++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 18f58566b4..85ec977c4d 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -449,16 +449,33 @@ namespace Utilities #if defined(DEBUG) && !defined(DEAL_II_CXX14_CONSTEXPR_BUG) // Up to __builtin_expect this is the same code as in the 'Assert' macro. // The call to __builtin_expect turns out to be problematic. - KOKKOS_IF_ON_HOST((if (!(iexp >= 0))::dealii::deal_II_exceptions:: - internals::issue_error_noreturn( - ::dealii::deal_II_exceptions::internals:: - ExceptionHandling::abort_or_throw_on_exception, - __FILE__, - __LINE__, - __PRETTY_FUNCTION__, - "iexp>=0", - "ExcMessage(\"The exponent must not be negative!\")", - ExcMessage("The exponent must not be negative!"));)) +# if KOKKOS_VERSION >= 30600 + KOKKOS_IF_ON_HOST(({ + if (!(iexp >= 0)) + ::dealii::deal_II_exceptions::internals::issue_error_noreturn( + ::dealii::deal_II_exceptions::internals::ExceptionHandling:: + abort_or_throw_on_exception, + __FILE__, + __LINE__, + __PRETTY_FUNCTION__, + "iexp>=0", + "ExcMessage(\"The exponent must not be negative!\")", + ExcMessage("The exponent must not be negative!")); + })) +# else +# ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST + if (!(iexp >= 0)) + ::dealii::deal_II_exceptions::internals::issue_error_noreturn( + ::dealii::deal_II_exceptions::internals::ExceptionHandling:: + abort_or_throw_on_exception, + __FILE__, + __LINE__, + __PRETTY_FUNCTION__, + "iexp>=0", + "ExcMessage(\"The exponent must not be negative!\")", + ExcMessage("The exponent must not be negative!")); +# endif +# endif #endif // The "exponentiation by squaring" algorithm used below has to be // compressed to one statement due to C++11's restrictions on constexpr -- 2.39.5