Re: shadow variables - pg15 edition

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: shadow variables - pg15 edition
Дата
Msg-id 20221010162732.5stcy665zsyxkaq6@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: shadow variables - pg15 edition  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: shadow variables - pg15 edition
Список pgsql-hackers
Hi,

On 2022-10-10 12:06:22 -0400, Tom Lane wrote:
> Scraping the configure logs also shows that only half of the buildfarm
> (exactly 50 out of 100 reporting animals) knows -Wshadow=compatible-local,
> which suggests that we might see more of these if they all did.

I think it's not just newness - only gcc has compatible-local, even very new
clang doesn't.


This was fixed ~6 years ago in perl:

commit f2b9631d5d19d2b71c1776e1193173d13f3620bf
Author: David Mitchell <davem@iabyn.com>
Date:   2016-05-23 14:43:56 +0100

    CX_POP_SAVEARRAY(): use more distinctive var name

    Under -Wshadow, CX_POP_SAVEARRAY's local var 'av' can generate this
    warning:

        warning: declaration shadows a local variable [-Wshadow]

    So rename it to cx_pop_savearay_av to reduce the risk of a clash.

    (See http://nntp.perl.org/group/perl.perl5.porters/236444)


> Not sure if this is problematic enough to justify removing the switch.
> A plausible alternative is to have a few animals with known-clean Perl
> installations add the switch manually (and use -Werror), so that we find
> out about violations without having warnings in the face of developers
> who can't fix them.  I'm willing to wait to see if anyone complains of
> such warnings, though.

Given the age of affected perl instances I suspect there'll not be a lot of
developers affected, and the number of warnings is reasonably small too. It'd
likely hurt more developers to not see the warnings locally, given that such
shadowing often causes bugs.

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: shadow variables - pg15 edition
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: src/test/perl/PostgreSQL/Test/*.pm not installed