From 9ff34177b9f9cf3a4d668c3acb71b89b5b6114c7 Mon Sep 17 00:00:00 2001 From: R Date: Sat, 14 Nov 2026 20:31:12 -0300 Subject: [PATCH 1/2] asio: each expected diagnostic on one line, so clang's -verify reads it Three compile-diagnostic tests wrapped their expected text over two // lines. clang's -verify cannot find the closing }} there, reports an error the rule ignores, and drops the directive, so the tests checked nothing. Each now states a shorter part of the message on one line. --- doc/changelog.adoc | 1 + test/capabilities/diagnostics_test.cpp | 3 +-- test/openssl_on_webassembly_test.cpp | 3 +-- test/ssl_without_openssl_test.cpp | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/changelog.adoc b/doc/changelog.adoc index d88c2b3..19df15a 100644 --- a/doc/changelog.adoc +++ b/doc/changelog.adoc @@ -14,6 +14,7 @@ Changes prepared for the first WebCPP release. === Unreleased // tag::unreleased[] +* Fixed three diagnostic tests whose expected error clang's `-verify` never read, so they checked nothing. * *Breaking change:* Removed `/webcpp/asio//cobalt` and `cobalt_ssl`; link `/webcpp/cobalt//cobalt` or `cobalt_ssl`. * Fixed browser turn budgets across timer waits so worker proxy messages can run. * Fixed browser and WASIp2 timer test dependencies and the unbounded backend control. diff --git a/test/capabilities/diagnostics_test.cpp b/test/capabilities/diagnostics_test.cpp index 8a5e681..bbd4d55 100644 --- a/test/capabilities/diagnostics_test.cpp +++ b/test/capabilities/diagnostics_test.cpp @@ -10,8 +10,7 @@ // expected-error@webcpp/asio/config.hpp:* {{requires /webcpp/asio//openssl or /webcpp/asio//tls}} #include #elif defined(WEBCPP_TEST_DISABLED_TLS) -// expected-error@webcpp/asio/ssl.hpp:* {{needs OpenSSL on native and WASI targets, and it is not -// linked}} +// expected-error@webcpp/asio/ssl.hpp:* {{needs OpenSSL on native and WASI targets}} #include #elif defined(WEBCPP_TEST_BROWSER_HEADER) // expected-error@webcpp/asio/browser/bridge.hpp:* {{requires the Emscripten browser bridge}} diff --git a/test/openssl_on_webassembly_test.cpp b/test/openssl_on_webassembly_test.cpp index 6990fdc..f8a6d3d 100644 --- a/test/openssl_on_webassembly_test.cpp +++ b/test/openssl_on_webassembly_test.cpp @@ -4,6 +4,5 @@ // accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) -// expected-error@*:* {{is named in a build for Emscripten, whose browser profile does not link -// OpenSSL}} +// expected-error@*:* {{whose browser profile does not link OpenSSL}} #include "../src/openssl_on_webassembly.hpp" diff --git a/test/ssl_without_openssl_test.cpp b/test/ssl_without_openssl_test.cpp index b81b75b..eeefd4b 100644 --- a/test/ssl_without_openssl_test.cpp +++ b/test/ssl_without_openssl_test.cpp @@ -4,6 +4,5 @@ // accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) -// expected-error@webcpp/asio/ssl.hpp:* {{needs OpenSSL on native and WASI targets, and it is not -// linked}} +// expected-error@webcpp/asio/ssl.hpp:* {{needs OpenSSL on native and WASI targets}} #include From 3569dc4276f871828c1e5ad397fe5c31ee9d6d85 Mon Sep 17 00:00:00 2001 From: R Date: Sun, 15 Nov 2026 20:54:01 -0300 Subject: [PATCH 2/2] asio: opt into the nodiscard-results lint rule; make_tls_client_context is [[nodiscard]] --- doc/changelog.adoc | 1 + include/webcpp/asio/tls_client_context.hpp | 5 +++-- meta/lint.json | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 meta/lint.json diff --git a/doc/changelog.adoc b/doc/changelog.adoc index 19df15a..507ca50 100644 --- a/doc/changelog.adoc +++ b/doc/changelog.adoc @@ -22,6 +22,7 @@ Changes prepared for the first WebCPP release. * Fixed posted completions after JavaScript reentry with concurrency hint one. * Added current example coverage and Release performance, memory and yield measurements. * Updated the guides and Asyncify stack measurements for release builds linked at `-O3`. +* Changed make_tls_client_context to `+[[nodiscard]]+`, so a dropped context or its error is diagnosed. // end::unreleased[] [#asio-changelog-0-1-0] diff --git a/include/webcpp/asio/tls_client_context.hpp b/include/webcpp/asio/tls_client_context.hpp index 98a6972..ff74d55 100644 --- a/include/webcpp/asio/tls_client_context.hpp +++ b/include/webcpp/asio/tls_client_context.hpp @@ -87,7 +87,8 @@ inline boost::system::error_code make_error_code(tls_context_error value) noexce @return The context, or a tls_context_error; browser targets return unsupported_target. @see "How-to: configure trusted certificate authorities", in the guide. */ -inline boost::system::result make_tls_client_context(std::string_view ca_pem) { +[[nodiscard]] inline boost::system::result make_tls_client_context( + std::string_view ca_pem) { #ifdef WEBCPP_TARGET_EMSCRIPTEN (void)ca_pem; return make_error_code(tls_context_error::unsupported_target); @@ -166,7 +167,7 @@ inline boost::system::result make_tls_client_context(std::string_v @return The context, or a tls_context_error; browser targets return unsupported_target. @see "How-to: configure trusted certificate authorities", in the guide. */ -inline boost::system::result make_tls_client_context() { +[[nodiscard]] inline boost::system::result make_tls_client_context() { #ifdef WEBCPP_TARGET_EMSCRIPTEN return make_error_code(tls_context_error::unsupported_target); #else diff --git a/meta/lint.json b/meta/lint.json new file mode 100644 index 0000000..44250cd --- /dev/null +++ b/meta/lint.json @@ -0,0 +1,3 @@ +{ + "nodiscard-results": "a dropped result, a TLS client context's, would pass as a context that trusts its authorities" +}