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
////////////////////////////////////////////////////////////////////////////////
// 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

View File

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

View File

@ -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;

View File

@ -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();
}

View File

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

View File

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