Remove the unused loop counter in printSpeed - #66
Merged
galekseev merged 1 commit intoAug 8, 2026
Conversation
clang warns on every build: Dispatcher.cpp:547:16: warning: variable 'i' set but not used [-Wunused-but-set-variable] The counter is a leftover. It was introduced in 89ed68c (2018-03-11) and was read at the time, supplying the GPU label via toString(i). The very next day e46719d switched that to toString(e->m_index) so the printed index would match the device index rather than the vector position, but left the counter and its increment behind. Nothing has read it since. gcc does not report this even with -Wall -Wextra, because it treats ++i as a read of i. clang follows the def-use chain and sees the value never escapes. That is why the warning only shows up on macOS builds, where g++ is clang. Dispatcher.o is byte-identical before and after in both the release and the PROFANITY_DEBUG configuration, so the compiler was already discarding the counter. Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
galekseev
deleted the
cursor/remove-unused-loop-counter-in-printspeed-9783
branch
August 8, 2026 18:53
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
printSpeedkeeps a loop counter that nothing reads, and clang warns about it on every build:The counter is a leftover. It was introduced in 89ed68c (2018-03-11) and was read at the time, supplying the GPU label via
toString(i). The very next day e46719d switched that totoString(e->m_index)so the printed index would match the device index rather than the vector position, but left the counter and its increment behind. Nothing has read it since.gcc does not report this even with
-Wall -Wextra, because it treats++ias a read ofi. clang follows the def-use chain and sees the value never escapes, which is why the warning only shows up on macOS builds, whereg++is clang.Test plan
Dispatcher.ois byte-identical before and after, in both the release and thePROFANITY_DEBUGconfiguration, so the compiler was already discarding the counterMade with Cursor