From b4473b233f1f203c7408626ac76b37b6a5b5c6c5 Mon Sep 17 00:00:00 2001
From: Pasquale Africa <pasqualeclaudio.africa@polimi.it>
Date: Wed, 20 Apr 2022 09:03:34 +0000
Subject: [PATCH] Add enable_abort_on_exception

---
 doc/news/changes/minor/20220420PasqualeAfrica |  3 +++
 include/deal.II/base/exceptions.h             | 12 ++++++++++++
 source/base/exceptions.cc                     |  8 ++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 doc/news/changes/minor/20220420PasqualeAfrica

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.
+<br>
+(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 <tt>std::abort()</tt> 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
 
 
-- 
2.39.5