Add CATCH_NOEXCEPT macro

This commit is contained in:
gnzlbg 2014-03-20 12:48:19 +01:00
parent ba13f3f098
commit 21edb3c7a4
6 changed files with 28 additions and 6 deletions

View File

@ -81,5 +81,27 @@
#endif #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 #endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED

View File

@ -39,7 +39,7 @@
namespace Catch { namespace Catch {
NonCopyable::~NonCopyable() {} NonCopyable::~NonCopyable() {}
IShared::~IShared() {} IShared::~IShared() {}
StreamBufBase::~StreamBufBase() throw() {} StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {}
IContext::~IContext() {} IContext::~IContext() {}
IResultCapture::~IResultCapture() {} IResultCapture::~IResultCapture() {}
ITestCase::~ITestCase() {} ITestCase::~ITestCase() {}

View File

@ -18,9 +18,9 @@ namespace Catch {
public: public:
NotImplementedException( SourceLineInfo const& lineInfo ); 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: private:
std::string m_what; std::string m_what;

View File

@ -21,7 +21,7 @@ namespace Catch {
m_what = oss.str(); m_what = oss.str();
} }
const char* NotImplementedException::what() const throw() { const char* NotImplementedException::what() const CATCH_NOEXCEPT {
return m_what.c_str(); return m_what.c_str();
} }

View File

@ -27,7 +27,7 @@ namespace Catch {
setp( data, data + sizeof(data) ); setp( data, data + sizeof(data) );
} }
~StreamBufImpl() throw() { ~StreamBufImpl() CATCH_NOEXCEPT {
sync(); sync();
} }

View File

@ -14,7 +14,7 @@ namespace Catch {
class StreamBufBase : public std::streambuf { class StreamBufBase : public std::streambuf {
public: public:
virtual ~StreamBufBase() throw(); virtual ~StreamBufBase() CATCH_NOEXCEPT;
}; };
} }