mbox series

[00/10] reftable: fix -Wsign-compare warnings

Message ID 20250116-b4-pks-reftable-sign-compare-v1-0-bd30e2ee96e7@pks.im (mailing list archive)
Headers show
Series reftable: fix -Wsign-compare warnings | expand

Message

Patrick Steinhardt Jan. 16, 2025, 10:08 a.m. UTC
Hi,

during the last steps of converting the reftable codebase to become a
standalone library I noticed that the new -Wsign-compare warnings
created a bit of a problem due to the `DISABLE_SIGN_COMPARE_WARNINGS`
macro that we started using. As a consequence I wasn't able to easily
drop "git-compat-util.h" anymore. This patch series is thus addresses
the issue by fixing all sign comparison warnings in the reftable
library.

Thanks!

Patrick

---
Patrick Steinhardt (10):
      meson: stop disabling -Wsign-compare
      reftable/record: drop unused `print` function pointer
      reftable/record: handle overflows when decoding varints
      reftable/basics: adjust `common_prefix_size()` to return `size_t`
      reftable/basics: adjust `hash_size()` to return `uint32_t`
      reftable/block: adapt header and footer size to return a `size_t`
      reftable/block: adjust type of the restart length
      reftable/blocksource: adjust type of the block length
      reftable/blocksource: adjust `read_block()` to return `ssize_t`
      reftable: address trivial -Wsign-compare warnings

 meson.build                         |   1 -
 reftable/basics.c                   |  10 ++--
 reftable/basics.h                   |   4 +-
 reftable/block.c                    |  20 +++----
 reftable/block.h                    |  14 ++---
 reftable/blocksource.c              |   8 +--
 reftable/reader.c                   |  32 +++++-----
 reftable/reader.h                   |   6 +-
 reftable/record.c                   | 116 ++++++++++++++++--------------------
 reftable/record.h                   |  23 +++----
 reftable/reftable-blocksource.h     |  13 ++--
 reftable/reftable-record.h          |   4 +-
 reftable/reftable-writer.h          |   2 +-
 reftable/stack.c                    |  12 ++--
 reftable/system.h                   |   2 -
 reftable/writer.c                   |   7 +--
 t/unit-tests/t-reftable-basics.c    |   2 +-
 t/unit-tests/t-reftable-readwrite.c |   2 +-
 t/unit-tests/t-reftable-record.c    |  19 +++++-
 19 files changed, 148 insertions(+), 149 deletions(-)


---
base-commit: 757161efcca150a9a96b312d9e780a071e601a03
change-id: 20250116-b4-pks-reftable-sign-compare-8eaabae74c06

Comments

Karthik Nayak Jan. 20, 2025, 10:07 a.m. UTC | #1
Patrick Steinhardt <ps@pks.im> writes:

> Hi,
>
> during the last steps of converting the reftable codebase to become a
> standalone library I noticed that the new -Wsign-compare warnings
> created a bit of a problem due to the `DISABLE_SIGN_COMPARE_WARNINGS`
> macro that we started using. As a consequence I wasn't able to easily
> drop "git-compat-util.h" anymore. This patch series is thus addresses
> the issue by fixing all sign comparison warnings in the reftable
> library.
>
> Thanks!
>

Most of the patches were straightforward and look good. I left only nits
on one commit, which doesn't warrant a re-roll.

Thanks

[snip]
Patrick Steinhardt Jan. 20, 2025, 3:10 p.m. UTC | #2
On Mon, Jan 20, 2025 at 05:07:23AM -0500, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > Hi,
> >
> > during the last steps of converting the reftable codebase to become a
> > standalone library I noticed that the new -Wsign-compare warnings
> > created a bit of a problem due to the `DISABLE_SIGN_COMPARE_WARNINGS`
> > macro that we started using. As a consequence I wasn't able to easily
> > drop "git-compat-util.h" anymore. This patch series is thus addresses
> > the issue by fixing all sign comparison warnings in the reftable
> > library.
> >
> > Thanks!
> >
> 
> Most of the patches were straightforward and look good. I left only nits
> on one commit, which doesn't warrant a re-roll.

Thanks for your review! I'll send v2 in a bit.

Patrick