Re: Paint some PG_USED_FOR_ASSERTS_ONLY in inline functions of ilist.h and bufpage.h

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Paint some PG_USED_FOR_ASSERTS_ONLY in inline functions of ilist.h and bufpage.h
Date: 2021-01-19 08:27:43
Message-ID: CAOBaU_YEZ3LYQq7FfnAqOwo5=ii=3L_QtZnB8OCFkhaVA0Fr1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 19, 2021 at 9:53 AM Michael Paquier <michael(at)paquier(dot)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
> - 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.

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-01-19 08:32:00 Re: Is it worth accepting multiple CRLs?
Previous Message Peter Eisentraut 2021-01-19 08:21:15 Re: Change default of checkpoint_completion_target