From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add unconstify_constexpr
Date: Wed, 07 Oct 2026 06:58:06 +0000
Message-ID: <E1xELbK-00000000ep8-06HW@gemulon.postgresql.org> (raw)
Add unconstify_constexpr
unconstify_constexpr is like unconstify but for contexts where a
constant expression is required, such as for initializing global
variables. It provides the same level of checking as unconstify, but
the checking only works on GCC, otherwise it lets anything through.
Also, if the check fails, it gives a less clear error message. So it
should only be used when necessary.
(An unvolatize_constexpr doesn't seem necessary, but it could be added if
required.)
Reviewed-by: Rui Zhao <zhaorui126@gmail.com>
Discussion: https://www.postgresql.org/message-id/c76b72dd-5736-453a-b698-6968d42e4768%40eisentraut.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d396cb7e22b3e25060cbb80e5c857ea655bc500b
Modified Files
--------------
src/include/c.h | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 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 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-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: Add unconstify_constexpr
In-Reply-To: <E1xELbK-00000000ep8-06HW@gemulon.postgresql.org>
References: <E1xELbK-00000000ep8-06HW@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