Cleanup shadows variable warnings, round 1

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Cleanup shadows variable warnings, round 1
Date: 2025-11-28 08:16:59
Message-ID: CAEoWx2kQ2x5gMaj8tHLJ3=jfC+p5YXHkJyHrDTiQw2nn2FJTmQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

While reviewing [1], it makes me recall an experience where I had a patch
ready locally, but CommitFest CI failed with a shadows-variable warning.
Now I understand that -Wall doesn't by default enable -Wshadows with some
compilers like clang.

I did a clean build with manually enabling -Wshadow and surprisingly found
there are a lot of such warnings in the current code base, roughly ~200
occurrences.

As there are too many, I plan to fix them all in 3-4 rounds. For round 1
patch, I'd see any objection, then decide if to proceed more rounds.

[1] https://postgr.es/m/CAHut+PsF8R0Bt4J3c92+T2F0mun0rRfK=-
GH+iBv2s-O8ahJJw(at)mail(dot)gmail(dot)com

Best regards,
Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v1-0001-Cleanup-shadows-variable-warnings-round-1.patch application/octet-stream 55.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-11-28 08:17:20 Re: Remove useless casting to the same type
Previous Message Peter Eisentraut 2025-11-28 08:11:16 Re: Remove useless casting to the same type