| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Portable StaticAssertExpr |
| Date: | 2026-03-06 08:34:21 |
| Message-ID: | E1vyQdZ-002eEg-2p@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)jeltef(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-03-06 09:22:45 | pgsql: Use typeof everywhere instead of compiler specific spellings |
| Previous Message | Fujii Masao | 2026-03-06 07:47:08 | pgsql: Fix publisher shutdown hang caused by logical walsender busy loo |