Re: log_heap_visible(): remove unused parameter and update comment

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: log_heap_visible(): remove unused parameter and update comment
Date: 2022-09-30 11:32:43
Message-ID: CALj2ACVk8PUxuPxXSwW_twqDaUPFRsp5jEnfio+b4Y75c4ijSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 30, 2022 at 1:07 PM Drouvot, Bertrand
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> Hi,
>
> While resuming the work on [1] I noticed that:
>
> - there is an unused parameter in log_heap_visible()
> - the comment associated to the function is not in "sync" with the
> current implementation (referring a "block" that is not involved anymore)
>
> Attached a tiny patch as an attempt to address the above remarks.
>
> [1]: https://commitfest.postgresql.org/39/3740/

It looks like that parameter was originally introduced and used in PG
9.4 where xl_heap_visible structure was having RelFileNode, which was
later removed in PG 9.5, since then the RelFileNode rnode parameter is
left out. This parameter got renamed to RelFileLocator rlocator by the
commit b0a55e43299c4ea2a9a8c757f9c26352407d0ccc in HEAD.

The attached patch LGTM.

We recently committed another patch to remove an unused function
parameter - 65b158ae4e892c2da7a5e31e2d2645e5e79a0bfd.

It makes me think that why can't we remove the unused function
parameters once and for all, say with a compiler flag such as
-Wunused-parameter [1]? We might have to be careful in removing
certain parameters which are not being used right now, but might be
used in the near future though.

[1] https://man7.org/linux/man-pages/man1/gcc.1.html

-Wunused-parameter
Warn whenever a function parameter is unused aside from its
declaration.

To suppress this warning use the "unused" attribute.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2022-09-30 12:11:39 Re: Minimal logical decoding on standbys
Previous Message Alvaro Herrera 2022-09-30 10:59:55 Re: Fix some newly modified tab-complete changes