Define unconstify() and unvolatize() for C++.

Thomas Munro <tmunro@postgresql.org>

Commit: baf7c93ed583949d837bc13f24a15a0efbcb1ae7
Author: Thomas Munro <tmunro@postgresql.org>
Date: 2023-12-11T20:46:46Z
Releases: 17.0
Define unconstify() and unvolatize() for C++.

These two macros wouldn't work if used in an inline function definition
in a header seen by g++, because __builtin_types_compatible_p is only
available in C.  Redirect to standard C++ const_cast (which also
adds/removes volatile despite its name).

Per cpluspluscheck failure in a development branch.

Suggested-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/CA%2BhUKGK3OXFjkOyZiw-DgL2bUqk9by1uGuCnViJX786W%2BfyDSw%40mail.gmail.com

Files

PathChange+/−
src/include/c.h modified +4 −1

Discussion