]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use an enum class in an internal namespace. 12800/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 7 Oct 2021 23:28:18 +0000 (17:28 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 7 Oct 2021 23:28:18 +0000 (17:28 -0600)
Promote better scoping of names.

include/deal.II/base/exceptions.h
include/deal.II/base/utilities.h

index 9dd446d2573f4b5f9b9010cbbc0f557a93c4d491..c0ca35a6f0b9fd9274bdf2dea0a2e74cf7864e20 100644 (file)
@@ -1310,7 +1310,7 @@ namespace deal_II_exceptions
     /**
      * An enum describing how to treat an exception in issue_error_noreturn.
      */
-    enum ExceptionHandling
+    enum class ExceptionHandling
     {
       /**
        * Abort the program by calling <code>std::abort</code> unless
@@ -1328,7 +1328,7 @@ namespace deal_II_exceptions
      * This routine does the main work for the exception generation mechanism
      * used in the <tt>Assert</tt> and <tt>AssertThrow</tt> macros: as the
      * name implies, this function either ends by throwing an exception (if
-     * @p handling is throw_on_exception, or @p handling is try_abort_exception
+     * @p handling is ExceptionHandling::throw_on_exception, or @p handling is try_abort_exception
      * and deal_II_exceptions::disable_abort_on_exception is false) or with a
      * call to <tt>abort</tt> (if @p handling is try_abort_exception and
      * deal_II_exceptions::disable_abort_on_exception is true).
@@ -1356,7 +1356,7 @@ namespace deal_II_exceptions
 
       switch (handling)
         {
-          case abort_or_throw_on_exception:
+          case ExceptionHandling::abort_or_throw_on_exception:
             {
               if (dealii::deal_II_exceptions::internals::
                     allow_abort_on_exception)
@@ -1367,7 +1367,7 @@ namespace deal_II_exceptions
                   throw e;
                 }
             }
-          case throw_on_exception:
+          case ExceptionHandling::throw_on_exception:
             throw e;
           // this function should never return (and AssertNothrow can);
           // something must have gone wrong in the error handling code for us
@@ -1462,7 +1462,7 @@ namespace deal_II_exceptions
       {                                                                  \
         if (__builtin_expect(!(cond), false))                            \
           ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-            ::dealii::deal_II_exceptions::internals::                    \
+            ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
               abort_or_throw_on_exception,                               \
             __FILE__,                                                    \
             __LINE__,                                                    \
@@ -1476,7 +1476,7 @@ namespace deal_II_exceptions
       {                                                                  \
         if (!(cond))                                                     \
           ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-            ::dealii::deal_II_exceptions::internals::                    \
+            ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
               abort_or_throw_on_exception,                               \
             __FILE__,                                                    \
             __LINE__,                                                    \
@@ -1572,7 +1572,8 @@ namespace deal_II_exceptions
     {                                                                  \
       if (__builtin_expect(!(cond), false))                            \
         ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-          ::dealii::deal_II_exceptions::internals::throw_on_exception, \
+          ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
+            throw_on_exception,                                        \
           __FILE__,                                                    \
           __LINE__,                                                    \
           __PRETTY_FUNCTION__,                                         \
@@ -1585,7 +1586,8 @@ namespace deal_II_exceptions
     {                                                                  \
       if (!(cond))                                                     \
         ::dealii::deal_II_exceptions::internals::issue_error_noreturn( \
-          ::dealii::deal_II_exceptions::internals::throw_on_exception, \
+          ::dealii::deal_II_exceptions::internals::ExceptionHandling:: \
+            throw_on_exception,                                        \
           __FILE__,                                                    \
           __LINE__,                                                    \
           __PRETTY_FUNCTION__,                                         \
index 0643eec0c26ff26fb1f6499b78a970433c3c75fc..9990ecbd036e70dd2a6cf2a908167c36677a2795 100644 (file)
@@ -465,7 +465,8 @@ namespace Utilities
     // The call to __builtin_expect turns out to be problematic.
     if (!(iexp >= 0))
       ::dealii::deal_II_exceptions::internals::issue_error_noreturn(
-        ::dealii::deal_II_exceptions::internals::abort_or_throw_on_exception,
+        ::dealii::deal_II_exceptions::internals::ExceptionHandling::
+          abort_or_throw_on_exception,
         __FILE__,
         __LINE__,
         __PRETTY_FUNCTION__,

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.