From 607268dd8e398d3cd04e8622dd087bf963e56183 Mon Sep 17 00:00:00 2001 From: Juha Date: Mon, 28 Jan 2019 09:48:53 +0200 Subject: [PATCH] Replaced throw() with BOOST_NOEXCEPT_OR_NOTHROW With throw(), Visual Studio 2017 emitted a warning "C26439 SPECIAL_NOEXCEPT". Reproducible at least if code analysis was set to level: "Microsoft Native Recommended Rules". https://docs.microsoft.com/en-us/visualstudio/code-quality/c26439?view=vs-2017 --- example/example_io.cpp | 4 ++-- include/boost/exception/detail/error_info_impl.hpp | 4 ++-- include/boost/exception/detail/exception_ptr.hpp | 8 ++++---- include/boost/exception/diagnostic_information.hpp | 2 +- include/boost/exception/info.hpp | 2 +- src/clone_current_exception_non_intrusive.cpp | 2 +- test/cloning_test.cpp | 2 +- test/copy_exception_test.cpp | 2 +- test/diagnostic_information_test.cpp | 6 +++--- test/exception_ptr_test.cpp | 2 +- test/helper2.cpp | 6 +++--- test/helper2.hpp | 6 +++--- test/no_exceptions_test.cpp | 2 +- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/example/example_io.cpp b/example/example_io.cpp index 09b6138..f489332 100644 --- a/example/example_io.cpp +++ b/example/example_io.cpp @@ -35,14 +35,14 @@ error: //Base for all exception objects we throw. public: char const * - what() const throw() + what() const BOOST_NOEXCEPT_OR_NOTHROW { return "example_io error"; } protected: - ~error() throw() + ~error() BOOST_NOEXCEPT_OR_NOTHROW { } }; diff --git a/include/boost/exception/detail/error_info_impl.hpp b/include/boost/exception/detail/error_info_impl.hpp index 6c48d61..cf28fd1 100644 --- a/include/boost/exception/detail/error_info_impl.hpp +++ b/include/boost/exception/detail/error_info_impl.hpp @@ -35,7 +35,7 @@ boost virtual error_info_base * clone() const = 0; virtual - ~error_info_base() throw() + ~error_info_base() BOOST_NOEXCEPT_OR_NOTHROW { } }; @@ -73,7 +73,7 @@ boost } #endif #endif - ~error_info() throw() + ~error_info() BOOST_NOEXCEPT_OR_NOTHROW { } value_type const & diff --git a/include/boost/exception/detail/exception_ptr.hpp b/include/boost/exception/detail/exception_ptr.hpp index 8e19f0d..a7f0a25 100644 --- a/include/boost/exception/detail/exception_ptr.hpp +++ b/include/boost/exception/detail/exception_ptr.hpp @@ -105,7 +105,7 @@ boost boost::exception, std::bad_alloc { - ~bad_alloc_() throw() { } + ~bad_alloc_() BOOST_NOEXCEPT_OR_NOTHROW { } }; struct @@ -113,7 +113,7 @@ boost boost::exception, std::bad_exception { - ~bad_exception_() throw() { } + ~bad_exception_() BOOST_NOEXCEPT_OR_NOTHROW { } }; template @@ -174,7 +174,7 @@ boost add_original_type(e); } - ~unknown_exception() throw() + ~unknown_exception() BOOST_NOEXCEPT_OR_NOTHROW { } @@ -220,7 +220,7 @@ boost add_original_type(e1); } - ~current_exception_std_exception_wrapper() throw() + ~current_exception_std_exception_wrapper() BOOST_NOEXCEPT_OR_NOTHROW { } diff --git a/include/boost/exception/diagnostic_information.hpp b/include/boost/exception/diagnostic_information.hpp index 48f06a0..60d74b8 100644 --- a/include/boost/exception/diagnostic_information.hpp +++ b/include/boost/exception/diagnostic_information.hpp @@ -175,7 +175,7 @@ boost inline char const * - diagnostic_information_what( exception const & e, bool verbose=true ) throw() + diagnostic_information_what( exception const & e, bool verbose=true ) BOOST_NOEXCEPT_OR_NOTHROW { char const * w=0; #ifndef BOOST_NO_EXCEPTIONS diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp index f7ac50e..5e3ad52 100644 --- a/include/boost/exception/info.hpp +++ b/include/boost/exception/info.hpp @@ -62,7 +62,7 @@ boost { } - ~error_info_container_impl() throw() + ~error_info_container_impl() BOOST_NOEXCEPT_OR_NOTHROW { } diff --git a/src/clone_current_exception_non_intrusive.cpp b/src/clone_current_exception_non_intrusive.cpp index 7ebd7b5..932bca8 100644 --- a/src/clone_current_exception_non_intrusive.cpp +++ b/src/clone_current_exception_non_intrusive.cpp @@ -230,7 +230,7 @@ namespace { } - ~cloned_exception() throw() + ~cloned_exception() BOOST_NOEXCEPT_OR_NOTHROW { } diff --git a/test/cloning_test.cpp b/test/cloning_test.cpp index c5a4ae9..138a38c 100644 --- a/test/cloning_test.cpp +++ b/test/cloning_test.cpp @@ -73,7 +73,7 @@ derives_std_boost_exception: { } - char const * what() const throw() + char const * what() const BOOST_NOEXCEPT_OR_NOTHROW { return wh_; } diff --git a/test/copy_exception_test.cpp b/test/copy_exception_test.cpp index a88e6d5..69acb65 100644 --- a/test/copy_exception_test.cpp +++ b/test/copy_exception_test.cpp @@ -29,7 +29,7 @@ err: } virtual - ~err() throw() + ~err() BOOST_NOEXCEPT_OR_NOTHROW { --exc_count; } diff --git a/test/diagnostic_information_test.cpp b/test/diagnostic_information_test.cpp index 05ec554..35eb5e8 100644 --- a/test/diagnostic_information_test.cpp +++ b/test/diagnostic_information_test.cpp @@ -28,7 +28,7 @@ error1: boost::exception { char const * - what() const throw() + what() const BOOST_NOEXCEPT_OR_NOTHROW { return "error1"; } @@ -45,7 +45,7 @@ error3: std::exception { char const * - what() const throw() + what() const BOOST_NOEXCEPT_OR_NOTHROW { return "error3"; } @@ -57,7 +57,7 @@ error4: boost::exception { char const * - what() const throw() + what() const BOOST_NOEXCEPT_OR_NOTHROW { return diagnostic_information_what(*this); } diff --git a/test/exception_ptr_test.cpp b/test/exception_ptr_test.cpp index 367558c..ebcb1d5 100644 --- a/test/exception_ptr_test.cpp +++ b/test/exception_ptr_test.cpp @@ -87,7 +87,7 @@ exc: } virtual - ~exc() throw() + ~exc() BOOST_NOEXCEPT_OR_NOTHROW { --exc_count; } diff --git a/test/helper2.cpp b/test/helper2.cpp index 982d084..88809a7 100644 --- a/test/helper2.cpp +++ b/test/helper2.cpp @@ -20,7 +20,7 @@ boost } derives_boost_exception:: - ~derives_boost_exception() throw() + ~derives_boost_exception() BOOST_NOEXCEPT_OR_NOTHROW { } @@ -32,7 +32,7 @@ boost } derives_boost_exception_virtually:: - ~derives_boost_exception_virtually() throw() + ~derives_boost_exception_virtually() BOOST_NOEXCEPT_OR_NOTHROW { } @@ -44,7 +44,7 @@ boost } derives_std_exception:: - ~derives_std_exception() throw() + ~derives_std_exception() BOOST_NOEXCEPT_OR_NOTHROW { } diff --git a/test/helper2.hpp b/test/helper2.hpp index 0708476..885eee5 100644 --- a/test/helper2.hpp +++ b/test/helper2.hpp @@ -21,7 +21,7 @@ boost public std::exception { explicit derives_boost_exception( int x ); - virtual ~derives_boost_exception() throw(); + virtual ~derives_boost_exception() BOOST_NOEXCEPT_OR_NOTHROW; int x_; }; @@ -31,7 +31,7 @@ boost public std::exception { explicit derives_boost_exception_virtually( int x ); - virtual ~derives_boost_exception_virtually() throw(); + virtual ~derives_boost_exception_virtually() BOOST_NOEXCEPT_OR_NOTHROW; int x_; }; @@ -40,7 +40,7 @@ boost public std::exception { explicit derives_std_exception( int x ); - virtual ~derives_std_exception() throw(); + virtual ~derives_std_exception() BOOST_NOEXCEPT_OR_NOTHROW; int x_; }; diff --git a/test/no_exceptions_test.cpp b/test/no_exceptions_test.cpp index d335fb6..2e8665a 100644 --- a/test/no_exceptions_test.cpp +++ b/test/no_exceptions_test.cpp @@ -17,7 +17,7 @@ my_exception: std::exception { char const * - what() const throw() + what() const BOOST_NOEXCEPT_OR_NOTHROW { return "my_exception"; }