]> https://gitweb.dealii.org/ - dealii.git/commitdiff
AssertThrow: use DEAL_II_BUILTIN_EXPECT() to remove some definitions. 18514/head
authorDavid Wells <drwells@email.unc.edu>
Thu, 29 May 2025 14:57:36 +0000 (10:57 -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 06f11a80dbf226810a469539f8decd812b14e630..2e958bb583fc298ebfe30708c68dcc34b473eda6 100644 (file)
  * @note Active in both DEBUG and RELEASE modes
  * @ingroup Exceptions
  */
-#ifdef DEAL_II_HAVE_BUILTIN_EXPECT
-#  define AssertThrow(cond, exc)                                         \
-    do                                                                   \
-      {                                                                  \
-        if (__builtin_expect(!(cond), false))                            \
-          ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-            ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
-              throw_on_exception,                                        \
-            __FILE__,                                                    \
-            __LINE__,                                                    \
-            __PRETTY_FUNCTION__,                                         \
-            #cond,                                                       \
-            #exc,                                                        \
-            exc);                                                        \
-      }                                                                  \
-    while (false)
-#else /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
-#  define AssertThrow(cond, exc)                                         \
-    do                                                                   \
-      {                                                                  \
-        if (!(cond))                                                     \
-          ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-            ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
-              throw_on_exception,                                        \
-            __FILE__,                                                    \
-            __LINE__,                                                    \
-            __PRETTY_FUNCTION__,                                         \
-            #cond,                                                       \
-            #exc,                                                        \
-            exc);                                                        \
-      }                                                                  \
-    while (false)
-#endif /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
+#define AssertThrow(cond, exc)                                         \
+  do                                                                   \
+    {                                                                  \
+      if (DEAL_II_BUILTIN_EXPECT(!(cond), false))                      \
+        ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
+          ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
+            throw_on_exception,                                        \
+          __FILE__,                                                    \
+          __LINE__,                                                    \
+          __PRETTY_FUNCTION__,                                         \
+          #cond,                                                       \
+          #exc,                                                        \
+          exc);                                                        \
+    }                                                                  \
+  while (false)
 
 
 /**

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.