From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Portable StaticAssertExpr
Date: Fri, 06 Mar 2026 08:34:21 +0000
Message-ID: <E1vyQdZ-002eEg-2p@gemulon.postgresql.org> (raw)
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: https://www.postgresql.org/message-id/flat/5fa3a9f5-eb9a-4408-9baf-403d281f8b10%40eisentraut.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(-)
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: Portable StaticAssertExpr
In-Reply-To: <E1vyQdZ-002eEg-2p@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