]> https://gitweb.dealii.org/ - dealii.git/commitdiff
usage of deprecated std::uncaught_exception 8796/head
authorReza Rastak <rastak@stanford.edu>
Thu, 19 Sep 2019 03:43:35 +0000 (20:43 -0700)
committerReza Rastak <rastak@stanford.edu>
Thu, 19 Sep 2019 05:12:03 +0000 (22:12 -0700)
source/base/mpi.cc
source/base/subscriptor.cc
source/base/timer.cc

index 63c6a010e3cfaa7abe89ba9509336b3d06bd5fc1..ee579acec4471088d2bd468873cb715453ab2df5 100644 (file)
@@ -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 "
index 5e0fa58963f9a3ccc76055e7ce953412cce163aa..84be17494f5a561990b9a071df201571d46cea7b 100644 (file)
@@ -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)
index 864ffc6adf8f595977ae48507ca0db9a38b43bb5..c9035016ac87166a048afc15814889f8c9da4eb7 100644 (file)
@@ -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

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.