Re: Converting tab-complete.c's else-if chain to a switch

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers@lists.postgresql.org
Date: 2024-10-07T16:33:25Z
Lists: pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes:
> On Mon, Oct 7, 2024 at 12:11 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Hmm, I should think that if you break anything in tab-complete.in.c,
>> the breakage would propagate to tab-complete.c without difficulty.
>> Do you have an example of something that the preprocessor would mask?

> Fair point, and nope.  Thought withdrawn.

Pushed, then.

The original motivation for all this was to try to get tab completion
working in MSVC builds.  I'm not planning to do anything more towards
that myself, but maybe somebody else would like to have a go at it.

			regards, tom lane



Commits

  1. Don't hard-code the input file name in gen_tabcomplete.pl's output.

  2. Avoid possible segfault in psql's tab completion.

  3. Convert tab-complete's long else-if chain to a switch statement.

  4. Prepare tab-complete.c for preprocessing.

  5. Invent "MatchAnyN" option for tab-complete.c's Matches/MatchesCS.