From 3846d69638315a9065638a05fdba772cefabd9ba Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 2 Dec 2024 09:29:50 +0100 Subject: [PATCH] Add missing export statements Use ssl::error::make_error_code() Be less pedantic on Windows --- asio/.clang-tidy | 2 +- asio/CMakePresets.json | 8 ++++---- asio/include/asio/detail/impl/win_mutex.ipp | 4 +--- asio/include/asio/detail/impl/win_static_mutex.ipp | 10 +++------- asio/module/asio.cppm | 3 +++ asio/module/tests/main.cpp | 6 +++++- asio/module/tests/main.hpp | 4 ++-- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/asio/.clang-tidy b/asio/.clang-tidy index ba7f6ba84c..702655a364 100644 --- a/asio/.clang-tidy +++ b/asio/.clang-tidy @@ -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: diff --git a/asio/CMakePresets.json b/asio/CMakePresets.json index 0e68c964d2..f7eee70b6a 100644 --- a/asio/CMakePresets.json +++ b/asio/CMakePresets.json @@ -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", diff --git a/asio/include/asio/detail/impl/win_mutex.ipp b/asio/include/asio/detail/impl/win_mutex.ipp index 077848bff5..581e3a352d 100644 --- a/asio/include/asio/detail/impl/win_mutex.ipp +++ b/asio/include/asio/detail/impl/win_mutex.ipp @@ -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; diff --git a/asio/include/asio/detail/impl/win_static_mutex.ipp b/asio/include/asio/detail/impl/win_static_mutex.ipp index 7e282603ff..33c71c4158 100644 --- a/asio/include/asio/detail/impl/win_static_mutex.ipp +++ b/asio/include/asio/detail/impl/win_static_mutex.ipp @@ -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 diff --git a/asio/module/asio.cppm b/asio/module/asio.cppm index df6d9fb1cd..767ca2e06e 100644 --- a/asio/module/asio.cppm +++ b/asio/module/asio.cppm @@ -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 diff --git a/asio/module/tests/main.cpp b/asio/module/tests/main.cpp index e8c0e0f61a..2b964dd2c5 100644 --- a/asio/module/tests/main.cpp +++ b/asio/module/tests/main.cpp @@ -1,3 +1,7 @@ #include "main.hpp" -int main() { return bench::main_impl(); } \ No newline at end of file +// NOLINTNEXTLINE(bugprone-exception-escape) +auto main() -> int +{ + return bench::main_impl(); // NOLINT(clang-analyzer-core.CallAndMessage) +} diff --git a/asio/module/tests/main.hpp b/asio/module/tests/main.hpp index db1d26649d..34e6a95e59 100644 --- a/asio/module/tests/main.hpp +++ b/asio/module/tests/main.hpp @@ -33,7 +33,7 @@ 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); } @@ -41,7 +41,7 @@ inline void fail(error_code ec, char const* what) inline net::awaitable 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 stream {std::move(client_sock), ctx};