Skip to content

C call graph: a function-like macro's #if variants call the union of their callees (Part of #7828) - #8377

Merged
squid-shepherd[bot] merged 7 commits into
mainfrom
churn/7828-20261112T2019Z
Nov 12, 2026
Merged

squid-shepherd[bot] merged 7 commits into
mainfrom
churn/7828-20261112T2019Z

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Part of #7828 (continues #8364).

What

c_macro_body_calls recorded None (a macro that links nothing) when one file defines a function-like macro twice with different callees, which is what an #if / #else ladder does. The engine does not evaluate #if, so the macro calls the union of its variants' callees when every variant calls something (as #8364 does for object-like aliases). A variant that calls nothing (linuxdoom #define SHORT(x) (x) beside the SwapSHORT one) keeps the macro ambiguous: libclang may build that variant. A signature macro stays None; a macro two different files define differently stays ambiguous.

Class / Sibling gaps

Class: a C call written through a preprocessor name does not link to the function the expansion calls. Members handled here: a function-like macro redefined under #if variants in one file with different callees (the openssl OPENSSL_free / ERR_raise_data shapes are in the tests). Already handled earlier: object-like alias (#8364), single-body function-like macro (#6770).
Sibling gaps (no burned estate needs any; C-only call-graph work):

  • Macros defined in .h.in template headers (openssl crypto.h.in, err.h.in): .in is not in GalaxyScope._C_SOURCE_EXTS, so their macro bodies are not read. Not measured here (openssl is not a local corpus); may also be blocked in aperture. Needs a measurement on an openssl checkout.
  • A macro two files define differently stays ambiguous (None); linking it needs a per-unit include view.
  • Functions that exist only after preprocessing (token pasting, generator macros): out of scope per the issue.

