[ML] Fix compiler warnings across the codebase#2985
Draft
edsavage wants to merge 5 commits intoelastic:mainfrom
Draft
[ML] Fix compiler warnings across the codebase#2985edsavage wants to merge 5 commits intoelastic:mainfrom
edsavage wants to merge 5 commits intoelastic:mainfrom
Conversation
Reduce Clang warnings from ~2500 to 86 (all remaining are -Wunsafe-buffer-usage which require a std::span migration). Compiler flag suppressions (clang.cmake): - -Wno-switch-default: conflicts with the more useful -Wswitch-enum - -Wno-nrvo: purely informational C++23 diagnostic - -Wno-missing-noreturn: remaining cases are lambdas where [[noreturn]] cannot be applied pre-C++23 Code fixes across 59 files: - Remove 37 unused const variables (dead code from state serialisation refactors) - Remove 2 unused functions and 2 unused-but-set variables - Fix 9 shadow warnings by renaming inner variables - Fix 8 implicit int-to-float conversions with static_cast - Fix 2 tautological-compare logic bugs where the condition !(p >= 0.0 || p <= 1.0) was always false - Remove 2 redundant default cases in exhaustive enum switches - Fix 1 pessimizing-move, 1 range-loop-bind-reference, 1 sign-compare, 1 shorten-64-to-32, 1 CTAD issue - Remove unnecessary virtual from method in final class - Add [[noreturn]] to named function throws() - Add missing newline at EOF Made-with: Cursor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Made-with: Cursor
Made-with: Cursor # Conflicts: # bin/pytorch_inference/Main.cc
Change [=] to [this, f] in CConcurrentWrapper to silence -Wdeprecated on GCC 13 and Clang. Made-with: Cursor
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.
Summary
-Wunsafe-buffer-usage, which require astd::spanmigration and are out of scope here).clang.cmake:-Wno-switch-default(174 warnings) — conflicts with the more useful-Wswitch-enum; addingdefault:to exhaustive enum switches would suppress missing-case detection when new enum values are added.-Wno-nrvo(19 warnings) — purely informational C++23 diagnostic about NRVO eligibility.-Wno-missing-noreturn(5 warnings) — all remaining cases are lambdas where[[noreturn]]cannot be applied pre-C++23.constvariables (dead code from state serialisation refactors).calibrationExperiment,dataGeneratorin tests) and 2 unused-but-set variables.static_cast<double>().!(p >= 0.0 || p <= 1.0)was always false — corrected to!(p >= 0.0 && p <= 1.0).default:cases in exhaustive enum switches.virtualfrom method infinalclass.[[noreturn]]to named functionthrows().Test plan
clang-formatcheck passesMade with Cursor