_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 sincef5e0186f86, we have not made use of _Generic until now (except in an MSVC-specific case in commit59c2f03d1e). 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
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/.