Skip to content

cobalt: the shipped functions that return boost::system::result are [[nodiscard]], and cobalt asks for the nodiscard results rule - #3

Merged
pinhopro merged 1 commit into
mainfrom
nodiscard-results
Nov 16, 2026
Merged

pinhopro merged 1 commit into
mainfrom
nodiscard-results

Conversation

@pinhopro

Copy link
Copy Markdown
Contributor

Summary

boost::system::result carries no [[nodiscard]] of its own, so a dropped result of an I/O call
or 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 of upstream/sync.py pinned by SHA-256 in
upstream/generated.json. The generator gains mark_nodiscard(), which declares [[nodiscard]]
every function of a shipped header that returns ::boost::system::result, and the files are
regenerated from it, so --check still verifies them. meta/lint.json asks for the superproject's
nodiscard results lint 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 as
libs/cobalt in webcpporg/webcpp's nodiscard/v0.1 pull request, which merges after the crypto
and hash ones.

Changes

  • upstream/sync.py: mark_nodiscard(); upstream/README.md says what it does.
  • include/webcpp/cobalt/detail/backend/** and detail/native_ssl.hpp: regenerated, 50
    declarations marked; upstream/generated.json: their new digests.
  • meta/lint.json: "nodiscard-results" and its reason.
  • doc/changelog.adoc: one line.

Verification

  • upstream/sync.py --check: every shipped file verified; tools/shipped_sources.py passes.
  • No call site changed. The native, wasip2, wasip3, Emscripten and gcc-15 (GCC 15.3) lanes compile
    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.
  • The superproject's lint, rule nodiscard results included: lint: clean (2267 compile
    commands).

🤖 Generated with Claude Code

…ery shipped function returning boost::system::result [[nodiscard]]
@pinhopro
pinhopro merged commit a1a1020 into main Nov 16, 2026
19 of 78 checks passed
@pinhopro
pinhopro deleted the nodiscard-results branch November 17, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant