Re: Unused parameters & co in code

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Unused parameters & co in code
Date: 2019-01-31 00:35:50
Message-ID: 20190131003550.GB16781@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 30, 2019 at 12:33:47PM +0100, Peter Eisentraut wrote:
> On 30/01/2019 08:33, Michael Paquier wrote:
>> I just got a run with CFLAGS with the following options:
>> -Wunused-function -Wunused-variable -Wunused-const-variable
>
> These are part of -Wall.

The ones selected already generate a lot of junk, so increasing the
output is not really a good idea. What I wanted to find out are the
spots where we could be able to simplify the code for any unused
parameter. As you mention, some parameters are here for symmetry in
the declaration, which makes sense in some cases, but for some other
cases I think that we may be able to reduce logic complexity, and this
gives hints about that.

>> -Wno-unused-result
>
> What is the purpose of this?

Not really useful actually as we don't mark anything with
warn_unused_result.

>> -Wunused-macros
>
> I have looked into that in the past. There are a few that were
> genuinely left behind accidentally, but most are there for completeness
> or symmetry and don't look like they should be removed. Also you get
> junk from flex and perl and the like. Needs to be addressed case by
> case. I can dig up my old branch and make some proposals.

Thanks. Maybe I missed some of them. Some macros, like the xml one,
are here for documentation purposes, so removing such things does not
make sense either.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-01-31 00:39:35 Re: backslash-dot quoting in COPY CSV
Previous Message Michael Paquier 2019-01-31 00:30:06 Re: Unused parameters & co in code