Skip to content

src: remove dead code CodeQL flagged (2 unused locals, 1 empty if) - #57

Merged
schivei merged 1 commit into
mainfrom
cleanup-codeql-dead-code
Oct 7, 2026
Merged

schivei merged 1 commit into
mainfrom
cleanup-codeql-dead-code

Conversation

@schivei

@schivei schivei commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Acts on three true-positive findings from minicompiler/codeql-mc's queries over src/*.mc (the new mc scanning job, PR #56):

  • 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 (a chain of token-id comparisons).
  • builtin.mc the first flag and its empty if (first) {} — set, never meaningfully read. The st64(mm+16,res) / k=1 side effects in the same if (res) {...} are kept.

Behavior-preserving dead-code removal. The two remaining empty-control-body warnings are intentional idioms, not bugs, and are left as-is: ns.mc group-use if (ph_accept("\\",1)) {} (consume-if-present, the side effect is in the condition) and rc.mc an empty first branch of an if/else-if dispatch chain.

Gate: mc build + tests/fixtures.sh green locally (the differential gate exercises max/min and the class/expr parse paths).

🤖 Generated with Claude Code

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>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 01:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/min lowering.
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.

@schivei
schivei merged commit 09cf038 into main Oct 7, 2026
13 checks passed
@schivei
schivei deleted the cleanup-codeql-dead-code branch October 7, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants