1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00
Peter Eisentraut d15a6bc2e1 Replace __builtin_types_compatible_p with _Generic
_Generic is the C11 standard equivalent (and superset) of
__builtin_types_compatible_p, so by replacing the latter with the
former, we can now rely on this working on all compilers, instead of
previously just with GCC-compatible ones.  And we can drop a configure
test.

This affects StaticAssertVariableIsOfType() and
StaticAssertVariableIsOfTypeMacro() and indirectly unconstify() and
unvolatize().

Neither _Generic nor __builtin_types_compatible_p works in C++, so
this does not change that, but this adds an explicit code comment
about that.

There are some subtle behavior changes, but these do not affect cases
that are in use or likely to be useful.  _Generic does lvalue
conversion on the controlling expression, which means it drops
top-level qualifiers and converts arrays to pointers.
__builtin_types_compatible_p on the other hand, supports arrays and
just ignores qualifiers.  So before, StaticAssertVariableIsOfType(x,
const int) might have worked, but now it does not.  (But note that it
would previously have succeeded even if x was a non-const int, so this
usage would always have been dubious.)  Also,
StaticAssertVariableIsOfType(y, char[]) would have worked, but now you
need to write char *.  (But this is not backward compatible, because
char * would previously not have succeeded.)  Similarly, unconstify of
non-pointers, like unconstify(const int, x) would previously have
worked, but this was just by accident and never useful (you can just
assign directly, without a cast), and the C++ implementation rejects
non-pointers anyway.  Some comments are added to explain this a bit.
There are no current uses affected by this.

Note that even though we have required C11 since f5e0186f86, we have
not made use of _Generic until now (except in an MSVC-specific case in
commit 59c2f03d1e).  This now raises the effective compiler
requirement on the trailing edge slightly from GCC 4.8 to GCC 4.9.
This in turn means that we effectively drop support for RHEL 7.

Author: Peter Eisentraut <peter@eisentraut.org>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Co-authored-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/CA+hUKGL7trhWiJ4qxpksBztMMTWDyPnP1QN+Lq341V7QL775DA@mail.gmail.com
2026-07-14 10:30:46 +02:00
2026-06-08 15:26:47 -04:00
2024-11-05 13:56:02 +01:00
2026-01-01 13:24:10 -05:00
…
2026-02-23 13:34:22 -05:00

PostgreSQL Database Management System

This directory contains the source code distribution of the PostgreSQL database management system.

PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.

Copyright and license information can be found in the file COPYRIGHT.

General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.

The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.

Description
Зеркало официального репозитория PostgreSQL GIT
Readme 1.3 GiB
Languages
C 83.9%
PLpgSQL 6.2%
Perl 5.4%
Yacc 1.2%
Meson 0.7%
Other 2.4%