Re: Missing CFI in iterate_word_similarity()

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robins Tharakan <tharakan(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Missing CFI in iterate_word_similarity()
Date: 2022-09-02 13:06:34
Message-ID: 64010994-D43E-4327-B4C1-8ACED4F7D052@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 2 Sep 2022, at 14:57, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Daniel Gustafsson <daniel(at)yesql(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-09-02 13:16:13 Re: Missing CFI in iterate_word_similarity()
Previous Message Tom Lane 2022-09-02 12:57:00 Re: Missing CFI in iterate_word_similarity()