Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x3xpw-006nGI-0g for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2026 15:34:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x3xpv-008DXb-0k for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2026 15:34:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x3xpu-008DXT-30 for pgsql-hackers@lists.postgresql.org; Tue, 08 Sep 2026 15:34:14 +0000 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x3xps-00000004cNQ-06bq for pgsql-hackers@lists.postgresql.org; Tue, 08 Sep 2026 15:34:14 +0000 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-86c0e4dd49cso57990707b3.3 for ; Tue, 08 Sep 2026 08:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788881651; x=1789486451; darn=lists.postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=uiSW3RYOAseBGpWRxJto0R1GZVbjxRzyyWNdbwkzSLA=; b=XTJf1QzQZvevlrZNF96B8Wazx/vNHQq6zSrVWpIk8QaGLqT67u4UPmfh2dqhYwvDRe XMEkHK+DfFPMWpqUcuRvNUVjCHsYGqI00bAM9LB05gqkFpHSX6HEciOA+Aw+IsAMJnG7 iG7bBo9w9ggf1x8GRQqPv7zIMuC/6fR7W0VGqBz5n9Qh+6JzrLhanyFQzUe1WEV1jxEt nkjv1+vA999LU8K0gd4xMZLBv6q3AntqgOL4ftvgQJj4pH9NkNVnR47py/a2kN/0p0t2 JNHrN+Pusl44l0IzxT0i0E/ZBFH1XFGENME/1H7yjlhexn4nwqrSoROvdit+JKYDpe8h E4jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788881651; x=1789486451; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=uiSW3RYOAseBGpWRxJto0R1GZVbjxRzyyWNdbwkzSLA=; b=O6QA80SCRkM7QSzpoHV+d/2hhTxA+YLjHMjOb+feMXFxDTf5YdcS6orGlTEYpoiEW6 v4t57JAwIoBEcs/nizjJDTQW0ATbk3nGmTHUxUqjPEaY0DWbNcmmQz8NhCTT+wTRoUgB hnMuVA6a8ofgqzOg2hYD41tVidOM9ucRZEhfk9LWIph2VNs8eAxrYfTlcM0ZcOxaaOop +0zgBWNUz0eVMcqZjINkYsTPVGpbPLyQ/SHNTI5w4zfHceJVYwYdrE5szPMJcFdxC2tY 2fkdph26zEdB/4DQswCspwourJ63IVomR+HXUK8gVADdEeqTeeJ3XEwpJWkM2RfvYnne KqXQ== X-Gm-Message-State: AFuF++llOmW8ZVvHBr7GhJLDp6+2BTUMId2JGbIvuOX0O0mTM46bBjEz 7sriTWa30qCkzKuFGe1Al6BfNGtmDkJ4FOp0Hx/b+jc93YbwbqLL0V+D X-Gm-Gg: AYBFou0ueTv1Hw4pvEeKPj9D7rbtRyGHR1/2Ej5HQe+MSB4JmU0VwgWb5yw8UqKTGYy G75bdoPwmXbdf5zLe+TA3bp4GvkQju1dXpgDmr9cOC/C4sCJ5t1U3eSJzeXRgh+cTALT+iIgwCE OKs7E4pIlxYVX8GDXV7O2FULUHsqC7xcrX7Q7mdTew0n8SrQmSV4OFnjSXQPzfqqNOcLSvfzC21 YGwSfRMBLmTr5s4pMvtwOzSlRRzWjkYhLm9qAZEpZY35hCmUrDBKY51FKS2MCyOjXZLV0dKP01l TPRBQ5dEO1PUmakJJWLf7Frh4r3uebX0QoYDT0QM/E3tS9gtD8pIYipiTcp+ptcSc5mx/Z3/TBl YTiyAbi+Mc8bufnA3LPoi2Q20WUWhqOmoLG6ObYd7ATPamih5Sdn0Jm5W9tU3TYFhkr2EIYCxuS YcdMsUWV8BdIkYt+tL1YsyYeUBZDiyIOCR2mze3pcGtK00OJmtUOPPzCqv0yAk0t1LDc1T5M3LU P6luuXwvRF1M4M6T5HwHquLCbA7DECve5lYfOOms0KeO1ADTYEd5Oku8sUWCmhk3HvMjULy8k06 IkGOOfq+g1d8Sl0= X-Received: by 2002:a05:690e:138d:b0:66c:e472:c792 with SMTP id 956f58d0204a3-66fb5a0f637mr8400191d50.31.1788881651010; Tue, 08 Sep 2026 08:34:11 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91048476220sm91133576d6.31.2026.09.08.08.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 08:34:10 -0700 (PDT) Date: Tue, 8 Sep 2026 10:34:08 -0500 From: Nathan Bossart To: Jan Nidzwetzki Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Add pg_nodiscard decorations to Bitmapset functions Message-ID: References: <2020a70e-76f3-4661-afa6-82c2639251c2@planetscale.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2020a70e-76f3-4661-afa6-82c2639251c2@planetscale.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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