Added support for completely disabling noexcept using MIJIN_TEST_NO_NOEXCEPT (for testing).

This commit is contained in:
2024-08-29 00:01:23 +02:00
parent a43f92fb58
commit 9ba097fc2f
41 changed files with 643 additions and 564 deletions

View File

@@ -9,7 +9,7 @@ namespace mijin
namespace
{
inline constexpr int BIO_BUFFER_SIZE = 4096;
ossl::Result<ossl::Context*> getSSLContext() noexcept
ossl::Result<ossl::Context*> getSSLContext() MIJIN_NOEXCEPT
{
static ossl::Context context;
static std::mutex contextMutex;
@@ -52,7 +52,7 @@ ossl::Result<ossl::Context*> getSSLContext() noexcept
}
}
StreamError SSLStream::open(Stream& base, const std::string& hostname) noexcept
StreamError SSLStream::open(Stream& base, const std::string& hostname) MIJIN_NOEXCEPT
{
MIJIN_ASSERT(base_ == nullptr, "SSL stream is already open.");
@@ -112,7 +112,7 @@ StreamError SSLStream::open(Stream& base, const std::string& hostname) noexcept
return StreamError::SUCCESS;
}
void SSLStream::close() noexcept
void SSLStream::close() MIJIN_NOEXCEPT
{
MIJIN_ASSERT(base_ != nullptr, "SSL stream is not open.");
base_ = nullptr;
@@ -233,7 +233,7 @@ StreamFeatures SSLStream::getFeatures()
};
}
StreamError SSLStream::bioToBase() noexcept
StreamError SSLStream::bioToBase() MIJIN_NOEXCEPT
{
std::array<std::uint8_t, BIO_BUFFER_SIZE> buffer;
std::size_t bytes = std::min(externalBio_.ctrlPending(), buffer.size());
@@ -254,7 +254,7 @@ StreamError SSLStream::bioToBase() noexcept
return StreamError::SUCCESS;
}
StreamError SSLStream::baseToBio() noexcept
StreamError SSLStream::baseToBio() MIJIN_NOEXCEPT
{
std::array<std::uint8_t, BIO_BUFFER_SIZE> buffer;
std::size_t toRead = externalBio_.getWriteGuarantee();