From: Reza Rastak Date: Thu, 19 Sep 2019 03:43:35 +0000 (-0700) Subject: usage of deprecated std::uncaught_exception X-Git-Tag: v9.2.0-rc1~1080^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8796%2Fhead;p=dealii.git usage of deprecated std::uncaught_exception --- 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