Skip to content

Generate [expected] wording from the annotated headers via specgen - #94

Open
steve-downey wants to merge 4 commits into
bemanproject:mainfrom
steve-downey:wording-from-headers
Open

Generate [expected] wording from the annotated headers via specgen#94
steve-downey wants to merge 4 commits into
bemanproject:mainfrom
steve-downey:wording-from-headers

Conversation

@steve-downey

Copy link
Copy Markdown
Member

Summary

  • Annotate unexpected.hpp, bad_expected_access.hpp, and expected.hpp with //! specgen docblocks (Effects, Constraints, Mandates, Returns, Throws, Remarks) for every declaration, sourced from the real standard text for already-standardized members and from papers/expected-new.tex for the expected-over-references additions (unexpected<E&>, expected<T&,E>). specgen generate --validate passes cleanly on all three headers.
  • Add papers/wording/generate.sh (wired up as make wording) to turn those docblocks into wording, landed two ways:
    • papers/wording/fragments/*.tex — one file per top-level clause, for \input into a standalone paper.
    • papers/wording/expected.tex — the same content concatenated in real standard clause order at the draft's own absolute numbering, with no \rSec2[expected] wrapper and no \input directives — the basis for a patch to source/utilities.tex in the actual C++ working draft (cplusplus/draft), where [expected.general] and [expected.syn] stay untouched (hand-authored prose, not generated from any one declaration) and only the subclauses from [expected.unexpected] on are replaced/extended.

The headers are now a source of truth specgen can turn into wording directly, instead of the wording and the implementation being able to drift apart.

Test plan

  • specgen generate --validate passes on all three headers
  • cmake --build --preset gcc-debug
  • ctest --preset gcc-debug — 1178/1178 tests pass
  • Reviewer spot-check: does papers/wording/expected.tex read correctly against the current [expected] clause and papers/expected-new.tex?

catch_discover_tests defaults to DISCOVERY_MODE POST_BUILD, which runs
the freshly-linked (ASan-instrumented) test binaries during the ninja
build itself to enumerate their test cases. Under the CodeQL Advanced
workflow, CodeQL's build tracer injects its own LD_PRELOAD ahead of
the ASan runtime, and ASan aborts immediately with "ASan runtime does
not come first in initial library list", failing the build before
analysis can run.

Switching to DISCOVERY_MODE PRE_TEST moves the enumeration step to
ctest invocation time instead of build time, so no instrumented binary
runs while CodeQL is tracing the build. Verified locally: gcc-debug
preset builds cleanly and `ctest` still discovers and passes all 1178
tests.
fix: defer Catch2 test discovery to ctest time to unblock CodeQL build
Add //! docblocks (Effects, Constraints, Mandates, Returns, Throws,
Remarks) to every declaration in unexpected.hpp, bad_expected_access.hpp,
and expected.hpp, sourced from the real standard text for the
already-standardized members and from papers/expected-new.tex for the
expected-over-references additions (unexpected<E&>, expected<T&,E>).
specgen generate --validate passes cleanly on all three headers, so the
headers are now a source of truth specgen can turn into wording directly.
Add papers/wording/generate.sh (wired up as `make wording`), which runs
specgen against the three headers and assembles the result two ways:

- papers/wording/fragments/*.tex: one file per top-level clause, for
  \input into a standalone paper (specgen numbers a fragment's \rSec
  markers one level deeper than written, so a paper's own
  \rSec1[expected]{Expected objects} supplies the level these assume).
- papers/wording/expected.tex: the same content concatenated in real
  standard clause order, at the draft's own absolute numbering, with no
  \rSec2[expected] wrapper and no \input directives -- the basis for a
  patch to source/utilities.tex in the actual C++ working draft
  (github.com/cplusplus/draft), where [expected.general] and
  [expected.syn] are untouched and only the subclauses from
  [expected.unexpected] on are replaced/extended.

[expected.general] and [expected.syn] are prose, not generated from any
one declaration; they stay hand-authored in papers/expected-new.tex.
\returns
\tcode{!x.has_value() && static_cast<bool>(x.error() == e.error())}.
\end{itemdescr}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pre-commit] reported by reviewdog 🐶

Suggested change

@github-advanced-security

Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

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.

2 participants