Re: Missing CFI in iterate_word_similarity()
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robins Tharakan <tharakan@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2022-09-02T13:06:34Z
Lists: pgsql-hackers
> 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/
Commits
-
Update out of date comments in pg_trgm
- 6dc0738812c3 16.0 landed
-
Check for interrupts in pg_trgm word similarity
- ae4fc52ae247 16.0 landed
-
Add strict_word_similarity to pg_trgm module
- be8a7a686627 11.0 cited