]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Don't use std::uncaught_exception().
authorDavid Wells <drwells@email.unc.edu>
Tue, 13 Aug 2024 20:43:55 +0000 (14:43 -0600)
committerDavid Wells <drwells@email.unc.edu>
Tue, 13 Aug 2024 21:01:33 +0000 (15:01 -0600)
This is a C++17 feature which was shipped with GCC-6: we can get rid of the
workaround now.

source/base/hdf5.cc
source/base/init_finalize.cc
source/base/mpi.cc
source/base/subscriptor.cc
source/base/timer.cc

index 5ef898b675304f2e7402081f0e22db5c9db20367..282ff7690a33cde1ecd832ac9e57d5ab8e5f2adc 100644 (file)
@@ -38,12 +38,7 @@ namespace HDF5
       check_exception(const std::string &type, const std::string &name)
       {
 #  ifdef DEAL_II_WITH_MPI
-#    if __cpp_lib_uncaught_exceptions >= 201411
-        // std::uncaught_exception() is deprecated in c++17
         if (std::uncaught_exceptions() != 0)
-#    else
-        if (std::uncaught_exception() == true)
-#    endif
           {
             std::cerr
               << "---------------------------------------------------------\n"
index 7f59d35984dbf35d313417810fd05a85532b08e4..73398e3990817147b48a01a39fa6b0843f38d183 100644 (file)
@@ -417,12 +417,7 @@ InitFinalize::finalize()
       if (static_cast<bool>(libraries & InitializeLibrary::MPI) &&
           (MPI_has_been_started))
         {
-#  if __cpp_lib_uncaught_exceptions >= 201411
-          // std::uncaught_exception() is deprecated in c++17
           if (std::uncaught_exceptions() > 0)
-#  else
-          if (std::uncaught_exception() == true)
-#  endif
             {
               // do not try to call MPI_Finalize to avoid a deadlock.
             }
index b68f6c8a0aa6eebb15f1fbc789b72b292fc8914b..2523a777d3445ebeadfd163cd58b8710fc0401ce 100644 (file)
@@ -746,12 +746,7 @@ namespace Utilities
         check_exception()
         {
 #ifdef DEAL_II_WITH_MPI
-#  if __cpp_lib_uncaught_exceptions >= 201411
-          // std::uncaught_exception() is deprecated in c++17
           if (std::uncaught_exceptions() != 0)
-#  else
-          if (std::uncaught_exception() == true)
-#  endif
             {
               std::cerr
                 << "---------------------------------------------------------\n"
index 736d36aedffecea2613c19dc59886d2451a8a1d4..7941103184445926a077ebbdc6914dd50b6df312 100644 (file)
@@ -73,12 +73,7 @@ Subscriptor::check_no_subscribers() const noexcept
   // just display a message and continue the program.
   if (counter != 0)
     {
-#  if __cpp_lib_uncaught_exceptions >= 201411
-      // std::uncaught_exception() is deprecated in c++17
       if (std::uncaught_exceptions() == 0)
-#  else
-      if (std::uncaught_exception() == false)
-#  endif
         {
           std::string infostring;
           for (const auto &map_entry : counter_map)
index 41dd6378b674a6dcf09e33ec70e9197eca12e90b..d05cd92362f42ee2eeea425999d7e5755ecfe08c 100644 (file)
@@ -366,12 +366,7 @@ TimerOutput::~TimerOutput()
   // avoid communicating with other processes if there is an uncaught
   // exception
 #ifdef DEAL_II_WITH_MPI
-#  if __cpp_lib_uncaught_exceptions >= 201411
-  // std::uncaught_exception() is deprecated in c++17
   if (std::uncaught_exceptions() > 0 && mpi_communicator != MPI_COMM_SELF)
-#  else
-  if (std::uncaught_exception() == true && mpi_communicator != MPI_COMM_SELF)
-#  endif
     {
       const unsigned int myid =
         Utilities::MPI::this_mpi_process(mpi_communicator);

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.