Skip to content

cpp: count definitions with a post-parameter tail (THROWS, noexcept(x), throw(), -> decltype) (Part of #5462) - #5572

Merged
squid-protocol merged 1 commit into
mainfrom
churn/5462-20261019T0331Z
Oct 19, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
churn/5462-20261019T0331Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5462 (the psydoom C++ undercount left after #5495).

Class: the post-parameter tail of a function definition (between ) and {)

func_start item 8 only accepted const / volatile / bare noexcept / override / final / &/&& / __attribute__ / [[attr]] and a plain -> T. Any other token there dropped the whole definition. psydoom's MBlockBitStream.cpp puts THROWS on every method (3 of 19 counted).

Member Example Before After
bare ALL-CAPS specifier macro (same line, or indented below )) readBit() THROWS {, ASIO_NOEXCEPT, Q_DECL_OVERRIDE, VULKAN_HPP_NOEXCEPT missed counted
noexcept(expr) noexcept(sizeof(T) > 4) missed counted
dynamic exception spec throw(), throw(A, B) missed counted
trailing return with cv-qualifiers, pointer or commas -> const char*, -> std::map<int, int> missed counted
-> decltype(...) -> decltype(std::forward<T>(x)) missed counted
C++20 requires clause f(T t) requires Foo<T> { missed counted
function-try-block f() try { missed counted
already handled const, & noexcept, override final, [[attr]] counted counted

Not added: a macro with an argument list (f() MY_ATTR(1, 2) {). It can't be told apart from the #5461 macro-statement chains (EXTERN_CVAR(...)\nCUSTOM_CVAR(...) {). The first attempt took it and renamed 269 gzdoom/doom3 definitions, so the specifier macro is restricted to a bare name, never at column 0 and never followed by (. alignas joins the not-a-function shield (struct alignas(16) VEC {).

Evidence

  • The 5 disputed psydoom files, compared with ctags on named functions (±3 lines): every named function now matches. MBlockBitStream goes 3 → 19 (ctags 19). ConfigSerialization 22/22, MapPatches 51/51, ScriptBindings 106 vs 105 named, p_setup 21/21. The only named "misses" are ctags false positives on BEGIN_NAMESPACE(x). The rest of the issue's gap is lambdas (ctags __anon*: 14 / 34 / 31 / 12), which GitGalaxy doesn't count as functions.
  • func_start match diff on psydoom, gzdoom, doom3-bfg and zandronum, main vs this branch: +5168 / −111 → after the restriction, −30. All 30 losses are ctor-initializer false matches (impl_(other.impl_)\n{ in asio) that now resolve to the real constructor (strand(...) ASIO_NOEXCEPT : ... {). I sampled the additions per class, and they are definitions (asio/rapidjson/vulkan/fltk specifier macros, sol2 noexcept(...), -> decltype).
  • Known residual: an indented statement shaped call(x) MACRO { inside a body still matches. It was rare in the diff.

Tests

tests/extraction/languages/test_cpp_post_param_tail.py has every member above, the two #5461 chain shapes (the name is kept), negatives (struct alignas(16) VEC {, f() THROWS;, if (x) LIKELY {, f() MY_ATTR(1, 2) {) and ReDoS immunity for each new branch.

Gates

  • pr_gates --fast 6/6. --ratchets 8/8.
  • Golden bless (golden-lock.sh crucible_check.py --update --yes, both legs): no drift, so no fixture changes. The crucible C++ has none of these shapes.
  • Tree-wide guards: 178 passed. Time ratchet: 0 over. audit_check: all clear.
  • Not run locally: the tri-comparison and tree-sitter accuracy audits (left to CI).

Sibling gaps

  • Lambdas are the bulk of the remaining psydoom delta vs ctags. They are a counting-convention difference, not a template-member shape.
  • Argument-list specifier macros (f() MY_ATTR(1, 2) {) collide with macro-statement chains and need a different discriminator.
  • C (c.py) trailing specifier macros (__THROW, glibc style): unchecked.

🤖 Generated with Claude Code

…), throw(), -> decltype) (Part of #5462)

The tail between a definition's `)` and its `{` now also takes a bare
ALL-CAPS specifier macro (psydoom `readBit() THROWS {`, ASIO_NOEXCEPT,
Q_DECL_OVERRIDE), `noexcept(expr)`, `throw(...)`, trailing returns with
cv-qualifiers, pointers, commas or `decltype(...)`, a `requires` clause
and a function-try-block. `alignas` joins the not-a-function shield.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 19, 2026 04:05
@squid-protocol
squid-protocol enabled auto-merge (squash) October 19, 2026 04:11
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit cbf3bf7 into main Oct 19, 2026
96 of 98 checks passed
@squid-protocol
squid-protocol deleted the churn/5462-20261019T0331Z branch October 19, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant