Skip to content

fix: resolve all compiler warnings in Release build#400

Merged
osamu620 merged 1 commit into
mainfrom
fix/compiler-warnings
May 27, 2026
Merged

fix: resolve all compiler warnings in Release build#400
osamu620 merged 1 commit into
mainfrom
fix/compiler-warnings

Conversation

@osamu620

Copy link
Copy Markdown
Owner

Summary

  • Remove unused variables: x_acc in coding_units.cpp, stride4 and t2 in ht_block_encoding_avx512.cpp
  • Check fread return value instead of discarding it (main_jpip_benchmark.cpp)
  • Add explicit static_cast<size_t> for int-to-size_t sign conversion (j2kmarkers.cpp)
  • Fix misleading indentation: split same-line if/assignment onto separate lines (jpip_index_check/main.cpp)
  • Add 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 --build produces zero warnings
  • 402/402 tests pass

🤖 Generated with Claude Code

- 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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_cast for sign and ptrdiff_t conversions; check fread return 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.

@osamu620 osamu620 merged commit c1cddab into main May 27, 2026
10 checks passed
@osamu620 osamu620 deleted the fix/compiler-warnings branch May 27, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants