pgsql: Add unconstify_constexpr

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add unconstify_constexpr
Date: 2026-10-07 06:58:06
Message-ID: E1xELbK-00000000ep8-06HW@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)gmail(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2026-10-07 08:54:39 Re: pgsql: Optimize tuple deformation
Previous Message Peter Eisentraut 2026-10-07 06:31:05 Re: pgsql: Optimize tuple deformation