From 96ee556b7a3656ee39480b49821b13609c2308db Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 24 Mar 2017 12:39:34 -0400 Subject: [PATCH] Remove DEAL_II_NOEXCEPT. Since we use C++11 we no longer have to use the old 'throw()' syntax. --- include/deal.II/base/config.h.in | 21 ++------------------- include/deal.II/base/exceptions.h | 16 ++++++++-------- include/deal.II/grid/tria.h | 2 +- include/deal.II/lac/solver_control.h | 2 +- source/base/exceptions.cc | 4 ++-- source/grid/tria.cc | 2 +- 6 files changed, 15 insertions(+), 32 deletions(-) diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 0012fe7b94..b063f0177a 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -55,8 +55,9 @@ #cmakedefine DEAL_II_WITH_UMFPACK #cmakedefine DEAL_II_WITH_ZLIB -// defined for backwards compatibility +// defined for backwards compatibility with pre-C++11 #define DEAL_II_WITH_CXX11 +#define DEAL_II_NOEXCEPT noexcept /*********************************************************************** * Compiler bugs: @@ -265,24 +266,6 @@ #define DEAL_II_NAMESPACE_OPEN namespace dealii { #define DEAL_II_NAMESPACE_CLOSE } - -/*********************************************************************** - * A macro that is used to mark function as not throwing any exceptions. - * The appropriate way to do this in C++98 was to say - * void foo () throw (); - * but in C++11, this is now - * void foo () noexcept; - * Furthermore, the first of these two methods is being deprecated, so - * we want to use the latter when possible. - */ - -#ifdef DEAL_II_WITH_CXX11 -# define DEAL_II_NOEXCEPT noexcept -#else -# define DEAL_II_NOEXCEPT throw() -#endif - - /*********************************************************************** * Two macros to guard external header includes. * diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index fcfd127ac9..bda1026865 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -55,7 +55,7 @@ public: /** * Destructor. */ - virtual ~ExceptionBase () DEAL_II_NOEXCEPT; + virtual ~ExceptionBase () noexcept; /** * Set the file name and line of where the exception appeared as well as the @@ -72,7 +72,7 @@ public: /** * Override the standard function that returns the description of the error. */ - virtual const char *what() const DEAL_II_NOEXCEPT; + virtual const char *what() const noexcept; /** * Get exception name. @@ -410,7 +410,7 @@ namespace deal_II_exceptions { \ public: \ Exception (const std::string &msg = defaulttext) : arg (msg) {} \ - virtual ~Exception () DEAL_II_NOEXCEPT {} \ + virtual ~Exception () noexcept {} \ virtual void print_info (std::ostream &out) const { \ out << " " << arg << std::endl; \ } \ @@ -428,7 +428,7 @@ namespace deal_II_exceptions class Exception1 : public dealii::ExceptionBase { \ public: \ Exception1 (const type1 a1) : arg1 (a1) {} \ - virtual ~Exception1 () DEAL_II_NOEXCEPT {} \ + virtual ~Exception1 () noexcept {} \ virtual void print_info (std::ostream &out) const { \ out << " " outsequence << std::endl; \ } \ @@ -448,7 +448,7 @@ namespace deal_II_exceptions public: \ Exception2 (const type1 a1, const type2 a2) : \ arg1 (a1), arg2(a2) {} \ - virtual ~Exception2 () DEAL_II_NOEXCEPT {} \ + virtual ~Exception2 () noexcept {} \ virtual void print_info (std::ostream &out) const { \ out << " " outsequence << std::endl; \ } \ @@ -469,7 +469,7 @@ namespace deal_II_exceptions public: \ Exception3 (const type1 a1, const type2 a2, const type3 a3) : \ arg1 (a1), arg2(a2), arg3(a3) {} \ - virtual ~Exception3 () DEAL_II_NOEXCEPT {} \ + virtual ~Exception3 () noexcept {} \ virtual void print_info (std::ostream &out) const { \ out << " " outsequence << std::endl; \ } \ @@ -492,7 +492,7 @@ namespace deal_II_exceptions Exception4 (const type1 a1, const type2 a2, \ const type3 a3, const type4 a4) : \ arg1 (a1), arg2(a2), arg3(a3), arg4(a4) {} \ - virtual ~Exception4 () DEAL_II_NOEXCEPT {} \ + virtual ~Exception4 () noexcept {} \ virtual void print_info (std::ostream &out) const { \ out << " " outsequence << std::endl; \ } \ @@ -516,7 +516,7 @@ namespace deal_II_exceptions Exception5 (const type1 a1, const type2 a2, const type3 a3, \ const type4 a4, const type5 a5) : \ arg1 (a1), arg2(a2), arg3(a3), arg4(a4), arg5(a5) {} \ - virtual ~Exception5 () DEAL_II_NOEXCEPT {} \ + virtual ~Exception5 () noexcept {} \ virtual void print_info (std::ostream &out) const { \ out << " " outsequence << std::endl; \ } \ diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 74ef9ca223..2d7c768b4c 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -1539,7 +1539,7 @@ public: * automatically generated destructor would have a different one due to * member objects. */ - virtual ~DistortedCellList () DEAL_II_NOEXCEPT; + virtual ~DistortedCellList () noexcept; /** * A list of those cells among the coarse mesh cells that are deformed or diff --git a/include/deal.II/lac/solver_control.h b/include/deal.II/lac/solver_control.h index 9ab07979f2..d3ca328c42 100644 --- a/include/deal.II/lac/solver_control.h +++ b/include/deal.II/lac/solver_control.h @@ -99,7 +99,7 @@ public: : last_step (last_step), last_residual(last_residual) {} - virtual ~NoConvergence () DEAL_II_NOEXCEPT {} + virtual ~NoConvergence () noexcept {} virtual void print_info (std::ostream &out) const { diff --git a/source/base/exceptions.cc b/source/base/exceptions.cc index a77a35f7f8..aa6acad5dc 100644 --- a/source/base/exceptions.cc +++ b/source/base/exceptions.cc @@ -105,7 +105,7 @@ ExceptionBase::ExceptionBase (const ExceptionBase &exc) -ExceptionBase::~ExceptionBase () DEAL_II_NOEXCEPT +ExceptionBase::~ExceptionBase () noexcept { free (stacktrace); // free(NULL) is allowed stacktrace = NULL; @@ -135,7 +135,7 @@ void ExceptionBase::set_fields (const char *f, #endif } -const char *ExceptionBase::what() const DEAL_II_NOEXCEPT +const char *ExceptionBase::what() const noexcept { // If no error c_string was generated so far, do it now: if (what_str == "") diff --git a/source/grid/tria.cc b/source/grid/tria.cc index be582a2cce..6942d659fd 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -13574,7 +13574,7 @@ Triangulation::memory_consumption () const template -Triangulation::DistortedCellList::~DistortedCellList () DEAL_II_NOEXCEPT +Triangulation::DistortedCellList::~DistortedCellList () noexcept { // don't do anything here. the compiler will automatically convert // any exceptions created by the destructors of the member variables -- 2.39.5