Paint some PG_USED_FOR_ASSERTS_ONLY in inline functions of ilist.h and bufpage.h
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t43561psql -h localhost -U postgresBuilt from patchset v1 (message #1), July 27, 2026 at 05:50 PM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t43561_1 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t43561_1 && git checkout t43561_1Patchset v1 (message #1) is on t43561_1
Hi all,
The following functions in ilist.h and bufpage.h use some arguments
only in assertions:
- dlist_next_node
- dlist_prev_node
- slist_has_next
- slist_next_node
- PageValidateSpecialPointer
Without PG_USED_FOR_ASSERTS_ONLY, this can lead to compilation
warnings when not using assertions, and one example of that is
plpgsql_check. We don't have examples on HEAD where
PG_USED_FOR_ASSERTS_ONLY is used on arguments, but that looks to work
properly with gcc.
Thoughts?
--
Michael
On Tue, Jan 19, 2021 at 9:53 AM Michael Paquier <michael@paquier.xyz> wrote:
Hi all,
The following functions in ilist.h and bufpage.h use some arguments
only in assertions:
- dlist_next_node
- dlist_prev_node
- slist_has_next
- slist_next_node
- PageValidateSpecialPointerWithout PG_USED_FOR_ASSERTS_ONLY, this can lead to compilation
warnings when not using assertions, and one example of that is
plpgsql_check.
For the record, that's due to that extra flags in the Makefile:
override CFLAGS += -I$(top_builddir)/src/pl/plpgsql/src -Wall
I think that we're still far from being able to get a clean output
using -Wall on postgres itself, so I don't know how much we can
promise to external code, but fixing those may be a good step.
We don't have examples on HEAD where
PG_USED_FOR_ASSERTS_ONLY is used on arguments, but that looks to work
properly with gcc.
Yeah I don't see any explicit mention on that on gcc manual. For the
record it also work as expected using clang, and the attached patch
remove all warnings when compiling plpgsql_check.
On Tue, Jan 19, 2021 at 04:27:43PM +0800, Julien Rouhaud wrote:
Yeah I don't see any explicit mention on that on gcc manual. For the
record it also work as expected using clang, and the attached patch
remove all warnings when compiling plpgsql_check.
FWIW, the part of the GCC docs that I looked at is here:
https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes
And what I have done does not seem completely legal either for
function arguments, even if I am not getting any complaints when
compiling that.
--
Michael