pgsql: Portable StaticAssertExpr

Started by Peter Eisentraut5 months ago1 messagescomitters
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

Portable StaticAssertExpr

Use a different way to write StaticAssertExpr() that does not require
the GCC extension statement expressions.

For C, we put the static_assert into a struct. This appears to be a
common approach.

We still need to keep the fallback implementation to support buggy
MSVC < 19.33.

For C++, we put it into a lambda expression. (The C approach doesn't
work; it's not permitted to define a new type inside sizeof.)

Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: /messages/by-id/5fa3a9f5-eb9a-4408-9baf-403d281f8b10@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/aa7c86852343dd18f5834f70e4caa50ae49326c9

Modified Files
--------------
config/c-compiler.m4 | 16 ----------------
configure | 31 -------------------------------
configure.ac | 1 -
meson.build | 13 -------------
src/include/c.h | 30 ++++++++++++++++++++++--------
src/include/pg_config.h.in | 3 ---
6 files changed, 22 insertions(+), 72 deletions(-)