]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Portable StaticAssertExpr
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 6 Mar 2026 08:15:44 +0000 (09:15 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 6 Mar 2026 08:27:54 +0000 (09:27 +0100)
commitaa7c86852343dd18f5834f70e4caa50ae49326c9
treeb398a93fb7d24834cfb5df9aed2a8653e1620052
parent6eedb2a5fd88da11fab92dcde9205366f6fff82f
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
config/c-compiler.m4
configure
configure.ac
meson.build
src/include/c.h
src/include/pg_config.h.in