From 3bfc22d12b893d94cbb4697a77b7cababcbbd921 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 7 Dec 2022 00:57:52 +0200 Subject: [PATCH] Modernize noexcept specifiers --- source/core/getopt.h | 3 +-- source/core/systemerror.h | 3 +-- source/core/variant.h | 1 - source/io/file.h | 2 -- source/io/mode.h | 1 - source/io/zlibcompressed.h | 3 +-- source/stringcodec/except.h | 3 --- source/strings/fmt.h | 1 - source/strings/lexicalcast.h | 2 -- source/strings/regex.h | 1 - 10 files changed, 3 insertions(+), 17 deletions(-) diff --git a/source/core/getopt.h b/source/core/getopt.h index 575184f..cdf5ee3 100644 --- a/source/core/getopt.h +++ b/source/core/getopt.h @@ -17,9 +17,8 @@ private: public: usage_error(const std::string &w, const std::string &h = std::string()): std::runtime_error(w), m_help(h) { } - ~usage_error() throw() override = default; - const char *help() const throw() { return m_help.c_str(); } + const char *help() const noexcept { return m_help.c_str(); } }; diff --git a/source/core/systemerror.h b/source/core/systemerror.h index c2387fa..5edbe9d 100644 --- a/source/core/systemerror.h +++ b/source/core/systemerror.h @@ -14,9 +14,8 @@ private: public: system_error(const std::string &, int = -1); system_error(const std::string &, const std::string &); - ~system_error() throw() override = default; - int code() const throw() { return m_code; } + int code() const noexcept { return m_code; } private: static std::string get_message(int); diff --git a/source/core/variant.h b/source/core/variant.h index af204f2..eaf5a34 100644 --- a/source/core/variant.h +++ b/source/core/variant.h @@ -12,7 +12,6 @@ class type_mismatch: public std::runtime_error { public: type_mismatch(const std::type_info &, const std::type_info &); - ~type_mismatch() throw() override = default; }; diff --git a/source/io/file.h b/source/io/file.h index f23cc93..1068131 100644 --- a/source/io/file.h +++ b/source/io/file.h @@ -14,14 +14,12 @@ class file_not_found: public std::runtime_error { public: file_not_found(const std::string &fn): std::runtime_error(fn) { } - ~file_not_found() throw() override = default; }; class file_already_exists: public std::runtime_error { public: file_already_exists(const std::string &fn): std::runtime_error(fn) { } - ~file_already_exists() throw() override = default; }; diff --git a/source/io/mode.h b/source/io/mode.h index 565eb0f..65b4089 100644 --- a/source/io/mode.h +++ b/source/io/mode.h @@ -34,7 +34,6 @@ class invalid_access: public std::logic_error { public: invalid_access(Mode); - ~invalid_access() throw() override = default; }; } // namespace IO diff --git a/source/io/zlibcompressed.h b/source/io/zlibcompressed.h index eb35f6c..67cd673 100644 --- a/source/io/zlibcompressed.h +++ b/source/io/zlibcompressed.h @@ -16,9 +16,8 @@ private: public: zlib_error(const std::string &, int); - ~zlib_error() throw() override = default; - int code() const throw() { return m_code; } + int code() const noexcept { return m_code; } }; /** diff --git a/source/stringcodec/except.h b/source/stringcodec/except.h index 0c7b690..19cb413 100644 --- a/source/stringcodec/except.h +++ b/source/stringcodec/except.h @@ -14,7 +14,6 @@ class codec_error: public std::runtime_error { public: codec_error(const std::string &w): std::runtime_error(w) { } - ~codec_error() throw() override = default; }; @@ -25,7 +24,6 @@ class invalid_character: public codec_error { public: invalid_character(unichar, const std::string &); - ~invalid_character() throw() override = default; }; @@ -36,7 +34,6 @@ class invalid_sequence: public codec_error { public: invalid_sequence(const std::string::const_iterator &, const std::string::const_iterator &, const std::string &); - ~invalid_sequence() throw() override = default; private: std::string format_sequence(const std::string::const_iterator &, const std::string::const_iterator &); diff --git a/source/strings/fmt.h b/source/strings/fmt.h index 45ae917..d6db418 100644 --- a/source/strings/fmt.h +++ b/source/strings/fmt.h @@ -11,7 +11,6 @@ class format_error: public std::logic_error { public: format_error(const std::string &w): std::logic_error(w) { } - ~format_error() throw() override = default; }; diff --git a/source/strings/lexicalcast.h b/source/strings/lexicalcast.h index 393622d..9aecd32 100644 --- a/source/strings/lexicalcast.h +++ b/source/strings/lexicalcast.h @@ -16,7 +16,6 @@ class lexical_error: public std::runtime_error { public: lexical_error(const std::string &w): runtime_error(w) { } - ~lexical_error() throw() override = default; }; @@ -27,7 +26,6 @@ class format_mismatch: public lexical_error { public: format_mismatch(const std::string &w): lexical_error(w) { } - ~format_mismatch() throw() override = default; }; diff --git a/source/strings/regex.h b/source/strings/regex.h index bef5231..acc842b 100644 --- a/source/strings/regex.h +++ b/source/strings/regex.h @@ -11,7 +11,6 @@ class bad_regex: public std::logic_error { public: bad_regex(const std::string &, const std::string &, const std::string::const_iterator &); - ~bad_regex() throw() override = default; private: std::string make_where(const std::string &, const std::string::const_iterator &); -- 2.45.2