Description
Found while verifying #1836/#1837/#1854 (the C/C++ args-bounding and preprocessor-macro fixes) via tests/tools/crucible_check.py's differential scan. Windows SAL (Source-code Annotation Language) macros like _In_, _Out_, _Inout_ prefix parameter declarations in real Windows/PowerToys-style C++ headers (_In_ int nCode, _In_ WPARAM wParam), and gitgalaxy/standards/language_standards.py's cpp args regex requires a real typed-parameter shape after the opening paren -- a leading unrecognized macro token like _In_ doesn't match any of its typed-parameter alternatives, so the whole args_pattern.search() call returns no match at all.
Confirmed repro
from gitgalaxy.standards.language_standards import LANGUAGE_DEFINITIONS
args = LANGUAGE_DEFINITIONS["cpp"]["rules"]["args"]
s = "LRESULT CALLBACK KeyboardHookProc(_In_ int nCode, _In_ WPARAM wParam, _In_ LPARAM lParam)"
print(args.search(s)) # None
powertoys/centralized_kb_hook.cpp::KeyboardHookProc (real arity 3) measures args_count=0 once the signature search is correctly bounded to just the signature (as #1836 now does) -- previously this got a non-zero but still-wrong count purely by accident, from cpp's old unbounded search incidentally matching something else in the function body.
Scope / prevalence
Narrow: only 2 files in the current language-crucible cpp corpus contain SAL-style _In_ /_Out_ /_Inout_ annotations (grep -rlE '_In_ |_Out_ |_Inout_ ' language-crucible/data/cpp/). Not chased as part of #1836/#1837/#1854 since it's a distinct regex gap (unrecognized parameter-type token), not a bounding/preprocessor/depth-counting bug.
Suggested fix
Add _In_, _Out_, _Inout_, _In_opt_, _Out_opt_ (and similar leading-underscore SAL annotation tokens) as an optional, bounded prefix alternative in the cpp/c args regex's typed-parameter branch, mirroring how const/volatile are already handled as optional leading modifiers.
Description
Found while verifying #1836/#1837/#1854 (the C/C++ args-bounding and preprocessor-macro fixes) via
tests/tools/crucible_check.py's differential scan. Windows SAL (Source-code Annotation Language) macros like_In_,_Out_,_Inout_prefix parameter declarations in real Windows/PowerToys-style C++ headers (_In_ int nCode, _In_ WPARAM wParam), andgitgalaxy/standards/language_standards.py's cppargsregex requires a real typed-parameter shape after the opening paren -- a leading unrecognized macro token like_In_doesn't match any of its typed-parameter alternatives, so the wholeargs_pattern.search()call returns no match at all.Confirmed repro
powertoys/centralized_kb_hook.cpp::KeyboardHookProc(real arity 3) measuresargs_count=0once the signature search is correctly bounded to just the signature (as #1836 now does) -- previously this got a non-zero but still-wrong count purely by accident, from cpp's old unbounded search incidentally matching something else in the function body.Scope / prevalence
Narrow: only 2 files in the current
language-cruciblecpp corpus contain SAL-style_In_/_Out_/_Inout_annotations (grep -rlE '_In_ |_Out_ |_Inout_ ' language-crucible/data/cpp/). Not chased as part of #1836/#1837/#1854 since it's a distinct regex gap (unrecognized parameter-type token), not a bounding/preprocessor/depth-counting bug.Suggested fix
Add
_In_,_Out_,_Inout_,_In_opt_,_Out_opt_(and similar leading-underscore SAL annotation tokens) as an optional, bounded prefix alternative in the cpp/cargsregex's typed-parameter branch, mirroring howconst/volatileare already handled as optional leading modifiers.