Repository navigation
src: remove dead code CodeQL flagged (2 unused locals, 1 empty if) - #57
Merged
Merged
Conversation
minicompiler/codeql-mc's queries over src/*.mc, three true positives:
- class.mc: 'i64 save = ph_tid;' never read (ph_tid is a pure field read).
- expr.mc: 'i64 arop = ph_arith_op(t);' never read (ph_arith_op is pure).
- builtin.mc: the 'first' flag and its empty 'if (first) {}' -- set, never
meaningfully read; the st64/k=1 side effects in the same if are kept.
Behavior-preserving. The two remaining empty-body warnings (ns.mc group-use
consume-if-present, rc.mc empty dispatch branch) are intentional idioms.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
All removed expressions are side-effect-free or unused, while the functional state updates remain intact.
Review effort: Balanced
Findings: None
What changed in this PR
Removes three CodeQL-confirmed dead-code findings without changing behavior.
Changes:
- Removes unused locals from expression and class parsing.
- Removes an unused flag and empty conditional from
max/minlowering.
| File | Description |
|---|---|
src/expr.mc |
Removes an unused arithmetic-operation result. |
src/class.mc |
Removes an unused token-ID snapshot. |
src/builtin.mc |
Removes the unused first flag and empty branch. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Acts on three true-positive findings from
minicompiler/codeql-mc's queries oversrc/*.mc(the newmcscanning job, PR #56):class.mci64 save = ph_tid;— never read;ph_tidis a pure field read.expr.mci64 arop = ph_arith_op(t);— never read;ph_arith_opis pure (a chain of token-id comparisons).builtin.mcthefirstflag and its emptyif (first) {}— set, never meaningfully read. Thest64(mm+16,res)/k=1side effects in the sameif (res) {...}are kept.Behavior-preserving dead-code removal. The two remaining
empty-control-bodywarnings are intentional idioms, not bugs, and are left as-is:ns.mcgroup-useif (ph_accept("\\",1)) {}(consume-if-present, the side effect is in the condition) andrc.mcan empty first branch of an if/else-if dispatch chain.Gate:
mc build+tests/fixtures.shgreen locally (the differential gate exercisesmax/minand the class/expr parse paths).🤖 Generated with Claude Code