Thomas Munro <thomas.mu...@enterprisedb.com> writes: > On Fri, Sep 21, 2018 at 5:52 PM Andres Freund <and...@anarazel.de> wrote: >> Here's a very quick-and-dirty implementation of this approach. Some very >> very brief testing seems to indicate it works, although I'm sure not >> perfectly.
> And here is a quick-and-dirty variadic COMPLETE_WITH(...). Together: I'm a bit inclined to get rid of the need for PP_NARG() by instead making the macros add a trailing NULL argument, viz #define TailMatches(...) \ CheckTailMatchesFor(previous_words_count, previous_words, __VA_ARGS__, NULL) This'd require (some of) the implementation functions to iterate over their variadic arguments twice, the first time merely counting how many there are. But we aren't exactly concerned about max runtime performance here, and the PP_NARG() thing seems like a crock that could easily blow out compilation time on some compilers. If people are OK with that design decision, I'm happy to assemble these pieces and push it through. I just had to add two more versions of HeadMatchesN :-( so I'm feeling motivated to make something happen. regards, tom lane