From c2fa9c4dda4eba8c1c4b331093fab6eeb9f2843a Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 29 May 2025 10:34:55 -0400 Subject: [PATCH] Assert: combine the two release build definitions. The 'if (false)' trick should work (and avoid unused variable warnings) with all supported compilers and language standards. --- include/deal.II/base/exception_macros.h | 38 ++++++------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/include/deal.II/base/exception_macros.h b/include/deal.II/base/exception_macros.h index 1237828e6c..174c8d2ac2 100644 --- a/include/deal.II/base/exception_macros.h +++ b/include/deal.II/base/exception_macros.h @@ -566,35 +566,15 @@ # endif /*ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST*/ # endif /*KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST*/ #else /*ifdef DEBUG*/ -# ifdef DEAL_II_HAVE_CXX20 -/* - * In order to avoid unused parameters (etc.) warnings we need to use cond - * and exc without actually evaluating the expression and generating code. - * We accomplish this by using decltype(...) and create a dummy pointer - * with these signatures. Notably, this approach works with C++20 onwards. - */ -# define Assert(cond, exc) \ - do \ - { \ - std::remove_reference_t *dealii_assert_variable_a = \ - nullptr; \ - std::remove_reference_t *dealii_assert_variable_b = \ - nullptr; \ - (void)dealii_assert_variable_a; \ - (void)dealii_assert_variable_b; \ - } \ - while (false) -# else -# define Assert(cond, exc) \ - do \ - { \ - if (false) \ - if (!(cond)) \ - { \ - } \ - } \ - while (false) -# endif +# define Assert(cond, exc) \ + do \ + { \ + if (false) \ + if (!(cond)) \ + { \ + } \ + } \ + while (false) #endif /*ifdef DEBUG*/ -- 2.39.5