Repository navigation
c/cpp: name macro-defined functions from the #define, repo-wide, keeping the class qualifier (Closes #5563) - #5578
Conversation
…the class qualifier (Part of #5563) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… of #5563) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
No description provided. |
|
PR #5578 @ 9b036f4: 2 failed check(s) == Call resolution (Level 2, vs scip-java) (failure) -- real == tree-sitter-accuracy-audit (failure) -- real |
|
CI shepherd: the head of this PR (3930405) is not the one a maintainer labelled |
|
No description provided. |
|
PR #5578 @ 3930405: 3 failed check(s) == Call resolution (Level 2, vs scip-java) (failure) -- real == graph-accuracy-audit (failure) -- real == tree-sitter-accuracy-audit (failure) -- main |
|
PR #5578 @ 3930405: 3 failed check(s) == Call resolution (Level 2, vs scip-java) (failure) -- real == graph-accuracy-audit (failure) -- real == tree-sitter-accuracy-audit (failure) -- main |
What
A C/C++ macro-defined function (the #5461
func_startmacro branch) is now named from its#defineinstead of from a lexical guess about its arguments. The table is built repo-wide.{. The parameter token-pasted into that declarator (or used as it) names the function:Handler_ ## namegivesname. Any other parameter pasted into the same declarator is a qualifier:AF_##cls##_##namegivescls::name.Orchestrator._c_repo_macro_argsreads the scan's headers (.h/.hh/.hpp/.hxx/.inl/.ipp, counting a delta scan's cached files) before Pass 1. Each worker gets the table through_init_worker. A file's own defines win over the headers'. Variants that disagree record no rule.C_MACRO_FIRST_ARG_NAMES.Closes #5563 (slice 1 + the qualifier).
Class sweep (same mechanism: an argument picked without reading the
#define)CONSOLE_COMMAND / VARIABLE / NETVAR / NETCMDDEFINE_ACTION_FUNCTION(_NATIVE)name; 78 names shared by more than one classcls::name; 0 sharedDEFINE_ACTION_FUNCTION(_PARAMS)namename(unchanged and correct: the define pastes onlyAF_##name)Evidence
DOOM harness: 39 ports, engine
cbf3bf726(main) vsa3e3b61f6(this branch),GITGALAXY_DISABLE_GIT_HISTORY=1.doom_clang.pyflags; the 12 densest files per port):CONSOLE_COMMANDCONSOLE_VARIABLECONSOLE_NETVARCONSOLE_NETCMDDEFINE_ACTION_FUNCTION_NATIVEcls::(DShape2DTransform::Clear⊂AF_DShape2DTransform_Clear)DEFINE_ACTION_FUNCTIONcls::Examples (main → branch, clang):
source/g_cmd.cpp:90cf_hidden→z_print(Handler_z_print);source/e_cmd.cpp:366cf_level→e_listmapthings.macro_audit.pyis not on disk. A scratch re-implementation (column-0^[A-Z][A-Z0-9_]{2,}\(args\)+{vsfunction_datastart lines, named by an argument) gives 5,377 / 5,777 on both main and the branch: no regression. The denominator differs from the issue's 6,449 because the regex is reconstructed.crucible_check.py: full_precision PASS, zero_dependency PASS (zero drift, no bless).tree_sitter_accuracy_audit --lang c --ciand--lang cpp --ci: OK (= baseline).pr_gates.py --fast: 6/6 PASS.test_source_reads,test_galaxyscope,test_inline_extraction,test_generated_fastlane_3188, C/C++ function-defining macros are not counted as functions (6,074 of 6,437 in the DOOM corpus: DEFINE_ACTION_FUNCTION, CCMD, FUNC(...)) #5461 macro tests and the newtest_c_macro_define_names_5563.py(21) pass.Limits (documented, not fixed)
#definechanges, unchanged files that use it keep their cached names until they are re-parsed.TEST, doomsdayD_CMD) keeps the old invocation rule.BEGIN_COMMAND: class +Run+ registrar) stays one function, as the issue scoped.C_MACRO_FIRST_ARG_NAMESis kept as the fallback for absent headers.Lessons for agents
tests/test_source_reads.py(Decoding foundation: read_source (BOM / strict UTF-8 / UTF-16 / declared / cp1252-Latin-1 fallback), per-file source_encoding, no errors=ignore anywhere (lint gate) #3813) rejects any text-modeopen(..., errors="ignore")of estate files ingalaxyscope.py. Read them withgitgalaxy.core.source_text.read_source(path, limit=...).text._init_workerinitarg and install it as a module global that is reset on every init. The_InlineExecutorpath calls the same initializer, so serial and pooled scans agree.🤖 Generated with Claude Code