| From: | vignesh C <vignesh21(at)gmail(dot)com> |
|---|---|
| To: | Peter Smith <smithpb2250(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Fix a recent "shadow warning" in subscriptioncmds.c |
| Date: | 2025-11-28 09:33:34 |
| Message-ID: | CALDaNm0MdNW5Wyo-nF8vCDSHzPwswPP2Q--8zhgwm-GN+0d7Jw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, 28 Nov 2025 at 09:29, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> I noticed that recently, a shadow warning has crept into the code I am building.
>
> ----------
> subscriptioncmds.c:1125:30: warning: declaration of ‘rel’ shadows a
> previous local [-Wshadow]
> foreach_ptr(SubRemoveRels, rel, sub_remove_rels)
> ^
> ../../../src/include/nodes/pg_list.h:482:20: note: in definition of
> macro ‘foreach_internal’
> for (type pointer var = 0, pointer var##__outerloop = (type pointer) 1; \
> ^
> subscriptioncmds.c:1125:3: note: in expansion of macro ‘foreach_ptr’
> foreach_ptr(SubRemoveRels, rel, sub_remove_rels)
> ^
> subscriptioncmds.c:934:11: warning: shadowed declaration is here [-Wshadow]
> Relation rel = NULL;
> ^
> ----------
>
> This seems to have been introduced recently by the REFRESH SEQUENCES
> commit f0b3573.
>
> IIUC, this particular case is harmless, but IMO it's still worth
> fixing to avoid recurring doubts about potential issues every time it
> appears.
>
> PSA patch v1 to address the warning.
Thanks, your changes look good to me, I have verified this by
including the -Wshadow option.
Regards,
Vignesh
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-11-28 09:39:23 | Re: Proposal: adding --enable-shadows-warning |
| Previous Message | Shubham Khanna | 2025-11-28 09:32:15 | Re: Add support for specifying tables in pg_createsubscriber. |