Fix the Clang-Tidy warnings flagged by Android Studio - #30
Merged
Conversation
All 66 warnings from the default inspection profile, no behavior change:
- narrowing int/uint32_t-to-float conversions: explicit (float) casts
- uninitialized record types: default member initializers on the small
POD structs (Alien, Bullet, Bomb, Saucer, PowerUp, Particle, Explosion,
Star, Pointer, DrawCmd) and {} on the fread buffers / timespec
- fireHeld: loop replaced with std::any_of
- mergeHighScore: index loop replaced with a range-based for
- emit and the draw helpers made const, numDigits made static
Intentional identifiers flagged as typos (frand, SINV, octo, ...) are
left as-is on purpose.
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.
Fixes all the Clang-Tidy warnings that Android Studio's default inspection profile reports on the native sources (app code and tests), with no behavior change:
(float)casts, matching the existing cast style.Alien,Bullet,Bomb,Saucer,PowerUp,Particle,Explosion,Star,Pointer,DrawCmd), plus{}on the high-scorefreadbuffers and thetimespecinnow_s().fireHeld()now usesstd::any_of.mergeHighScore()is now a range-based for.emit()and all the draw helpers are nowconst(they only append to the caller'sDrawCmdlist),numDigits()is static.NOLINT— the stub ignoresthis, but the realAudioEngine::initin audio.cpp can't be static, so the suggestion is a stub-only false positive.The words flagged as typos (
frand,SINV,octo,highscores, …) are intentional identifiers and are deliberately left unchanged.Verified with clang-tidy from NDK r29 (same checks + project-wide header filter: 0 warnings after),
externalNativeBuildDebug,runNativeTestson the Fold AVD (103/103 pass), and an on-emulator smoke run — the title screen renders identically.