> On 2 Sep 2022, at 14:57, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Daniel Gustafsson <daniel@yesql.se> writes:
>> Placing code before declarations will generate a compiler warning, so the check
>> must go after trgindex is declared. I've fixed that in the attached to get the
>> cfbot green. Marking this ready for committer in the meantime.
>
> I noticed the same thing, but sticking the CFI immediately after the
> declaration didn't read well either. I was considering moving it to
> the bottom of the loop instead of that.
I was contemplating that too, but kept it at the top after seeing quite a few
examples of that in other contrib modules (like amcheck/verify_nbtree.c and
pg_visibility/pg_visibility.c). I don't have any strong feelings either way,
I'm happy to move it last.
> A possible objection is that
> if there's ever a "continue;" in the loop, those iterations would bypass
> the CFI; but we don't necessarily need a CFI every time.
Yeah, I don't think we need to worry about that. If an added continue;
shortcuts the loop to the point where keeping the CFI last becomes a problem
then it's probably time to look at rewriting the loop.
--
Daniel Gustafsson https://vmware.com/