Re: Unused parameters & co in code - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Unused parameters & co in code
Date
Msg-id 20190131003550.GB16781@paquier.xyz
Whole thread Raw
In response to Re: Unused parameters & co in code  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List 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

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Unused parameters & co in code
Next
From: Michael Paquier
Date:
Subject: Re: backslash-dot quoting in COPY CSV