From 4c22e631a73e1265bc4a5d319e727abf779587d0 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 9 Jan 2017 11:47:52 +0100 Subject: [PATCH] remove remaining usage of deprecated dymamic exceptions: dtors are implicitely `noexcept` + qualify `what` methods with `noexcept` --- include/mapnik/config_error.hpp | 6 ++---- include/mapnik/datasource.hpp | 9 +++------ include/mapnik/enumeration.hpp | 4 ++-- include/mapnik/gradient.hpp | 2 +- include/mapnik/image_reader.hpp | 4 ++-- include/mapnik/image_util.hpp | 4 ++-- include/mapnik/svg/svg_parser_exception.hpp | 4 ++-- include/mapnik/value_error.hpp | 4 ++-- include/mapnik/xml_node.hpp | 12 ++++++------ plugins/input/raster/raster_info.cpp | 2 +- src/config_error.cpp | 2 +- src/gradient.cpp | 2 +- src/xml_tree.cpp | 12 ++++++------ 13 files changed, 31 insertions(+), 36 deletions(-) diff --git a/include/mapnik/config_error.hpp b/include/mapnik/config_error.hpp index b8bd31f67..38cb70c74 100644 --- a/include/mapnik/config_error.hpp +++ b/include/mapnik/config_error.hpp @@ -41,10 +41,8 @@ public: config_error(std::string const& what, unsigned line_number, std::string const& filename); - virtual ~config_error() throw() {} - - virtual const char * what() const throw(); - + virtual ~config_error() {} + virtual const char * what() const noexcept; void append_context(std::string const& ctx) const; void append_context(std::string const& ctx, xml_node const& node) const; void append_context(xml_node const& node) const; diff --git a/include/mapnik/datasource.hpp b/include/mapnik/datasource.hpp index ec14a621c..610e52df6 100644 --- a/include/mapnik/datasource.hpp +++ b/include/mapnik/datasource.hpp @@ -46,14 +46,11 @@ class MAPNIK_DECL datasource_exception : public std::exception public: datasource_exception(std::string const& message) : message_(message) - { - } + {} - ~datasource_exception() throw() - { - } + ~datasource_exception() {} - virtual const char* what() const throw() + virtual const char* what() const noexcept { return message_.c_str(); } diff --git a/include/mapnik/enumeration.hpp b/include/mapnik/enumeration.hpp index ded9dc058..1dd312e4c 100644 --- a/include/mapnik/enumeration.hpp +++ b/include/mapnik/enumeration.hpp @@ -44,9 +44,9 @@ public: what_( _what ) { } - virtual ~illegal_enum_value() throw() {} + virtual ~illegal_enum_value() {} - virtual const char * what() const throw() + virtual const char * what() const noexcept { return what_.c_str(); } diff --git a/include/mapnik/gradient.hpp b/include/mapnik/gradient.hpp index ae9acb5a3..5d00249d0 100644 --- a/include/mapnik/gradient.hpp +++ b/include/mapnik/gradient.hpp @@ -96,7 +96,7 @@ public: void get_control_points(double &x1, double &y1, double &x2, double &y2) const; private: - void swap(gradient& other) throw(); + void swap(gradient& other) noexcept; }; } diff --git a/include/mapnik/image_reader.hpp b/include/mapnik/image_reader.hpp index 6c1c2329c..2258da14f 100644 --- a/include/mapnik/image_reader.hpp +++ b/include/mapnik/image_reader.hpp @@ -50,9 +50,9 @@ public: image_reader_exception(std::string const& message) : message_(message) {} - ~image_reader_exception() throw() {} + ~image_reader_exception() {} - virtual const char* what() const throw() + virtual const char* what() const noexcept { return message_.c_str(); } diff --git a/include/mapnik/image_util.hpp b/include/mapnik/image_util.hpp index 0db5a3752..baeb468ce 100644 --- a/include/mapnik/image_util.hpp +++ b/include/mapnik/image_util.hpp @@ -56,9 +56,9 @@ public: image_writer_exception(std::string const& message) : message_(message) {} - ~image_writer_exception() throw() {} + ~image_writer_exception(){} - virtual const char* what() const throw() + virtual const char* what() const noexcept { return message_.c_str(); } diff --git a/include/mapnik/svg/svg_parser_exception.hpp b/include/mapnik/svg/svg_parser_exception.hpp index 89139da88..739c6188d 100644 --- a/include/mapnik/svg/svg_parser_exception.hpp +++ b/include/mapnik/svg/svg_parser_exception.hpp @@ -38,9 +38,9 @@ public: svg_parser_exception(std::string const& message) : message_(message) {} - ~svg_parser_exception() throw() {} + ~svg_parser_exception() {} - virtual const char* what() const throw() + virtual const char* what() const noexcept { return message_.c_str(); } diff --git a/include/mapnik/value_error.hpp b/include/mapnik/value_error.hpp index 68df62255..01cce90c8 100644 --- a/include/mapnik/value_error.hpp +++ b/include/mapnik/value_error.hpp @@ -41,9 +41,9 @@ public: { } - virtual ~value_error() throw() {} + virtual ~value_error() {} - virtual const char * what() const throw() + virtual const char * what() const noexcept { return what_.c_str(); } diff --git a/include/mapnik/xml_node.hpp b/include/mapnik/xml_node.hpp index bf7130c20..4dd08c679 100644 --- a/include/mapnik/xml_node.hpp +++ b/include/mapnik/xml_node.hpp @@ -53,8 +53,8 @@ class MAPNIK_DECL node_not_found: public std::exception { public: node_not_found(std::string const& node_name); - virtual const char* what() const throw(); - ~node_not_found() throw (); + virtual const char* what() const noexcept; + ~node_not_found(); private: std::string node_name_; protected: @@ -65,8 +65,8 @@ class MAPNIK_DECL attribute_not_found: public std::exception { public: attribute_not_found(std::string const& node_name, std::string const& attribute_name); - virtual const char* what() const throw(); - ~attribute_not_found() throw (); + virtual const char* what() const noexcept; + ~attribute_not_found(); private: std::string node_name_; std::string attribute_name_; @@ -78,8 +78,8 @@ class MAPNIK_DECL more_than_one_child: public std::exception { public: more_than_one_child(std::string const& node_name); - virtual const char* what() const throw(); - ~more_than_one_child() throw (); + virtual const char* what() const noexcept; + ~more_than_one_child(); private: std::string node_name_; protected: diff --git a/plugins/input/raster/raster_info.cpp b/plugins/input/raster/raster_info.cpp index 54b17c412..676cd5a65 100644 --- a/plugins/input/raster/raster_info.cpp +++ b/plugins/input/raster/raster_info.cpp @@ -44,7 +44,7 @@ raster_info::raster_info(const raster_info& rhs) { } -void raster_info::swap(raster_info& other) //throw() +void raster_info::swap(raster_info& other) { std::swap(file_,other.file_); std::swap(format_,other.format_); diff --git a/src/config_error.cpp b/src/config_error.cpp index 8de797072..b5b069ffa 100644 --- a/src/config_error.cpp +++ b/src/config_error.cpp @@ -37,7 +37,7 @@ config_error::config_error(std::string const& what, { } -char const* config_error::what() const throw() +char const* config_error::what() const noexcept { msg_ = what_; if (!node_name_.empty()) diff --git a/src/gradient.cpp b/src/gradient.cpp index 0c9c6b8fa..6a760ba3a 100644 --- a/src/gradient.cpp +++ b/src/gradient.cpp @@ -121,7 +121,7 @@ stop_array const& gradient::get_stop_array() const return stops_; } -void gradient::swap(gradient& other) throw() +void gradient::swap(gradient& other) noexcept { std::swap(gradient_type_, other.gradient_type_); std::swap(stops_, other.stops_); diff --git a/src/xml_tree.cpp b/src/xml_tree.cpp index 2e2a7df8e..7a41007fc 100644 --- a/src/xml_tree.cpp +++ b/src/xml_tree.cpp @@ -133,13 +133,13 @@ node_not_found::node_not_found(std::string const& node_name) : node_name_(node_name), msg_() {} -const char* node_not_found::what() const throw() +const char* node_not_found::what() const noexcept { msg_ = std::string("Node "+node_name_+ "not found"); return msg_.c_str(); } -node_not_found::~node_not_found() throw() {} +node_not_found::~node_not_found() {} attribute_not_found::attribute_not_found(std::string const& node_name, @@ -148,25 +148,25 @@ attribute_not_found::attribute_not_found(std::string const& node_name, attribute_name_(attribute_name), msg_() {} -const char* attribute_not_found::what() const throw() +const char* attribute_not_found::what() const noexcept { msg_ = std::string("Attribute '" + attribute_name_ +"' not found in node '"+node_name_+ "'"); return msg_.c_str(); } -attribute_not_found::~attribute_not_found() throw() {} +attribute_not_found::~attribute_not_found() {} more_than_one_child::more_than_one_child(std::string const& node_name) : node_name_(node_name), msg_() {} -const char* more_than_one_child::what() const throw() +const char* more_than_one_child::what() const noexcept { msg_ = std::string("More than one child node in node '" + node_name_ +"'"); return msg_.c_str(); } -more_than_one_child::~more_than_one_child() throw() {} +more_than_one_child::~more_than_one_child() {} xml_node::xml_node(xml_tree &tree, std::string && name, unsigned line, bool is_text) : tree_(tree),