]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Suppress compiler warning in relptr_store().
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 26 Mar 2022 18:29:29 +0000 (14:29 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 26 Mar 2022 18:29:56 +0000 (14:29 -0400)
commita2a1aa830a1ccf6991c59a64c6f2b873f3c2c727
tree14326d50e34cd450df1dcc9d3542b132bdf1ad76
parent3d263b09058a6ea90ed0f6143fafbb92892c7ba8
Suppress compiler warning in relptr_store().

clang 13 with -Wextra warns that "performing pointer subtraction with
a null pointer has undefined behavior" in the places where freepage.c
tries to set a relptr variable to constant NULL.  This appears to be
a compiler bug, but it's unlikely to get fixed instantly.  Fortunately,
we can work around it by introducing an inline support function, which
seems like a good change anyway because it removes the macro's existing
double-evaluation hazard.

Backpatch to v10 where this code was introduced.

Patch by me, based on an idea of Andres Freund's.

Discussion: https://postgr.es/m/48826.1648310694@sss.pgh.pa.us
src/include/utils/relptr.h