From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use standard C23 and C++ attributes if available
Date: Wed, 01 Apr 2026 06:24:45 +0000
Message-ID: <E1w7p0O-002Pxi-10@gemulon.postgresql.org> (raw)
Use standard C23 and C++ attributes if available
Use the standard C23 and C++ attributes [[nodiscard]], [[noreturn]],
and [[maybe_unused]], if available.
This makes pg_nodiscard and pg_attribute_unused() available in
not-GCC-compatible compilers that support C23 as well as in C++.
For pg_noreturn, we can now drop the GCC-specific and MSVC-specific
fallbacks, because the C11 and the C++ implementation will now cover
all required cases.
Note, in a few places, we need to change the position of the attribute
because it's not valid in that place in C23.
Discussion: https://www.postgresql.org/message-id/flat/pxr5b3z7jmkpenssra5zroxi7qzzp6eswuggokw64axmdixpnk@zbwxuq...
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/76f4b92bac87fa54bd6dd8bd53e59f93127ec2ef
Modified Files
--------------
src/backend/utils/mmgr/slab.c | 2 +-
src/include/c.h | 38 ++++++++++++++++++--------------
src/include/lib/radixtree.h | 2 +-
src/test/modules/worker_spi/worker_spi.c | 2 +-
4 files changed, 25 insertions(+), 19 deletions(-)
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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Use standard C23 and C++ attributes if available
In-Reply-To: <E1w7p0O-002Pxi-10@gemulon.postgresql.org>
* 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