Repository navigation
cpp: count definitions with a post-parameter tail (THROWS, noexcept(x), throw(), -> decltype) (Part of #5462) - #5572
Merged
Conversation
…), 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]>
Owner
Author
|
No description provided. |
squid-protocol
marked this pull request as ready for review
October 19, 2026 04:05
squid-protocol
enabled auto-merge (squash)
October 19, 2026 04:11
Contributor
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.
Part of #5462 (the psydoom C++ undercount left after #5495).
Class: the post-parameter tail of a function definition (between
)and{)func_startitem 8 only acceptedconst/volatile/ barenoexcept/override/final/&/&&/__attribute__/[[attr]]and a plain-> T. Any other token there dropped the whole definition. psydoom'sMBlockBitStream.cppputsTHROWSon every method (3 of 19 counted).))readBit() THROWS {,ASIO_NOEXCEPT,Q_DECL_OVERRIDE,VULKAN_HPP_NOEXCEPTnoexcept(expr)noexcept(sizeof(T) > 4)throw(),throw(A, B)-> const char*,-> std::map<int, int>-> decltype(...)-> decltype(std::forward<T>(x))requiresclausef(T t) requires Foo<T> {f() try {const,& noexcept,override final,[[attr]]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(.alignasjoins the not-a-function shield (struct alignas(16) VEC {).Evidence
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_startmatch 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, sol2noexcept(...),-> decltype).call(x) MACRO {inside a body still matches. It was rare in the diff.Tests
tests/extraction/languages/test_cpp_post_param_tail.pyhas 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 --fast6/6.--ratchets8/8.golden-lock.sh crucible_check.py --update --yes, both legs): no drift, so no fixture changes. The crucible C++ has none of these shapes.audit_check: all clear.Sibling gaps
f() MY_ATTR(1, 2) {) collide with macro-statement chains and need a different discriminator.c.py) trailing specifier macros (__THROW, glibc style): unchecked.🤖 Generated with Claude Code