From: David Wells Date: Tue, 13 Aug 2024 20:43:55 +0000 (-0600) Subject: Don't use std::uncaught_exception(). X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78bd3f027213831654ea59864b7c40b810c55bb3;p=dealii.git Don't use std::uncaught_exception(). This is a C++17 feature which was shipped with GCC-6: we can get rid of the workaround now. --- diff --git a/source/base/hdf5.cc b/source/base/hdf5.cc index 5ef898b675..282ff7690a 100644 --- a/source/base/hdf5.cc +++ b/source/base/hdf5.cc @@ -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" diff --git a/source/base/init_finalize.cc b/source/base/init_finalize.cc index 7f59d35984..73398e3990 100644 --- a/source/base/init_finalize.cc +++ b/source/base/init_finalize.cc @@ -417,12 +417,7 @@ InitFinalize::finalize() if (static_cast(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. } diff --git a/source/base/mpi.cc b/source/base/mpi.cc index b68f6c8a0a..2523a777d3 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -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" diff --git a/source/base/subscriptor.cc b/source/base/subscriptor.cc index 736d36aedf..7941103184 100644 --- a/source/base/subscriptor.cc +++ b/source/base/subscriptor.cc @@ -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) diff --git a/source/base/timer.cc b/source/base/timer.cc index 41dd6378b6..d05cd92362 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -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);