]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Assert: use DEAL_II_BUILTIN_EXPECT() to remove some definitions.
authorDavid Wells <drwells@email.unc.edu>
Thu, 29 May 2025 14:33:21 +0000 (10:33 -0400)
committerDavid Wells <drwells@email.unc.edu>
Thu, 29 May 2025 15:14:57 +0000 (11:14 -0400)
include/deal.II/base/exception_macros.h

index 530bbcb107308259f51f8e2ff58f8586df9327ec..1237828e6c1a9d5a867284dce9f4bde2ef7635d9 100644 (file)
  */
 #ifdef DEBUG
 #  if DEAL_II_KOKKOS_VERSION_GTE(3, 6, 0)
-#    ifdef DEAL_II_HAVE_BUILTIN_EXPECT
-#      define Assert(cond, exc)                                                \
-        do                                                                     \
-          {                                                                    \
-            KOKKOS_IF_ON_HOST(({                                               \
-              if (__builtin_expect(!(cond), false))                            \
-                ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-                  ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
-                    abort_or_throw_on_exception,                               \
-                  __FILE__,                                                    \
-                  __LINE__,                                                    \
-                  __PRETTY_FUNCTION__,                                         \
-                  #cond,                                                       \
-                  #exc,                                                        \
-                  exc);                                                        \
-            }))                                                                \
-            KOKKOS_IF_ON_DEVICE(({                                             \
-              if (!(cond))                                                     \
-                Kokkos::abort(#cond);                                          \
-            }))                                                                \
-          }                                                                    \
-        while (false)
-#    else /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
-#      define Assert(cond, exc)                                                \
-        do                                                                     \
-          {                                                                    \
-            KOKKOS_IF_ON_HOST(({                                               \
-              if (!(cond))                                                     \
-                ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-                  ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
-                    abort_or_throw_on_exception,                               \
-                  __FILE__,                                                    \
-                  __LINE__,                                                    \
-                  __PRETTY_FUNCTION__,                                         \
-                  #cond,                                                       \
-                  #exc,                                                        \
-                  exc);                                                        \
-            }))                                                                \
-            KOKKOS_IF_ON_DEVICE(({                                             \
-              if (!(cond))                                                     \
-                Kokkos::abort(#cond);                                          \
-            }))                                                                \
-          }                                                                    \
-        while (false)
-#    endif /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
-#  else    /*if DEAL_II_KOKKOS_VERSION_GTE(3,6,0)*/
+#    define Assert(cond, exc)                                                \
+      do                                                                     \
+        {                                                                    \
+          KOKKOS_IF_ON_HOST(({                                               \
+            if (DEAL_II_BUILTIN_EXPECT(!(cond), false))                      \
+              ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
+                ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
+                  abort_or_throw_on_exception,                               \
+                __FILE__,                                                    \
+                __LINE__,                                                    \
+                __PRETTY_FUNCTION__,                                         \
+                #cond,                                                       \
+                #exc,                                                        \
+                exc);                                                        \
+          }))                                                                \
+          KOKKOS_IF_ON_DEVICE(({                                             \
+            if (!(cond))                                                     \
+              Kokkos::abort(#cond);                                          \
+          }))                                                                \
+        }                                                                    \
+      while (false)
+#  else /*if DEAL_II_KOKKOS_VERSION_GTE(3,6,0)*/
 #    ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
-#      ifdef DEAL_II_HAVE_BUILTIN_EXPECT
-#        define Assert(cond, exc)                                              \
-          do                                                                   \
-            {                                                                  \
-              if (__builtin_expect(!(cond), false))                            \
-                ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-                  ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
-                    abort_or_throw_on_exception,                               \
-                  __FILE__,                                                    \
-                  __LINE__,                                                    \
-                  __PRETTY_FUNCTION__,                                         \
-                  #cond,                                                       \
-                  #exc,                                                        \
-                  exc);                                                        \
-            }                                                                  \
-          while (false)
-#      else /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
-#        define Assert(cond, exc)                                              \
-          do                                                                   \
-            {                                                                  \
-              if (!(cond))                                                     \
-                ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-                  ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
-                    abort_or_throw_on_exception,                               \
-                  __FILE__,                                                    \
-                  __LINE__,                                                    \
-                  __PRETTY_FUNCTION__,                                         \
-                  #cond,                                                       \
-                  #exc,                                                        \
-                  exc);                                                        \
-            }                                                                  \
-          while (false)
-#      endif /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
-#    else    /*#ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST*/
+#      define Assert(cond, exc)                                              \
+        do                                                                   \
+          {                                                                  \
+            if (DEAL_II_BUILTIN_EXPECT(!(cond), false))                      \
+              ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
+                ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
+                  abort_or_throw_on_exception,                               \
+                __FILE__,                                                    \
+                __LINE__,                                                    \
+                __PRETTY_FUNCTION__,                                         \
+                #cond,                                                       \
+                #exc,                                                        \
+                exc);                                                        \
+          }                                                                  \
+        while (false)
+#    else /*#ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST*/
 #      define Assert(cond, exc)     \
         do                          \
           {                         \

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.