Re: Fix gcc warning in sync.c (usr/src/backend/storage/sync/sync.c)

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: thomas(dot)munro(at)gmail(dot)com, ranier(dot)vf(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix gcc warning in sync.c (usr/src/backend/storage/sync/sync.c)
Date: 2022-07-11 09:45:07
Message-ID: 20220711.184507.1003785783441202992.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Mon, 11 Jul 2022 01:45:16 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote in
> [ cc'ing Thomas, whose code this seems to be ]
>
> Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> writes:
> > At Sat, 9 Jul 2022 21:53:31 -0300, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote in
> >> 528 | entry = (PendingUnlinkEntry *) lfirst(cell);
>
> > Actually, I already see the following line (maybe) at the place instead.
> >> PendingUnlinkEntry *entry = (PendingUnlinkEntry *) lfirst(cell);
>
> Yeah, I see no line matching that in HEAD either.
>
> However, I do not much like the code at line 528, because its
> "PendingUnlinkEntry *entry" is masking an outer variable
> "PendingFsyncEntry *entry" from line 513. We should rename
> one or both variables to avoid that masking.

I thought the same at the moment looking this. In this case, changing
entry->syncent, unl(del)lent works. But at the same time I don't think
that can be strictly applied.

So, for starters, I compiled the whole tree with -Wshadow=local. and I
saw many warnings with it. At a glance all of them are reasonably
"fixed" but I don't think it is what we want...

Thoughts?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-07-11 11:33:34 Re: Handle infinite recursion in logical replication setup
Previous Message Alvaro Herrera 2022-07-11 09:30:07 Re: EINTR in ftruncate()