registry affinity: correct the reference, and stop expanding va_args thrice - #111
Merged
Merged
Conversation
…thrice Follow-ups from the review of boostorg#96, all mechanical. The reference still described the pre-affinity default in five places: the `BOOST_OPENMETHOD_DEFAULT_REGISTRY` page ("the default value for the Registry template parameter of method, use_classes, virtual_ptr, and all the constructs that take a registry" - only `use_classes` is still true), the `virtual_ptr` class, the one-argument `final_virtual_ptr`, and the `@note` on each of `BOOST_OPENMETHOD` and `BOOST_OPENMETHOD_CLASSES`. Each now says what the construct actually defaults to, and the `BOOST_OPENMETHOD_CLASSES` note says plainly that it does *not* consult affinities - the trap the page warns about. `registries_and_policies.adoc` gets the same correction in its opening paragraph, and `class method`'s own description still carried a paragraph contradicting its `@tparam Registry`. That description was also missing from the reference entirely: MrDocs does not attach a `//!` comment to a declaration when a namespace definition comes between them, and the `namespace detail { ... }` holding the affinity scan had been inserted there. The block moves above the comment, which now touches `class method` as it must. Rendered `method` page keeps its call semantics and overrider-selection steps. `BOOST_OPENMETHOD_TYPE` expanded `va_args<__VA_ARGS__>` three times and the parameter list twice, to compute a registry and hand it back to `method`: 30-36% more preprocessor output per declaration, measured with `g++ -E -P`. A `method_type` alias on the two `va_args` specializations names the method directly, so the macro spells `va_args` twice and the parameter list once, and the affinity scan still never runs for a declaration that names a registry. `va_args::registry` had no consumer left in the tree and goes. Also: three explanatory comments inside the tagged regions of `adl_registry.cpp` moved to the page that includes them, per the rule in CLAUDE.md, and two tests stop naming `BOOST_OPENMETHOD_DEFAULT_REGISTRY` in a comment - `test/CMakeLists.txt` scans for that token to decide which tests must not get the shared PCH, and a mention in prose was enough to withhold it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQG6CbE4o2agseE7bDVzHS
|
An automated preview of the documentation is available at https://111.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-09-15 12:57:03 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #111 +/- ##
===========================================
- Coverage 93.51% 93.25% -0.26%
===========================================
Files 22 22
Lines 1695 1706 +11
Branches 504 509 +5
===========================================
+ Hits 1585 1591 +6
- Misses 66 71 +5
Partials 44 44
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.
(Written by Claude Code, on behalf of @jll63.)
Follow-ups from the review of #96, all mechanical. No behaviour changes.
The reference described the pre-affinity default in five places
BOOST_OPENMETHOD_DEFAULT_REGISTRY's own page said it was "the default valuefor the
Registrytemplate parameter ofmethod,use_classes,virtual_ptr, and all the constructs that take a registry as a templateargument" - after #96 only
use_classesis still true. Thevirtual_ptrclass,the one-argument
final_virtual_ptr, and the@noteon each ofBOOST_OPENMETHODandBOOST_OPENMETHOD_CLASSESsaid variants of the samething. Each now says what the construct actually defaults to, and the
BOOST_OPENMETHOD_CLASSESnote says plainly that it does not consultaffinities - which is the trap
registries_and_policies.adocalready warnsabout, and which a reader of the reference page had no way to learn. The page's
own opening paragraph gets the same correction, and
class method'sdescription still carried a paragraph contradicting its
@tparam Registry.class methodhad no description in the reference at allMrDocs does not attach a
//!comment to a declaration when a namespacedefinition comes between them, and the
namespace detail { ... }holding theaffinity scan had been inserted exactly there - so the rendered page kept the
three
@tparamlines and lost the call semantics and the fouroverrider-selection steps. The block moves above the comment, which now touches
the declaration it documents.
BOOST_OPENMETHOD_TYPEexpandedva_argsthree timesIt computed a registry and handed it back to
method, spellingva_args<__VA_ARGS__>three times and the parameter list twice - 30-36% morepreprocessor output per declaration, measured with
g++ -E -P. Amethod_typealias template on the two
va_argsspecializations names the method directly,so the macro spells
va_argstwice and the parameter list once. It stays analias template, so the specialization that omits the registry still leaves
method's own default to scan the parameters, and the one that names a registrystill never triggers that scan.
va_args::registryhad no consumer left in thetree and goes.
Two smaller ones
Three explanatory comments inside the tagged regions of
adl_registry.cppmoveto the page that includes them, per the rule in
CLAUDE.md- they wererendering into the snippets.
Two tests stop naming
BOOST_OPENMETHOD_DEFAULT_REGISTRYin a comment.test/CMakeLists.txtscans sources for that token to decide which tests mustnot receive the force-included PCH; a mention in prose was enough to withhold
it, which is what #96's own note in
CLAUDE.mdsaid should not happen foraffinity tests.
Tests
185/185 under gcc 13.3 Release with examples, 191/191 under gcc 16 with C++26
reflection and
BUILD_SHARED_LIBS=ON, both withBOOST_OPENMETHOD_WARNINGS_AS_ERRORS=ON.Still open from the review
Not in this PR, because each needs a decision rather than a correction: a
derived class overriding its base's affinity makes
virtual_ptr<Derived>non-convertible to
virtual_ptr<Base>and short-form overriders fail with amisleading "cannot find method";
use_classesand the C++26 reflectionregistrar still default to the macro instead of following affinities;
virtual_ptr_alt.adocdoes not mention thatinitialize()does not follow anaffinity either, and two of
adl_registry.cpp's tags are included by no page;the recommended hidden friend trips gcc's
-Wnon-template-friendon aclass-template root, undocumented; and the doc example is the only one written
as a Boost.Test module, duplicating
test_adl_registry.cpp.🤖 Generated with Claude Code
https://claude.ai/code/session_01RQG6CbE4o2agseE7bDVzHS