Fix port/pg_iovec.h building extensions on x86_64-darwin

Wolfgang Walther <walther@technowledgy.de>

From: Wolfgang Walther <walther@technowledgy.de>
To: pgsql-hackers@lists.postgresql.org
Date: 2024-11-08T19:08:06Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix sign-compare warnings in pg_iovec.h.

Attachments

When building pg_cron [1] or pg_hll [2] for PG 17 on x86_64-darwin, we 
encounter the following build failure in nixpkgs:


/nix/store/2clw9wg933c40f871d8iqbl909lg2yis-postgresql-17.0-dev/include/server/port/pg_iovec.h:71:12: 
error: comparison of integers of different signs: 'ssize_t' (aka 'long') 
and 'const size_t' (aka 'const unsigned long') [-Werror,-Wsign-compare]
                 if (part < iov[i].iov_len)
                     ~~~~ ^ ~~~~~~~~~~~~~~
/nix/store/2clw9wg933c40f871d8iqbl909lg2yis-postgresql-17.0-dev/include/server/port/pg_iovec.h:110:12: 
error: comparison of integers of different signs: 'ssize_t' (aka 'long') 
and 'const size_t' (aka 'const unsigned long') [-Werror,-Wsign-compare]
                 if (part < iov[i].iov_len)
                     ~~~~ ^ ~~~~~~~~~~~~~~
2 errors generated.


The attached patch fixes those.

Hopefully this can make it into the minor release next week.

Best,

Wolfgang

[1]: https://hydra.nixos.org/build/276421287/nixlog/1
[2]: https://hydra.nixos.org/build/276419879/nixlog/1