Skip to content

Commit

Permalink
Add missing export statements
Browse files Browse the repository at this point in the history
Use ssl::error::make_error_code()

Be less pedantic on Windows
  • Loading branch information
ClausKlein committed Dec 2, 2024
1 parent 47d4cd3 commit 3846d69
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion asio/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Checks: "*,\
-*-magic-numbers,\
-performance-avoid-endl,
-misc-include-cleaner,\
-misc-header-include-cycle,\
misc-header-include-cycle,\
-misc-non-private-member-variables-in-classes"
WarningsAsErrors: ''
CheckOptions:
Expand Down
8 changes: 4 additions & 4 deletions asio/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@
{
"name": "flags-Windows",
"description":
"Note that all the flags after /W4 are required for MSVC to conform to the language standard",
"Note that all the flags after /W3 are required for MSVC to conform to the language standard",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_COMPILER": "cl",
"CMAKE_CXX_FLAGS":
"/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc",
"CMAKE_EXE_LINKER_FLAGS": "/machine:x64 /guard:cf"
"CMAKE_CXX_FLAGS_PEDANTIC":
"/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W3 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc",
"CMAKE_EXE_LINKER_FLAGS_PEDANTIC": "/machine:x64 /guard:cf"
},
"condition": {
"type": "equals",
Expand Down
4 changes: 1 addition & 3 deletions asio/include/asio/detail/impl/win_mutex.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ int win_mutex::do_init()
}
catch (const std::bad_alloc&)
{
if(GetExceptionCode() == STATUS_NO_MEMORY
? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
return ERROR_OUTOFMEMORY;
return ERROR_OUTOFMEMORY;
}

return 0;
Expand Down
10 changes: 3 additions & 7 deletions asio/include/asio/detail/impl/win_static_mutex.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,9 @@ int win_static_mutex::do_init()
}
catch (const std::bad_alloc&)
{
if(GetExceptionCode() == STATUS_NO_MEMORY
? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
::ReleaseMutex(mutex);
::CloseHandle(mutex);
return ERROR_OUTOFMEMORY;
}
::ReleaseMutex(mutex);
::CloseHandle(mutex);
return ERROR_OUTOFMEMORY;
}
#endif

Expand Down
3 changes: 3 additions & 0 deletions asio/module/asio.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export using asio::ssl::verify_context;
export using asio::ssl::stream;
namespace error
{
export using asio::ssl::error::stream_truncated;
export using asio::ssl::error::unspecified_system_error;
export using asio::ssl::error::unexpected_result;
export using asio::ssl::error::stream_errors;
export using asio::ssl::error::make_error_code;
} // namespace error
Expand Down
6 changes: 5 additions & 1 deletion asio/module/tests/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#include "main.hpp"

int main() { return bench::main_impl(); }
// NOLINTNEXTLINE(bugprone-exception-escape)
auto main() -> int
{
return bench::main_impl(); // NOLINT(clang-analyzer-core.CallAndMessage)
}
4 changes: 2 additions & 2 deletions asio/module/tests/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ using std::error_code;

inline void fail(error_code ec, char const* what)
{
if(ec == net::ssl::error::stream_truncated)
if(ec == ssl::error::make_error_code(net::ssl::error::stream_truncated))
return;
exit(1);
}

inline net::awaitable<void> do_session(tcp::socket client_sock)
{
char buff [4096] {};
auto ex = co_await net::this_coro::executor;
// TODO(CK): Not used? auto ex = co_await net::this_coro::executor;

ssl::context ctx {ssl::context::tls_client};
ssl::stream<tcp::socket> stream {std::move(client_sock), ctx};
Expand Down

0 comments on commit 3846d69

Please sign in to comment.