Extend CPPCHECK scope to portable kernels#20236
Open
perheld wants to merge 1 commit into
Open
Conversation
Remove the broad kernels/portable CPPCHECK exclusion and keep the remaining suppressions scoped to the portable tree. Portable kernel entry points are referenced through generated registration tables, which cppcheck CTU does not see as direct C++ calls. Suppress the resulting unusedFunction reports for this tree. Cppcheck also does not parse several ExecuTorch macro idioms used heavily in portable kernels, including empty macro arguments and printf-style macros concatenated into string literals. Keep those parser suppressions scoped to portable kernels instead of adding inline suppressions throughout the tree. Fix small real findings by removing an impossible unsigned comparison and cleaning up unused test setup plus a stray comma expression. Signed-off-by: Per Held <per.held@arm.com> Change-Id: I6279a123b487d32b5811fdbe46ae4f2e82dcabd5
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20236
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New FailuresAs of commit 9660c90 with merge base 7282106 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the project’s cppcheck lint coverage to include the portable kernel tree by removing the broad kernels/portable/** exclusion and replacing it with targeted, portable-scoped suppressions, while also addressing a few small cppcheck findings in portable-kernel code/tests.
Changes:
- Remove
kernels/portable/**from.lintrunner.tomlcppcheck exclusions and add portable-tree-specific suppressions (e.g., for CTU-drivenunusedFunctionand macro parsing limitations). - Fix a redundant/impossible unsigned comparison in portable copy/permute argument validation.
- Clean up unused test setup and remove a stray comma expression in portable reduce util tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| kernels/portable/cpu/util/test/reduce_test.cpp | Removes unused test variables and a no-op comma expression flagged by static analysis. |
| kernels/portable/cpu/util/copy_ops_util.cpp | Removes a redundant >= 0 check on an unsigned value after prior validation. |
| .lintrunner.toml | Enables cppcheck over kernels/portable/** and scopes necessary suppressions to that tree. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Remove the broad kernels/portable CPPCHECK exclusion and keep the remaining suppressions scoped to the portable tree.
Portable kernel entry points are referenced through generated registration tables, which cppcheck CTU does not see as direct C++ calls. Suppress the resulting unusedFunction reports for this tree.
Cppcheck also does not parse several ExecuTorch macro idioms used heavily in portable kernels, including empty macro arguments and printf-style macros concatenated into string literals. Keep those parser suppressions scoped to portable kernels instead of adding inline suppressions throughout the tree.
Fix small real findings by removing an impossible unsigned comparison and cleaning up unused test setup plus a stray comma expression.
Change-Id: I6279a123b487d32b5811fdbe46ae4f2e82dcabd5
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani