Fixed clang compilation and added support for making assertions and erros throw exceptions for easier testing.

This commit is contained in:
2024-12-06 18:36:49 +01:00
parent 34adf3f006
commit f232728f69
6 changed files with 88 additions and 3 deletions

View File

@@ -14,6 +14,11 @@
#include <netdb.h>
#endif
#if MIJIN_COMPILER == MIJIN_COMPILER_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif // MIJIN_COMPILER == MIJIN_COMPILER_CLANG
namespace mijin
{
namespace
@@ -289,3 +294,7 @@ Task<StreamResult<std::vector<ip_address_t>>> c_resolveHostname(std::string host
co_return osResolveResult(resolveHandle);
}
}
#if MIJIN_COMPILER == MIJIN_COMPILER_CLANG
#pragma clang diagnostic pop
#endif // MIJIN_COMPILER == MIJIN_COMPILER_CLANG

View File

@@ -131,6 +131,7 @@ Task<StreamResult<HTTPResponse>> c_request(const URL& url, HTTPRequestOptions op
#undef HANDLE_CURL_RESULT
HTTPResponse response = {
.version = {},
.body = std::move(body)
};
if (const curl::Result<int> httpVersion = easy.getHTTPVersion(); httpVersion.isSuccess())

View File

@@ -6,6 +6,11 @@
#include "../internal/common.hpp"
#include "../util/variant.hpp"
#if MIJIN_COMPILER == MIJIN_COMPILER_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif // MIJIN_COMPILER == MIJIN_COMPILER_CLANG
namespace mijin
{
namespace
@@ -472,3 +477,7 @@ Task<StreamResult<std::unique_ptr<Socket>>> TCPServerSocket::c_waitForConnection
co_return StreamError::CONNECTION_CLOSED;
}
}
#if MIJIN_COMPILER == MIJIN_COMPILER_CLANG
#pragma clang diagnostic pop
#endif // MIJIN_COMPILER == MIJIN_COMPILER_CLANG