Repository navigation
cobalt: the shipped functions that return boost::system::result are [[nodiscard]], and cobalt asks for the nodiscard results rule - #3
Merged
Conversation
…ery shipped function returning boost::system::result [[nodiscard]]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
boost::system::resultcarries no[[nodiscard]]of its own, so a dropped result of an I/O callor an awaited operation would pass as a success. The headers that return one are generated: the
shipped Wasm implementation (
include/webcpp/cobalt/detail/backend/**) and the native SSL wrapper(
detail/native_ssl.hpp), outputs ofupstream/sync.pypinned by SHA-256 inupstream/generated.json. The generator gainsmark_nodiscard(), which declares[[nodiscard]]every function of a shipped header that returns
::boost::system::result, and the files areregenerated from it, so
--checkstill verifies them. meta/lint.json asks for the superproject'snodiscard resultslint rule.A friend declaration without a body cannot carry the attribute (clang refuses it, GCC ignores
it); it keeps its first declaration's. The superproject's rule skips such declarations since the
nodiscard/v0.1 pull request. Native public cobalt types remain Boost's own.
The branch sits on
main(release-link included). The superproject records this commit aslibs/cobaltin webcpporg/webcpp's nodiscard/v0.1 pull request, which merges after the cryptoand hash ones.
Changes
mark_nodiscard(); upstream/README.md says what it does.declarations marked; upstream/generated.json: their new digests.
"nodiscard-results"and its reason.Verification
upstream/sync.py --check: every shipped file verified;tools/shipped_sources.pypasses.cobalt's tests and examples with warnings as errors and report no discarded result, from scratch,
in the superproject's nodiscard/v0.1 tree with this commit recorded: native 26, wasip2 21, wasip3
21, Emscripten 20, gcc-15 (GCC 15.3) 24 tests passed, 0 failed.
nodiscard resultsincluded:lint: clean(2267 compilecommands).
🤖 Generated with Claude Code