Re: [Proposal] Level4 Warnings show many shadow vars

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Proposal] Level4 Warnings show many shadow vars
Date: 2019-12-05 15:28:35
Message-ID: CA+TgmoYh+qHFYVnH2ihw5+SiVwGEmFkWiZaO0E-rv5hNbaeirA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 3, 2019 at 8:24 PM Ranier Vilela <ranier_gyn(at)hotmail(dot)com> wrote:
> I believe PostgreSQL can benefit from changing the alert level of compilation warnings.
> The current Level3 level for windows does not show any alerts, but that does not mean that there are no problems.
> Changing the level to Level4 and its equivalent for GCC in Unix environments will show many warnings for shadow variables, including global variables.
> True, there will also be many silly alerts that can be safely disabled.
> Shadow variables, although they may not currently represent bugs, may be hiding errors, or at the very least, it is a waste of variable declaration.
> With the current Level3 level, development is no longer checking and correcting shadow variables.
>
> Any comments?

Most of us don't develop on Windows, so changing warning levels on
Windows won't really affect what developers see on their own machines,
and thus probably doesn't have much value. It might be a good idea to
try to clean up some/many cases of shadowed variables, though.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-12-05 15:29:24 Re: Online checksums patch - once again
Previous Message Daniel Gustafsson 2019-12-05 15:28:23 Re: Online checksums patch - once again