Skip to content

Clear the compiler warnings in BGEN's own sources - #6

Merged
dbolser merged 2 commits into
mainfrom
fix/compiler-warnings
Jul 30, 2026
Merged

Clear the compiler warnings in BGEN's own sources#6
dbolser merged 2 commits into
mainfrom
fix/compiler-warnings

Conversation

@dbolser

@dbolser dbolser commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Revives the work from #3 (and its duplicate #2), re-indented and verified.

Upstream 1.1.7 emits 45 warnings under -Wall -pedantic with GCC 13, 23 of them
in BGEN's own sources, which buries anything new in the noise.

file before after
genfile/include/genfile/bgen/bgen.hpp 18 0
test/unit/test_variant_data_block.cpp 3 0
src/View.cpp 1 0
apps/bgenix.cpp 1 0
vendored boost / sqlite3 / zstd 22 11

Changes

  • bgen.hpp — spell the allele count uint32_t( pack.numberOfAlleles ) in
    the phased-parsing path, matching the idiom already used a few lines above.
    numberOfAlleles is a uint16_t, so numberOfAlleles - 1 promoted to int
    and the comparison converted it straight back to unsigned; the cast makes
    explicit what was already happening. This single site accounts for 18 of the
    23 warnings, instantiated across translation units.
  • View.cpp — compare gcount(), a signed std::streamsize, with a
    std::size_t explicitly.
  • bgenix.cppvalueSize is only ever compared against
    std::string::size(), so declare it std::size_t.
  • test_variant_data_block.cpp — catch BGenError const& rather than by
    value in REQUIRE_THROWS_AS, which was slicing a polymorphic type.
  • 3rd_party/*/wscript — build the vendored libraries with -w instead of
    chasing individual -Wno- flags for code we do not maintain.

Verification

Every change is a type or spelling change, so this should be invisible at
runtime — and is:

  • bgen_to_vcf produces byte-identical output for all 68 files in
    example/
    , comparing a build of main against this branch.
  • bgenix -list output is identical for example.16bits.bgen,
    haplotypes.bgen and complex.bgen, the last two covering the phased and
    multiallelic paths that the bgen.hpp change touches.
  • Unit tests unchanged at 1,950,006 assertions; the Python suite passes.

Notes

  • The hunks on Fix compiler warnings #3 were space-indented into tab-indented files, so they read as
    whole-line rewrites. These are re-indented with tabs, leaving a diff that
    shows the tokens that actually changed.
  • AGENTS.md is rewritten rather than restored — the version on Fix compiler warnings #3 predated the
    Python packaging and pytest suite.
  • The 11 remaining warnings are boost headers included by our own translation
    units, which a flag on the boost target cannot reach. Building those includes
    with -isystem would clear them; that is a larger change to how include paths
    propagate, so it is left out here.
  • Version goes to 1.1.7.post2 and PATCHES.md records the new deltas, per the
    scheme in the README. Nothing publishes until a v1.1.7.post2 tag is pushed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JBPj5da6i7reenMxoSdyjW

Summary by CodeRabbit

  • Bug Fixes

    • Improved parsing of probability data for variants with more than two alleles.
    • Fixed compatibility issues with modern C++ compilers.
    • Improved validation of malformed data and exception handling in tests.
  • Build Improvements

    • Reduced warning noise from bundled third-party components.
  • Documentation

    • Added repository build, testing, layout, and contribution guidance.
    • Updated patch notes and released version metadata to 1.1.7.post2.

Upstream 1.1.7 emits 45 warnings under -Wall -pedantic with GCC 13, 23 of them
in BGEN's own sources, which buries anything new in the noise.

- bgen.hpp: spell the allele count uint32_t( pack.numberOfAlleles ) in the
  phased-parsing path, matching the idiom used a few lines above.
  numberOfAlleles is a uint16_t, so 'numberOfAlleles - 1' promoted to int and
  the comparison converted it straight back to unsigned; the cast makes
  explicit what was already happening.  This one site accounts for 18 of the
  23, instantiated across translation units.
- View.cpp: compare gcount(), a signed streamsize, with a size_t explicitly.
- bgenix.cpp: valueSize is only compared against std::string::size(), so
  declare it std::size_t.
- test_variant_data_block.cpp: catch BGenError by const reference rather than
  by value, which was slicing a polymorphic type.
- 3rd_party: build vendored boost, sqlite3 and zstd with -w rather than
  chasing individual -Wno- flags for code we do not maintain.

Every change is a type or spelling change.  bgen_to_vcf produces byte-identical
output for all 68 files in example/ before and after, and the unit tests are
unchanged at 1950006 assertions.  A clean build goes from 45 warnings to 11,
none of them in our own sources -- the rest are boost headers included by our
translation units, which a flag on the boost target cannot reach.

This revives the work from #3, re-indented with tabs to match the surrounding
files, so the diff against upstream shows the tokens that actually changed.
AGENTS.md is rewritten rather than restored, since the original predated the
Python packaging and test suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JBPj5da6i7reenMxoSdyjW
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dbolser, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a6d3f60a-d9f0-4eb5-a6b7-22be6d54b059

📥 Commits

Reviewing files that changed from the base of the PR and between 3a7ced7 and 75225d3.

📒 Files selected for processing (1)
  • AGENTS.md
📝 Walkthrough

Walkthrough

The changes fix several compiler-warning and type issues, suppress warnings from vendored dependencies, update tests and patch notes, advance the package version to 1.1.7.post2, and add repository contributor guidance.

Changes

Warning cleanup and packaging

Layer / File(s) Summary
C++ warning and parsing fixes
genfile/include/genfile/bgen/bgen.hpp, apps/bgenix.cpp, src/View.cpp, test/unit/test_variant_data_block.cpp, PATCHES.md
Probability parsing bounds, size types, stream-size comparison, exception expectations, and related warning-fix notes are updated.
Vendored warning suppression
3rd_party/boost_1_55_0/wscript, 3rd_party/sqlite3/wscript, 3rd_party/zstd-1.1.0/wscript, PATCHES.md
Vendored Boost, SQLite, and zstd builds add -w warning suppression, with the configuration deviation documented.
Release metadata and contributor guidance
pyproject.toml, AGENTS.md, PATCHES.md
The package version advances to 1.1.7.post2, and build, test, style, patch, and packaging guidance is added or revised.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: reducing compiler warnings in BGEN, though it omits the vendored-library warning suppression and version bump.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/compiler-warnings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 10-13: Update all four shell command fences in AGENTS.md to
include a shell language identifier on each opener, using sh or console
consistently while preserving the existing commands.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2d301b18-8cf4-4e10-9c89-f4e98d7f35a8

📥 Commits

Reviewing files that changed from the base of the PR and between 1ae6cad and 3a7ced7.

📒 Files selected for processing (10)
  • 3rd_party/boost_1_55_0/wscript
  • 3rd_party/sqlite3/wscript
  • 3rd_party/zstd-1.1.0/wscript
  • AGENTS.md
  • PATCHES.md
  • apps/bgenix.cpp
  • genfile/include/genfile/bgen/bgen.hpp
  • pyproject.toml
  • src/View.cpp
  • test/unit/test_variant_data_block.cpp

Comment thread AGENTS.md Outdated
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JBPj5da6i7reenMxoSdyjW
@dbolser
dbolser merged commit 876cc20 into main Jul 30, 2026
3 checks passed
@dbolser
dbolser deleted the fix/compiler-warnings branch July 30, 2026 11:15
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.

1 participant