diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index 8191e967..c32d5b55 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -81,5 +81,27 @@ #endif +//////////////////////////////////////////////////////////////////////////////// +// C++ language feature support + +// detect language version: +#if (__cplusplus == 201103L) +# define CATCH_CPP11 +# define CATCH_CPP11_OR_GREATER +#elif (__cplusplus >= 201103L) +# define CATCH_CPP11_OR_GREATER +#endif + +// noexcept support: +#ifdef CATCH_CPP11_OR_GREATER +# if (__has_feature(cxx_noexcept)) +# define CATCH_NOEXCEPT noexcept +# define CATCH_NOEXCEPT_IS(x) noexcept(x) +# endif +#else +# define CATCH_NOEXCEPT throw() +# define CATCH_NOEXCEPT_IS(x) +#endif + #endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp index 30ac219d..99e35113 100644 --- a/include/internal/catch_impl.hpp +++ b/include/internal/catch_impl.hpp @@ -39,7 +39,7 @@ namespace Catch { NonCopyable::~NonCopyable() {} IShared::~IShared() {} - StreamBufBase::~StreamBufBase() throw() {} + StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {} IContext::~IContext() {} IResultCapture::~IResultCapture() {} ITestCase::~ITestCase() {} diff --git a/include/internal/catch_notimplemented_exception.h b/include/internal/catch_notimplemented_exception.h index e543bdaf..84b1cf3f 100644 --- a/include/internal/catch_notimplemented_exception.h +++ b/include/internal/catch_notimplemented_exception.h @@ -18,9 +18,9 @@ namespace Catch { public: NotImplementedException( SourceLineInfo const& lineInfo ); - virtual ~NotImplementedException() throw() {} + virtual ~NotImplementedException() CATCH_NOEXCEPT {} - virtual const char* what() const throw(); + virtual const char* what() const CATCH_NOEXCEPT; private: std::string m_what; diff --git a/include/internal/catch_notimplemented_exception.hpp b/include/internal/catch_notimplemented_exception.hpp index 4683dcc1..4d263f1b 100644 --- a/include/internal/catch_notimplemented_exception.hpp +++ b/include/internal/catch_notimplemented_exception.hpp @@ -21,7 +21,7 @@ namespace Catch { m_what = oss.str(); } - const char* NotImplementedException::what() const throw() { + const char* NotImplementedException::what() const CATCH_NOEXCEPT { return m_what.c_str(); } diff --git a/include/internal/catch_stream.hpp b/include/internal/catch_stream.hpp index eea576ef..add38fac 100644 --- a/include/internal/catch_stream.hpp +++ b/include/internal/catch_stream.hpp @@ -27,7 +27,7 @@ namespace Catch { setp( data, data + sizeof(data) ); } - ~StreamBufImpl() throw() { + ~StreamBufImpl() CATCH_NOEXCEPT { sync(); } diff --git a/include/internal/catch_streambuf.h b/include/internal/catch_streambuf.h index 6a601dbd..87a82a16 100644 --- a/include/internal/catch_streambuf.h +++ b/include/internal/catch_streambuf.h @@ -14,7 +14,7 @@ namespace Catch { class StreamBufBase : public std::streambuf { public: - virtual ~StreamBufBase() throw(); + virtual ~StreamBufBase() CATCH_NOEXCEPT; }; }