Repository navigation
Description
Problem
DOOM ports define large families of functions through macros: DEFINE_ACTION_FUNCTION(AActor, A_Look) { ... }, CCMD(map) { ... }, CUSTOM_CVAR(Int, x, ...) { ... }, odamex FUNC(LS_Door_Open) { ... } where #define FUNC(a) static bool a (line_t *ln, ...). C/C++ func_start (gitgalaxy/standards/language_standards/languages/c.py:138, cpp.py:178) does not anchor on MACRO(name[, ...]) followed by a body, so none of these are functions: their complexity, LOC and calls are invisible or charged to the enclosing file. Universal Ctags misses most of them too, so ctags parity hides the gap.
Corpus measurement (first-party C/C++, line ^[A-Z][A-Z0-9_]{2,}\s*\(\s*name[, ...]\) followed by {): 6,437 definitions, 6,074 missed.
| port | macro defs | missed |
|---|---|---|
| gzdoom | 2,059 | 1,985 |
| zandronum | 1,554 | 1,554 |
| vizdoom | 1,242 | 1,242 |
| doomsday | 621 | 334 |
| eternity | 481 | 481 |
| odamex | 299 | 297 (p_lnspec.cpp: 188 FUNC handlers, GitGalaxy finds 5) |
| doom3-bfg | 155 | 155 |
| srb2 | 25 | 25 |
Class: macro-introduced definitions (top names)
DEFINE_ACTION_FUNCTION 1,473 · CCMD 932 · DEFINE_ACTION_FUNCTION_NATIVE 703 · CUSTOM_CVAR 570 · DEFINE_ACTION_FUNCTION_PARAMS 358 · CONSOLE_COMMAND 242 · BEGIN_COMMAND 234 · DEFINE_ACTION 228 · DEFINE_PROPERTY 220 · D_CMD 203 · DEFINE_MAP_OPTION 179 · DE_PIMPL 157 (class-like, out of scope as function) · DEFINE_CLASS_PROPERTY 156. Also outside DOOM: TEST(...)/TEST_F (gtest), PHP_FUNCTION, Py_* wrappers.
Acceptance
- An all-caps macro invocation at line start whose argument list is followed by a function body
{is recorded as a function (name = the identifier argument; ambiguous multi-arg forms use a documented rule, e.g. last identifier, or the macro name + first arg). - When the macro's
#defineis in the scanned tree and expands to a function signature, use it (odamexFUNC). - Not fired on
if (X(y)) {-style control flow or struct initialisers; DE_PIMPL-style class macros stay out. - Fixture with gzdoom/odamex/gtest shapes; rescan gzdoom/zandronum/odamex: macro-defined handlers present.
Part of #5457 (milestone DOOM Port Speedrun).
Evidence: /srv/storage_16tb/projects/gitgalaxy/doom-study/ — round2_findings.md, clean_check.csv, clean_check_details.json; scans in scans_r2/<port>/ at engine 585c243e9; corpus variants_r2.csv (39 ports, pinned SHAs); scorer scripts/clean_check.py.
🤖 Generated with Claude Code
Activity
ruff format (Part of #5461)
C/C++ macro functions: exclude *MODULE binders (NB_MODULE(name, m)); …
C/C++ macro functions: anchor at column 0; goldens back to main (Part…
C/C++ macro functions: an in-file #define decides (signature = functi…
C/C++: function-defining macros (CCMD, DEFINE_ACTION_FUNCTION, FUNC, …
squid-protocol commentedon Oct 18, 2026
Claimed by promoter-bot host
nyx, lease renewed 2026-10-18T22:38Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove theclaim:nyxlabel.C/C++: DEFINE_PROPERTY / DEFINE_MAP_OPTION / DEFINE_CLASS_PROPERTY na…
squid-protocol commentedon Oct 18, 2026
Acceptance met: #5483 (macro-introduced definitions recorded as functions, same-file #define lookup for FUNC, TEST/gtest, control-flow guard) and #5545 (first-arg naming for DEFINE_PROPERTY/DEFINE_MAP_OPTION/DEFINE_CLASS_PROPERTY). Rescans of gzdoom/zandronum/odamex show the handlers present (odamex FUNC 188). Deliberate limits (column-0 only, same-file #define) are noted in the PRs and can be filed separately if a port needs them.