Skip to content

C++: Fix FP in cpp/unused-local-variable - #23265

Open
jketema wants to merge 3 commits into
mainfrom
jketema/local-fix
Open

jketema wants to merge 3 commits into
mainfrom
jketema/local-fix

Conversation

@jketema

@jketema jketema commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added the C++ label Nov 26, 2026
@jketema
jketema marked this pull request as ready for review November 26, 2026 17:14
@jketema
jketema requested a review from a team as a code owner November 26, 2026 17:14
Copilot AI adaptive review requested due to automatic review settings November 26, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the change excluding compiler-generated variables from unused-local-variable results.

No open issues 🎉

What changed in this PR

Fixes a false positive in the C++ cpp/unused-local-variable query by excluding compiler-generated variables, including placeholders for empty function parameter packs.

Changes:

  • Filters out compiler-generated local variables.
  • Adds a regression case for an empty parameter pack.
  • Documents the analysis improvement in a change note.
File Description
cpp/​ql/​test/​query-tests/​Best Practices/​Unused Entities/​UnusedLocals/​code2.cpp Adds an empty parameter-pack regression case.
cpp/​ql/​src/​change-notes/​2026-11-26-unused-local-variable-compiler-generated.md Documents the false-positive fix.
cpp/​ql/​src/​Best Practices/​Unused Entities/​UnusedLocals.ql Excludes compiler-generated variables from results.

Review effort: Balanced (adaptive)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants