From 19dd92d3e0a90b39bff60c8071240d151423c6e5 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Sun, 12 Nov 2017 08:22:40 +0100 Subject: [PATCH] Remove or replace obsolete uses of throw() In C++11, destructors are 'noexcept' by default -> remove useless throw() specifiers. There was one case that wasn't about a destructor: I replaced the 'throw()' with 'noexcept' because this use of 'throw()' is deprecated and 'noexcept' offers the intended meaning as far as I can guess (in C++17, 'throw()' will be equivalent to 'noexcept' anyway). For more info, see: http://en.cppreference.com/w/cpp/language/noexcept_spec https://akrzemi1.wordpress.com/2013/08/20/noexcept-destructors/ --- .../nasal/cppbind/detail/from_nasal_helper.cxx | 2 +- .../nasal/cppbind/detail/from_nasal_helper.hxx | 2 +- simgear/scene/material/EffectBuilder.cxx | 2 +- simgear/scene/material/EffectBuilder.hxx | 2 +- simgear/structure/exception.cxx | 16 ++++++++-------- simgear/structure/exception.hxx | 18 +++++++++--------- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/simgear/nasal/cppbind/detail/from_nasal_helper.cxx b/simgear/nasal/cppbind/detail/from_nasal_helper.cxx index f6a173ea..160d69be 100644 --- a/simgear/nasal/cppbind/detail/from_nasal_helper.cxx +++ b/simgear/nasal/cppbind/detail/from_nasal_helper.cxx @@ -39,7 +39,7 @@ namespace nasal } //---------------------------------------------------------------------------- - bad_nasal_cast::~bad_nasal_cast() throw() + bad_nasal_cast::~bad_nasal_cast() { } diff --git a/simgear/nasal/cppbind/detail/from_nasal_helper.hxx b/simgear/nasal/cppbind/detail/from_nasal_helper.hxx index 86d3c55e..ecfeb2ff 100644 --- a/simgear/nasal/cppbind/detail/from_nasal_helper.hxx +++ b/simgear/nasal/cppbind/detail/from_nasal_helper.hxx @@ -70,7 +70,7 @@ namespace nasal */ explicit bad_nasal_cast(const std::string& msg); - virtual ~bad_nasal_cast() throw(); + virtual ~bad_nasal_cast(); protected: std::string _msg; diff --git a/simgear/scene/material/EffectBuilder.cxx b/simgear/scene/material/EffectBuilder.cxx index 44665942..f6fea4d0 100644 --- a/simgear/scene/material/EffectBuilder.cxx +++ b/simgear/scene/material/EffectBuilder.cxx @@ -85,7 +85,7 @@ BuilderException::BuilderException(const std::string& message, { } -BuilderException::~BuilderException() throw() +BuilderException::~BuilderException() { } diff --git a/simgear/scene/material/EffectBuilder.hxx b/simgear/scene/material/EffectBuilder.hxx index b53272d9..84003109 100644 --- a/simgear/scene/material/EffectBuilder.hxx +++ b/simgear/scene/material/EffectBuilder.hxx @@ -184,7 +184,7 @@ public: BuilderException(); BuilderException(const char* message, const char* origin = 0); BuilderException(const std::string& message, const std::string& = ""); - virtual ~BuilderException() throw(); + virtual ~BuilderException(); }; } diff --git a/simgear/structure/exception.cxx b/simgear/structure/exception.cxx index adfc3f87..3a6d8f32 100644 --- a/simgear/structure/exception.cxx +++ b/simgear/structure/exception.cxx @@ -49,7 +49,7 @@ sg_location::sg_location (const char* path, int line, int column) setPath(path); } -sg_location::~sg_location () throw () +sg_location::~sg_location () { } @@ -144,7 +144,7 @@ sg_throwable::sg_throwable (const char* message, const char* origin) setOrigin(origin); } -sg_throwable::~sg_throwable () throw () +sg_throwable::~sg_throwable () { } @@ -185,7 +185,7 @@ sg_throwable::setOrigin (const char* origin) } } -const char* sg_throwable::what() const throw() +const char* sg_throwable::what() const noexcept { try { return getMessage(); @@ -215,7 +215,7 @@ sg_error::sg_error(const std::string& message, const std::string& origin) { } -sg_error::~sg_error () throw () +sg_error::~sg_error () { } @@ -239,7 +239,7 @@ sg_exception::sg_exception( const std::string& message, { } -sg_exception::~sg_exception () throw () +sg_exception::~sg_exception () { } @@ -279,7 +279,7 @@ sg_io_exception::sg_io_exception( const std::string& message, { } -sg_io_exception::~sg_io_exception () throw () +sg_io_exception::~sg_io_exception () { } @@ -335,7 +335,7 @@ sg_format_exception::sg_format_exception( const std::string& message, setText(text.c_str()); } -sg_format_exception::~sg_format_exception () throw () +sg_format_exception::~sg_format_exception () { } @@ -379,7 +379,7 @@ sg_range_exception::sg_range_exception(const std::string& message, { } -sg_range_exception::~sg_range_exception () throw () +sg_range_exception::~sg_range_exception () { } // end of exception.cxx diff --git a/simgear/structure/exception.hxx b/simgear/structure/exception.hxx index a781894a..e9f6d65c 100644 --- a/simgear/structure/exception.hxx +++ b/simgear/structure/exception.hxx @@ -31,7 +31,7 @@ public: sg_location(const std::string& path, int line = -1, int column = -1); sg_location(const SGPath& path, int line = -1, int column = -1); explicit sg_location(const char* path, int line = -1, int column = -1); - virtual ~sg_location() throw (); + virtual ~sg_location(); virtual const char* getPath() const; virtual void setPath (const char* path); virtual int getLine () const; @@ -58,13 +58,13 @@ public: enum {MAX_TEXT_LEN = 1024}; sg_throwable (); sg_throwable (const char* message, const char* origin = 0); - virtual ~sg_throwable () throw (); + virtual ~sg_throwable (); virtual const char* getMessage () const; virtual const std::string getFormattedMessage () const; virtual void setMessage (const char* message); virtual const char* getOrigin () const; virtual void setOrigin (const char *origin); - virtual const char* what() const throw(); + virtual const char* what() const noexcept; private: char _message[MAX_TEXT_LEN]; char _origin[MAX_TEXT_LEN]; @@ -87,7 +87,7 @@ public: sg_error (); sg_error (const char* message, const char* origin = 0); sg_error (const std::string& message, const std::string& origin = ""); - virtual ~sg_error () throw (); + virtual ~sg_error (); }; @@ -111,7 +111,7 @@ public: sg_exception (); sg_exception (const char* message, const char* origin = 0); sg_exception (const std::string& message, const std::string& = ""); - virtual ~sg_exception () throw (); + virtual ~sg_exception (); }; @@ -136,8 +136,8 @@ public: sg_io_exception (const std::string &message, const std::string &origin = ""); sg_io_exception (const std::string &message, const sg_location &location, const std::string &origin = ""); - - virtual ~sg_io_exception () throw (); + + virtual ~sg_io_exception (); virtual const std::string getFormattedMessage () const; virtual const sg_location &getLocation () const; virtual void setLocation (const sg_location &location); @@ -165,7 +165,7 @@ public: const char* origin = 0); sg_format_exception (const std::string& message, const std::string& text, const std::string& origin = ""); - virtual ~sg_format_exception () throw (); + virtual ~sg_format_exception (); virtual const char* getText () const; virtual void setText (const char* text); private: @@ -190,7 +190,7 @@ public: const char* origin = 0); sg_range_exception (const std::string& message, const std::string& origin = ""); - virtual ~sg_range_exception () throw (); + virtual ~sg_range_exception (); }; #endif