pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Jan Nidzwetzki <jan@planetscale.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Add pg_nodiscard decorations to Bitmapset functions
Date: Tue, 8 Sep 2026 10:34:08 -0500
Message-ID: <aqAq8Aoo5KLsByb1@nathan> (raw)
In-Reply-To: <2020a70e-76f3-4661-afa6-82c2639251c2@planetscale.com>
References: <2020a70e-76f3-4661-afa6-82c2639251c2@planetscale.com>

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






view thread (4+ messages)  latest in thread

Message-ID: <aqAq8Aoo5KLsByb1@nathan>
Permalink:  ../aqAq8Aoo5KLsByb1@nathan/
Also on:    postgresql.org/message-id/aqAq8Aoo5KLsByb1@nathan

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, jan@planetscale.com
  Subject: Re: Add pg_nodiscard decorations to Bitmapset functions
  In-Reply-To: <aqAq8Aoo5KLsByb1@nathan>
  References: <2020a70e-76f3-4661-afa6-82c2639251c2@planetscale.com> <aqAq8Aoo5KLsByb1@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox