From: Pasquale Africa Date: Wed, 20 Apr 2022 09:03:34 +0000 (+0000) Subject: Add enable_abort_on_exception X-Git-Tag: v9.4.0-rc1~296^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4473b233f1f203c7408626ac76b37b6a5b5c6c5;p=dealii.git Add enable_abort_on_exception --- diff --git a/doc/news/changes/minor/20220420PasqualeAfrica b/doc/news/changes/minor/20220420PasqualeAfrica new file mode 100644 index 0000000000..16cb5dbc84 --- /dev/null +++ b/doc/news/changes/minor/20220420PasqualeAfrica @@ -0,0 +1,3 @@ +Added: New function enable_abort_on_exception. +
+(Pasquale Claudio Africa, 2022/04/20) diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index 7e1256db1c..7ee3d1815d 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -1286,11 +1286,23 @@ namespace deal_II_exceptions * still call abort(), e.g. when an exception is caught during exception * handling. * + * @see enable_abort_on_exception * @see Exceptions */ void disable_abort_on_exception(); + /** + * Calling this function switches on the use of std::abort() when + * an exception is created using the Assert() macro, instead of throwing it. + * This restores the standard behavior. + * + * @see disable_abort_on_exception + * @see Exceptions + */ + void + enable_abort_on_exception(); + /** * The functions in this namespace are in connection with the Assert and * AssertThrow mechanism but are solely for internal purposes and are not diff --git a/source/base/exceptions.cc b/source/base/exceptions.cc index 838e268460..abe55a5ad9 100644 --- a/source/base/exceptions.cc +++ b/source/base/exceptions.cc @@ -82,6 +82,14 @@ namespace deal_II_exceptions { internals::allow_abort_on_exception = false; } + + + + void + enable_abort_on_exception() + { + internals::allow_abort_on_exception = true; + } } // namespace deal_II_exceptions