From eb8cf0f32196af881162575c9677195f91ef1bd1 Mon Sep 17 00:00:00 2001 From: Reza Rastak Date: Wed, 18 Sep 2019 20:43:35 -0700 Subject: [PATCH] usage of deprecated std::uncaught_exception --- source/base/mpi.cc | 7 ++++++- source/base/subscriptor.cc | 5 +++++ source/base/timer.cc | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 63c6a010e3..ee579acec4 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -780,7 +780,12 @@ namespace Utilities #ifdef DEAL_II_WITH_MPI if (job_supports_mpi() == true) { - if (std::uncaught_exception()) +# 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 << "ERROR: Uncaught exception in MPI_InitFinalize on proc " diff --git a/source/base/subscriptor.cc b/source/base/subscriptor.cc index 5e0fa58963..84be17494f 100644 --- a/source/base/subscriptor.cc +++ b/source/base/subscriptor.cc @@ -74,7 +74,12 @@ 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 864ffc6adf..c9035016ac 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -383,7 +383,12 @@ TimerOutput::~TimerOutput() // avoid communicating with other processes if there is an uncaught // exception #ifdef DEAL_II_WITH_MPI - if (std::uncaught_exception() && mpi_communicator != MPI_COMM_SELF) +# 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 { std::cerr << "---------------------------------------------------------" << std::endl -- 2.39.5