fix: resolve all compiler warnings in Release build#400
Merged
Conversation
- Remove unused variables: x_acc (coding_units.cpp), stride4 and t2 (ht_block_encoding_avx512.cpp) - Check fread return value (main_jpip_benchmark.cpp) - Add explicit cast for int-to-size_t sign conversion (j2kmarkers.cpp) - Fix misleading indentation: split same-line if/assignment (jpip_index_check/main.cpp) - Add ptrdiff_t cast for size_t-to-difference_type conversion (jpip_parser_check/main.cpp) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Cleans up GCC Release-build warnings by removing unused variables, checking a previously discarded fread return, adding explicit casts for sign/width conversions, and reformatting a confusingly-indented if/assignment chain.
Changes:
- Remove unused locals (
x_acc,stride4,t2). - Add explicit
static_castfor sign andptrdiff_tconversions; checkfreadreturn value. - Split combined
if/assignment statements onto separate lines in the JPIP index check parser.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| source/core/coding/coding_units.cpp | Drop unused x_acc in line-based encoder loop. |
| source/core/coding/ht_block_encoding_avx512.cpp | Drop unused stride4 constant and t2 temporary in AVX-512 cleanup encode. |
| source/core/codestream/j2kmarkers.cpp | Wrap TLM entry_size expression in static_cast<size_t> to silence sign-conversion warning. |
| source/apps/jpip_benchmark/main_jpip_benchmark.cpp | Check fread return value and return empty buffer on partial read. |
| tests/tools/jpip_index_check/main.cpp | Split same-line if/assignment statements into separate lines. |
| tests/tools/jpip_parser_check/main.cpp | Cast iterator offset to ptrdiff_t for sign-conversion compliance. |
💡 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.
Summary
x_accin coding_units.cpp,stride4andt2in ht_block_encoding_avx512.cppfreadreturn value instead of discarding it (main_jpip_benchmark.cpp)static_cast<size_t>for int-to-size_t sign conversion (j2kmarkers.cpp)if/assignment onto separate lines (jpip_index_check/main.cpp)static_cast<ptrdiff_t>for size_t-to-difference_type conversion (jpip_parser_check/main.cpp)Clean Release build now produces zero warnings with GCC.
Test plan
cmake --buildproduces zero warnings🤖 Generated with Claude Code