From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Peter Smith <smithpb2250(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Fix shadow warnings in logical replication code |
Date: | 2023-08-30 00:48:48 |
Message-ID: | ZO6R8BDWRg3clbsp@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Aug 30, 2023 at 09:16:38AM +1000, Peter Smith wrote:
> logicalfuncs.c:184:13: warning: declaration of ‘name’ shadows a
> previous local [-Wshadow]
> char *name = TextDatumGetCString(datum_opts[i]);
> ^
> logicalfuncs.c:105:8: warning: shadowed declaration is here [-Wshadow]
> Name name;
A bit confusing here, particularly as the name is reused with
ReplicationSlotAcquire() at the end of
pg_logical_slot_get_changes_guts() once again.
> reorderbuffer.c:4843:10: warning: declaration of ‘isnull’ shadows a
> previous local [-Wshadow]
> bool isnull;
> ^
> reorderbuffer.c:4734:11: warning: shadowed declaration is here [-Wshadow]
> bool *isnull;
> ^
Agreed as well about this one.
> walsender.c:3543:14: warning: declaration of ‘sentPtr’ shadows a
> global declaration [-Wshadow]
> XLogRecPtr sentPtr;
> ^
> walsender.c:155:19: warning: shadowed declaration is here [-Wshadow]
> static XLogRecPtr sentPtr = InvalidXLogRecPtr;
> ^
This one looks pretty serious to me, particularly as the static
sentPtr is used quite a bit. It is fortunate that the impact is
limited to the WAL sender stat function.
Fixing all these seems like a good thing in the long term, so OK for
me. Like all the fixes similar to this one, I don't see a need for a
backpatch based on their locality, even if sentPtr makes me a bit
nervous to keep even in stable branches.
There is much more going on with -Wshadow, but let's do things
incrementally, case by case.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2023-08-30 00:51:23 | Re: Remove IndexInfo.ii_OpclassOptions field |
Previous Message | Kyotaro Horiguchi | 2023-08-30 00:46:58 | Re: Strange presentaion related to inheritance in \d+ |