| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Jan Nidzwetzki <jan(at)planetscale(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Add pg_nodiscard decorations to Bitmapset functions |
| Date: | 2026-09-08 15:34:08 |
| Message-ID: | aqAq8Aoo5KLsByb1@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Sep 08, 2026 at 05:13:08PM +0200, Jan Nidzwetzki wrote:
> The functions in bitmapset.h that return a Bitmapset * either build a
> new set or recycle their input, so ignoring the return value is always a
> bug.
>
> Commit c617aea6acd introduced the macro pg_nodiscard, which generates a
> compiler warning when the result of a function call is ignored. The List
> functions in pg_list.h have the same requirement, and commit a378ba49a5c
> added pg_nodiscard to most of them.
>
> However, bitmapset.h was never adjusted. The attached patch adds
> pg_nodiscard to all functions there that return a Bitmapset *.
This seems generally reasonable to me. In fact, it looks like this idea
was brought up and then deferred during some other Bitmapset work earlier
in the year [0].
[0] https://postgr.es/m/3432490.1776524971%40sss.pgh.pa.us
--
nathan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2026-09-08 15:36:32 | Re: Speed up COPY FROM text/CSV parsing using SIMD |
| Previous Message | David Geier | 2026-09-08 15:30:29 | Re: Reducing relcache memory usage: deduping index shapes |