Re: shadow variables - pg15 edition - Mailing list pgsql-hackers

From David Rowley
Subject Re: shadow variables - pg15 edition
Date
Msg-id CAApHDvpG88_MANP_ZOmF87zaYBRwMzGw16kNG9hZE5y2fi-w3A@mail.gmail.com
Whole thread Raw
In response to Re: shadow variables - pg15 edition  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: shadow variables - pg15 edition  (Michael Paquier <michael@paquier.xyz>)
Re: shadow variables - pg15 edition  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On Tue, 11 Oct 2022 at 06:02, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > On 2022-Oct-10, Andres Freund wrote:
> >> We could, but is it really a useful thing for something fixed 6 years ago?
>
> > Well, for people purposefully installing using older installs of Perl
> > (not me, admittedly), it does seem useful, because you get the benefit
> > of checking shadow vars for the rest of the tree and still get no
> > warnings if everything is clean.
>
> Meh --- people purposefully using old Perls are likely using old
> compilers too.  Let's wait and see if any devs actually complain.

I can't really add much here, apart from I think it would be a shame
if some 3rd party 6 year old code was to hold us back on this.

I'm also keen to wait for complaints and only if we really have to,
remove the shadow flag from being used only in the places where we
need to.

Aside from this issue, if anything I'd be keen to go a little further
with this and upgrade to -Wshadow=local. The reason being is that I
noticed that the const qualifier is not classed as "compatible" with
the equivalently named and typed variable without the const qualifier.
ISTM that there's close to as much opportunity to mix up two variables
with the same name that are const and non-const as there are two
variables with the same const qualifier. However, I'll be waiting for
the dust to settle on the current flags before thinking any more about
that.

David



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Adding Support for Copy callback functionality on COPY TO api
Next
From: Masahiko Sawada
Date:
Subject: Re: Perform streaming logical transactions by background workers and parallel apply