Re: Remove shadowed declaration warnings

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove shadowed declaration warnings
Date: 2024-09-12 02:25:38
Message-ID: CAApHDvqaa3YXqTF2cZ0ocwXvvpqEwAPHpBAO_0Sfwa6ORhYYHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 12 Sept 2024 at 14:03, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I do grant that sometimes shadowing of locals can cause bugs. I don't
> recall right now why we opted for -Wshadow=compatible-local over
> -Wshadow=local, but we could certainly take another look at that.

I don't recall if it was discussed, but certainly, it was an easier
goal to achieve.

Looks like there are currently 47 warnings with -Wshadow=local. I'm
not quite sure what the definition of "compatible" is for this flag,
but looking at one warning in pgbench.c:4548, I see an int shadowing a
bool. So maybe -Wshadow=local is worthwhile.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-09-12 02:28:14 Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
Previous Message Amit Langote 2024-09-12 02:24:52 Re: json_query conditional wrapper bug