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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: Thomas Munro <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 05:45:16
Message-ID: 946810.1657518316@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[ 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
>> sync.c: In function ¡RememberSyncRequest¢:
>> sync.c:528:10: warning: assignment to ¡PendingFsyncEntry *¢ {aka ¡struct
>> <anonymous> *¢} from incompatible pointer type ¡PendingUnlinkEntry *¢ {aka
>> ¡struct <anonymous> *¢} [-Wincompatible-pointer-types]
>> 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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2022-07-11 06:18:46 Re: Patch proposal: New hooks in the connection path
Previous Message John Naylor 2022-07-11 05:39:48 Re: NAMEDATALEN increase because of non-latin languages