Evidence

  • call_graph_resolution.py c --ci (libclang 18.1.1, curl): confident precision 100.0%, recall 50.8 -> 51.0%, resolution recall 55.3 -> 55.4%, confident_judged 6756 -> 6781. Baseline regenerated.
  • Golden masters: only calls_out_to / fan_in / fan_out / pagerank / graph_sqlite / llm_brief moved, from the added macro callees (e.g. godot ERR_FAIL_COND_V_MSG's variants).
  • Fix round (call-graph-accuracy-audit red): the first version unioned a no-op variant too; libclang rejected those edges (c/cpp callee precision 97.7 -> 96.6 / 97.9 -> 96.3, linuxdoom 50 disagreements). Narrowed as above: call_graph_accuracy.py --ci passes, linuxdoom is back to 2 disagreements (precision .9968).
  • DOOM-rosetta clang scoring, main's engine vs this head (nugget-doom / woof): recall .9848 -> .9979 / .9818 -> .9963 (+128 / +~130 confirmed edges), clean-file disagreements unchanged (3 / 3), precision .9819 -> .9758 / .9787 -> .9744: the extra engine-only edges are in libclang-fatal files it cannot adjudicate. Baseline re-written (--write-baseline) knowing that trade; the oracle unions one file's variants by the same rule. Goldens, C baseline (confident_judged 6756, recall 50.8) re-blessed.
  • Tests: test_macro_body_calls_6770.py (ladder union, empty variant, three-way ladder, OPENSSL_free/ERR_raise_data shapes, signature variant kept None, cross-file stays None), test_callgraph_oracle.py. audit_check.py: all clear.

Lessons for agents

  • doom_rosetta_check.py fails with large callgraph_engine_only after an engine macro change until callgraph_oracle.macro_body_callees applies the same rule; fix the oracle, don't bless.
  • The first ~/.cache/gitgalaxy/ruff-* glob entry is not the pinned ruff; use pr_gates --fast or read the pin.

Cross-repo: none.

🤖 Generated with Claude Code

squid-protocol and others added 2 commits November 12, 2026 15:22
…their callees (Part of #7828)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…iant macro union (Part of #7828)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 12, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

1 similar comment
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 12, 2026 20:51
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 12, 2026 20:52
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd
squid-shepherd Bot disabled auto-merge November 12, 2026 20:56
@squid-shepherd

Copy link
Copy Markdown
Contributor

PR #8377 @ 1212ec0: 1 failed check(s)

== call-graph-accuracy-audit (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/43304519029/job/131484292169
repro: python tests/tools/pr_gates.py --fast
errors:
2026-11-12 20:52:48,381 [WARNING] [GalaxyScope] ┃ (--fail-on-malware cannot fire). Rule-based threats still run. ┃
##[error]Process completed with exit code 1.
log tail:
swift FP: [('doNotRetryWithError', 1), ('request', 1), ('resumeData', 1)]
FN: [('write', 27), ('async', 23), ('forEach', 5), ('$0', 3), ('indentingNewlines', 3), ('requestModifier', 3), ('map', 2), ('mapError', 1)]
lua FP: [('f', 3), ('assert', 2), ('write', 2), ('format', 1), ('f2', 1), ('x', 1), ('add', 1), ('012345678901234567890123456789012345678901234567890123456789', 1)]
FN: [('collectgarbage', 6), ('assert', 3), ('error', 2), ('dummy', 1), ('print', 1), ('f', 1), ('getlocal', 1), ('exit', 1)]
zig FP: [('volatile', 10), ('intCast', 5), ('assert', 4), ('get', 4), ('parseInt', 3), ('tagName', 3), ('as', 3), ('resolve', 3)]
FN: [('import', 62), ('await', 9), ('ensureUnusedCapacity', 2), ('assert', 2), ('tagName', 2), ('slice', 2), ('view', 2), ('items', 2)]
dart FP: [('identical', 6), ('StatefulElement', 3), ('
', 2), ('constructor', 2), ('ScrollNotification', 1), ('ScrollEndNotification', 1), ('ScrollStartNotification', 1), ('MapEntry', 1)]
FN: [('objectRuntimeType', 8), ('describeIdentity', 4), ('debugGetCreatorChain', 3), ('toStringShort', 2), ('join', 1), ('contains', 1), ('_stringify', 1), ('shortHash', 1)]
haskell FP: [('Just', 6), ('map', 4), ('null', 4), ('Para', 4), ('Str', 4), ('pack', 3), ('break', 3), ('go', 3)]
FN: [('cycle', 1), ('rawMd', 1), ('Str', 1)]
perl FP: [('undef', 154), ('grep', 16), ('wantarray', 14), ('time', 13), ('map', 6), ('x', 6), ('E', 5), ('ord', 4)]
FN: [('new', 12), ('print', 7), ('-f', 5), ('join', 5), ('name', 4), ('say', 4), ('warn', 4), ('-d', 4)]
solidity FP: [('address', 10), ('bytes32', 4), ('add', 3), ('gas', 3), ('mload', 3), ('bytes', 3), ('GovernorDisabledDeposit', 3), ('onlyRole', 2)]
FN: [('call', 2), ('require', 1)]
apex FP: [('COUNT', 6), ('runAs', 4), ('SUM', 1), ('AND', 1)]
FN: [('List', 4), ('Map', 3)]
powershell FP: [('Name', 6), ('Url', 6), ('Output', 4), ('PSModuleRestore', 4), ('Configuration', 4), ('Runtime', 4), ('ForMinimalSize', 4), ('Inconclusive', 4)]
FN: [('Join-Path', 127), ('Test-Path', 121), ('Get-Content', 57), ('ForEach-Object', 55), ('new', 44), ('Split-Path', 44), ('Where-Object', 36), ('Select-Object', 32)]
tcl FP: [('set', 218), ('expr', 41), ('regexp', 26), ('msgcat::mc', 17), ('registry::entry', 16), ('variants', 13), ('lappend', 7), ('revision', 7)]
FN: [('return', 176), ('variable', 58), ('mc', 35), ('for', 24), ('format', 17), ('error', 16), ('entry', 15), ('switch', 14)]
call_graph_accuracy: REGRESSION
c: precision_pct 97.7 -> 96.6
cpp: precision_pct 97.9 -> 96.3
##[error]Process completed with exit code 1.
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.0
Temporarily overriding HOME='/home/runner/work/_temp/7f698444-5a3c-4176-849b-b0c30ec01fc6' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-shepherd squid-shepherd Bot added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Nov 12, 2026
squid-protocol and others added 3 commits November 12, 2026 16:11
…lls something (Part of #7828)

A variant that calls nothing (linuxdoom's `#define SHORT(x) (x)` beside the SwapSHORT one) means the
call exists only under a configuration the compiler may not build, so libclang rejected the union
edges (call-graph-accuracy-audit, callgraph job). Such a macro stays ambiguous, as before. Goldens,
DOOM-rosetta goldens and the C baseline re-blessed.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…on (Part of #7828)

Against main's engine on nugget-doom and woof the union adds ~128 clang-confirmed edges (recall .985 -> .998) and no new clean-file disagreement; the extra engine-only edges sit in clang-fatal files, which libclang cannot adjudicate (precision .982 -> .976).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-shepherd squid-shepherd Bot removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 12, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (5ef2a99) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd
squid-shepherd Bot marked this pull request as draft November 12, 2026 21:45
@squid-shepherd squid-shepherd Bot added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Nov 12, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Nov 12, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 12, 2026 21:52
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd squid-shepherd Bot added the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 12, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 12, 2026 21:53
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Nov 12, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd squid-shepherd Bot removed the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 12, 2026
@squid-shepherd
squid-shepherd Bot disabled auto-merge November 12, 2026 22:13
@squid-shepherd

Copy link
Copy Markdown
Contributor

PR #8377 @ 5ef2a99: 1 failed check(s)

== callgraph (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/43314509473/job/131518876865
repro: python tests/tools/pr_gates.py --fast
errors:
--baseline tests/tools/doom_speedrun/callgraph_baseline.json --fail-on-regression
##[error]Process completed with exit code 1.
log tail:
dsda-doom clang recall 0.9985 precision 0.9882 over 10674 edges, 22 disagreements in clean files (200 fatal-error files)
fastdoom clang recall 1.0000 precision 0.9711 over 2456 edges, 27 disagreements in clean files (82 fatal-error files)
inter-doom clang recall 1.0000 precision 0.9944 over 13606 edges, 0 disagreements in clean files (258 fatal-error files)
linuxdoom clang recall 1.0000 precision 0.9955 over 1539 edges, 2 disagreements in clean files (2 fatal-error files)
nugget-doom clang recall 0.9979 precision 0.9758 over 9772 edges, 3 disagreements in clean files (199 fatal-error files)
prboom-plus clang recall 0.9975 precision 0.9281 over 4462 edges, 18 disagreements in clean files (106 fatal-error files)
puredoom clang recall 1.0000 precision 0.9957 over 1864 edges, 0 disagreements in clean files (2 fatal-error files)
sdl-doom clang recall 1.0000 precision 0.9878 over 2031 edges, 11 disagreements in clean files (22 fatal-error files)
woof clang recall 0.9963 precision 0.9744 over 8830 edges, 3 disagreements in clean files (198 fatal-error files)
REGRESSION clang linuxdoom: precision 0.9968 -> 0.9955
##[error]Process completed with exit code 1.
##[group]Run cat "$DOOM_SPEEDRUN_WORK"/results//callgraph.md >> "$GITHUB_STEP_SUMMARY" || true
cat "$DOOM_SPEEDRUN_WORK"/results/
/callgraph.md >> "$GITHUB_STEP_SUMMARY" || true
shell: /usr/bin/bash -e {0}
env:
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
DOOM_SPEEDRUN_WORK: /home/runner/work/gitgalaxy/gitgalaxy/../doom-work
pythonLocation: /opt/hostedtoolcache/Python/3.12.16/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.16/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.16/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.16/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.16/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.16/x64/lib
##[endgroup]
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.1
Temporarily overriding HOME='/home/runner/work/_temp/d87606d0-c3b3-461b-a9eb-9671dd27ec97' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-shepherd squid-shepherd Bot added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Nov 12, 2026
squid-protocol and others added 2 commits November 12, 2026 17:15
…bers as CI's libclang reads them (Part of #7828)

CI sees 1539 clang edges on linuxdoom (local 1541) and 13 fatal files on doomgeneric (local 12), with the same disagreements; the gate runs on CI.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-shepherd squid-shepherd Bot removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 12, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (faa7efb) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd
squid-shepherd Bot marked this pull request as draft November 12, 2026 22:22
@squid-shepherd squid-shepherd Bot added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Nov 12, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Nov 12, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

1 similar comment
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 12, 2026 22:25
@squid-shepherd squid-shepherd Bot added the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 12, 2026
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 12, 2026 22:26
@squid-shepherd squid-shepherd Bot removed the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 12, 2026
@squid-shepherd
squid-shepherd Bot merged commit fc5df9f into main Nov 12, 2026
129 of 169 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/7828-20261112T2019Z branch November 12, 2026 22:47
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