doc: stop the detail-hiding macro leaking into the rendered constraints - #92
Open
jll63 wants to merge 4 commits into
Open
doc: stop the detail-hiding macro leaking into the rendered constraints#92jll63 wants to merge 4 commits into
jll63 wants to merge 4 commits into
Conversation
MrDocs renders the condition of an enable_if_t used as a defaulted template argument as a C++20 requires-clause by copying the raw source text spanning the condition expression - it does not walk the expression tree (cppalliance/mrdocs#1016). BOOST_OPENMETHOD_DETAIL_UNLESS_MRDOCS therefore disappears only when it sits before the first token of the condition, where it expands to nothing under __MRDOCS__ and so falls outside the copied range; anywhere inside the condition its name is printed verbatim, whatever shape the macro has. That is why a constraint naming two exposition-only traits rendered the first correctly and leaked the second. Two rules restore the reference, documented next to the macro definition and in CLAUDE.md: the macro must lead the condition, with a negation spelled `Trait<T> == false`; and each trait gets its own defaulted template parameter, which MrDocs joins with && in source order, leaving the rendered clause unchanged. Splitting also makes substitution short-circuit, so `typename Other::element_type` is only formed once SameSmartPtr has passed. No reference page mentions the macro any more. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…RDOCS(...) Replace BOOST_OPENMETHOD_DETAIL_UNLESS_MRDOCS with a function-like BOOST_OPENMETHOD_UNLESS_MRDOCS(...), spelled at the call sites as BOOST_OPENMETHOD_UNLESS_MRDOCS(detail::). The macro now says what it does - drop this text under __MRDOCS__ - instead of encoding one payload in its name, and the payload is visible where it is used. The shape has no effect on the rendering: MrDocs copies the raw source text of a constraint, so the macro still has to lead the condition, whether it is object-like or function-like. The two rules recorded in the previous commit are unchanged. Also widen the mrdocs.yml exclude-macros pattern, which matched the old name through 'BOOST_OPENMETHOD_DETAIL_*'. 'BOOST_OPENMETHOD_*UNLESS_MRDOCS' covers the new name and the two namespace macros, which were never listed. Verified that MrDocs honours a glob star in the middle of a pattern. Document, in CLAUDE.md, that anything posted in public under the maintainer's account has to identify Claude as its author on the first line. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The three constructors taking a smart pointer to a derived class carried two copies of their template parameter list: an unqualified one under `#ifdef __MRDOCS__`, for the reference, and the real `detail::`-qualified one. Only MrDocs ever compiles the first, so the two could drift apart without anything failing, and the reference would document a constraint the library does not have. The rules recorded in the previous commits cover this case, so state each constraint once, with SameSmartPtr and IsPolymorphic in a defaulted template parameter each. The rendered requires-clause is byte-for-byte what the duplicated declarations produced. The `#ifdef __MRDOCS__` blocks that remain remove declarations from the reference - friends, deleted overloads, the VirtualTraits blueprint - rather than restate them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ments The three converting constructors listed IsPolymorphic before the constructibility test, the two converting assignments after it. Put the exposition-only traits at the ends in all five, so the rendered clause reads SameSmartPtr && <constructible|assignable> && IsPolymorphic throughout, and the five template parameter lists are spelled and formatted identically. Substitution still short-circuits on SameSmartPtr, so `typename Other::element_type` is only formed for an actual smart pointer. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jll63
force-pushed
the
fix/mrdocs-detail-prefix
branch
from
August 23, 2026 15:12
541a67d to
752b3eb
Compare
|
An automated preview of the documentation is available at https://92.openmethod.prtest3.cppalliance.org/libs/openmethod/doc/html/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-08-23 15:16:09 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #92 +/- ##
========================================
Coverage 94.97% 94.97%
========================================
Files 99 99
Lines 4322 4322
Branches 2138 2138
========================================
Hits 4105 4105
Misses 160 160
Partials 57 57
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
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.
Seven reference pages leaked
BOOST_OPENMETHOD_DETAIL_UNLESS_MRDOCSinto the renderedrequires-clause, e.g.
This is cppalliance/mrdocs#1016. Upstream cannot fix it until MrDocs can manipulate expression
trees, so the workaround has to live in the headers.
Why it happens
MrDocs turns the condition of an
enable_if_tused as a defaulted template argument into arequires-clause by copying the raw source text spanning the condition expression. A macro
therefore disappears only when it sits before the expression's first token: it expands to
nothing under
__MRDOCS__, so the copied range simply starts after it. Anywhere inside therange - after a
!, after a&&, inside parentheses - its name is copied verbatim.That is the asymmetry noted on the issue: in a two-occurrence constraint the first macro is
outside the range and the second is inside it. The shape of the macro is irrelevant - object-like,
function-like, or a bare
#ifndef __MRDOCS__arounddetail::all leak, and a macro that carriesthe
!leaks too, because the expression then starts inside a macro expansion.Two rules
Trait<T> == false, not!Trait<T>.parameter: MrDocs joins them with
&&in source order, so the rendered clause is unchanged.Recorded next to the macro definition in
core.hppand inCLAUDE.md, since neither isdiscoverable from the failure.
Changes
BOOST_OPENMETHOD_UNLESS_MRDOCS(...)replacesBOOST_OPENMETHOD_DETAIL_UNLESS_MRDOCS,spelled
BOOST_OPENMETHOD_UNLESS_MRDOCS(detail::)at the call sites. The macro now says what itdoes rather than encoding one payload in its name.
virtual_ptrandvirtual_anyfollow the rules above.list twice. They carried an unqualified copy under
#ifdef __MRDOCS__beside the real one;only MrDocs ever compiled the copy, so the two could drift apart silently and the reference would
document a constraint the library does not have. The rendered clause is unchanged.
virtual_ptrnow readSameSmartPtr && <constructible|assignable> && IsPolymorphic; the constructors previouslyordered the conjuncts differently from the assignments.
doc/mrdocs.yml:exclude-macrosmatched the old name throughBOOST_OPENMETHOD_DETAIL_*.BOOST_OPENMETHOD_*UNLESS_MRDOCScovers the new name and the two namespace macros, which hadnever been listed. (Checked that MrDocs honours a star in the middle of a pattern - these macros
carry no doc comment, so a bad pattern would have failed silently.)
Splitting the conditions also makes substitution short-circuit, so
typename Other::element_typeis only formed once
SameSmartPtrhas passed.Verification
doc/build_antora.sh:grep -rl MRDOCS doc/html/returns nothing, andthe five smart-pointer synopses and the two
virtual_anyones read as intended.#ifdef __MRDOCS__blocks were checked: they remove declarations from thereference (friends, deleted
final_virtual_ptroverloads, theVirtualTraitsblueprint) ratherthan restate them.
🤖 Generated with Claude Code