From 825aae0690cdba8bc3d8dfa63aafb27342079880 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 22 Jan 2001 07:53:28 +0000 Subject: [PATCH] Add destructor to Exception classes with empty throw list, since otherwise the throw list deviates from that of the base class which is not allowed as the destructor is virtual. git-svn-id: https://svn.dealii.org/branches/Branch-3-1@3737 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/exceptions.h | 18 ++++++++++++++++++ deal.II/base/source/exceptions.cc | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/deal.II/base/include/base/exceptions.h b/deal.II/base/include/base/exceptions.h index 9cc0e08739..1632040b9e 100644 --- a/deal.II/base/include/base/exceptions.h +++ b/deal.II/base/include/base/exceptions.h @@ -295,6 +295,19 @@ class ExceptionBase : public std::exception ExceptionBase (const char* f, const int l, const char *func, const char* c, const char *e); + /** + * Destructor. Empty, but needed + * for the sake of exception + * specification, since the base + * class has this exception + * specification and the + * automatically generated + * destructor would have a + * different one due to member + * objects. + */ + virtual ~ExceptionBase () throw(); + /** * Set the file name and line of where the * exception appeared as well as the violated @@ -505,6 +518,7 @@ class Exception0 : public ExceptionBase {} class Exception1 : public ExceptionBase { \ public: \ Exception1 (const type1 a1) : arg1 (a1) {}; \ + virtual ~Exception1 () throw () {}; \ virtual void PrintInfo (std::ostream &out) const { \ out outsequence << std::endl; \ }; \ @@ -525,6 +539,7 @@ class Exception2 : public ExceptionBase { \ public: \ Exception2 (const type1 a1, const type2 a2) : \ arg1 (a1), arg2(a2) {}; \ + virtual ~Exception2 () throw () {}; \ virtual void PrintInfo (std::ostream &out) const { \ out outsequence << std::endl; \ }; \ @@ -546,6 +561,7 @@ class Exception3 : public ExceptionBase { \ public: \ Exception3 (const type1 a1, const type2 a2, const type3 a3) : \ arg1 (a1), arg2(a2), arg3(a3) {}; \ + virtual ~Exception3 () throw () {}; \ virtual void PrintInfo (std::ostream &out) const { \ out outsequence << std::endl; \ }; \ @@ -569,6 +585,7 @@ class Exception4 : public ExceptionBase { \ Exception4 (const type1 a1, const type2 a2, \ const type3 a3, const type4 a4) : \ arg1 (a1), arg2(a2), arg3(a3), arg4(a4) {}; \ + virtual ~Exception4 () throw () {}; \ virtual void PrintInfo (std::ostream &out) const { \ out outsequence << std::endl; \ }; \ @@ -593,6 +610,7 @@ class Exception5 : public ExceptionBase { \ 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 () throw () {}; \ virtual void PrintInfo (std::ostream &out) const { \ out outsequence << std::endl; \ }; \ diff --git a/deal.II/base/source/exceptions.cc b/deal.II/base/source/exceptions.cc index 028c231244..ecc12b110c 100644 --- a/deal.II/base/source/exceptions.cc +++ b/deal.II/base/source/exceptions.cc @@ -22,12 +22,19 @@ ExceptionBase::ExceptionBase () : {}; + ExceptionBase::ExceptionBase (const char* f, const int l, const char *func, const char* c, const char *e) : file(f), line(l), function(func), cond(c), exc(e) {}; + +ExceptionBase::~ExceptionBase () throw () +{}; + + + void ExceptionBase::SetFields (const char* f, const int l, const char *func, -- 2.39.5