From: Wolfgang Bangerth Date: Thu, 7 Oct 2021 23:28:18 +0000 (-0600) Subject: Use an enum class in an internal namespace. X-Git-Tag: v9.4.0-rc1~957^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12800%2Fhead;p=dealii.git Use an enum class in an internal namespace. Promote better scoping of names. --- diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index 9dd446d257..c0ca35a6f0 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -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 std::abort unless @@ -1328,7 +1328,7 @@ namespace deal_II_exceptions * This routine does the main work for the exception generation mechanism * used in the Assert and AssertThrow 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 abort (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__, \ diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 0643eec0c2..9990ecbd03 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -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__,