From: David Wells Date: Thu, 29 May 2025 14:34:55 +0000 (-0400) Subject: Assert: combine the two release build definitions. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2fa9c4dda4eba8c1c4b331093fab6eeb9f2843a;p=dealii.git 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. --- 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*/