Re: make_ctags: use -I option to ignore pg_node_attr macro

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: make_ctags: use -I option to ignore pg_node_attr macro
Date: 2022-10-10 10:04:22
Message-ID: 20221010100422.emtameznrz4b2bak@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

On 2022-Oct-07, Yugo NAGATA wrote:

> I found that tag files generated by src/tools/make_ctags
> doesn't include some keywords, that were field names of node
> structs, for example norm_select in RestrictInfo. Such fields
> are defined with pg_node_attr macro that was introduced
> recently, like:
>
> Selectivity norm_selec pg_node_attr(equal_ignore);
>
> In this case, pg_node_attr is mistakenly interpreted to be
> the name of the field. So, I propose to use -I option of ctags
> to ignore the marco name. Attached is a patch to do it.

I've wondered if there's anybody that uses this script. I suppose if
you're reporting this problem then it has at least one user, and
therefore worth fixing.

If we do patch it, how about doing some more invasive surgery and
bringing it to the XXI century? I think the `find` line is a bit lame:

> # this is outputting the tags into the file 'tags', and appending
> find `pwd`/ -type f -name '*.[chyl]' -print |
> - xargs ctags -a -f tags "$FLAGS"
> + xargs ctags -a -f tags "$FLAGS" -I "$IGNORE_LIST"

especially because it includes everything in tmp_install, which pollutes
the tag list.

In my own tags script I just call "ctags -R", and I feed cscope with
these find lines

(find $SRCDIR \( -name tmp_install -prune -o -name tmp_check -prune \) -o \( -name "*.[chly]" -o -iname "*makefile*" -o -name "*.mk" -o -name "*.in" -o -name "*.sh" -o -name "*.sgml" -o -name "*.sql" -o -name "*.p[lm]" \) -type f -print ; \
find $BUILDDIR \( -name tmp_install -prune \) -o \( -name \*.h -a -type f \) -print )

which seems to give decent results. (Nowadays I wonder if it'd be
better to exclude the "*_d.h" files from the builddir.)
(I wonder why don't I have a prune for .git ...)

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
¡Ay, ay, ay! Con lo mucho que yo lo quería (bis)
se fue de mi vera ... se fue para siempre, pa toíta ... pa toíta la vida
¡Ay Camarón! ¡Ay Camarón! (Paco de Lucía)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-10-10 10:06:45 Re: [BUG] Logical replica crash if there was an error in a function.
Previous Message Ajin Cherian 2022-10-10 09:58:48 Re: Support logical replication of DDLs