pgsql: Add unconstify_constexpr

Started by Peter Eisentrautabout 2 months ago1 messagescommitters
Jump to latest
#1Peter Eisentraut
peter@eisentraut.org

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: /messages/by-id/c76b72dd-5736-453a-b698-6968d42e4768@eisentraut.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(-)