Re: make_ctags: use -I option to ignore pg_node_attr macro - Mailing list pgsql-hackers

From Masahiko Sawada
Subject Re: make_ctags: use -I option to ignore pg_node_attr macro
Date
Msg-id CAD21AoDmCqpS+U6b9Bc-b4OFx3tz=Nv6O2KVkoVg7sHk60spjA@mail.gmail.com
Whole thread Raw
In response to Re: make_ctags: use -I option to ignore pg_node_attr macro  (Tatsuo Ishii <ishii@sraoss.co.jp>)
Responses Re: make_ctags: use -I option to ignore pg_node_attr macro  (Tatsuo Ishii <ishii@sraoss.co.jp>)
List pgsql-hackers
Hi,

On Tue, Feb 14, 2023 at 8:15 PM Tatsuo Ishii <ishii@sraoss.co.jp> wrote:
>
> >> I fixed the above issues and refactored the code.
> >> Attached is the updated version of the patch. Thought?
> >
> > Thank you! Looks good to me.
>
> Fix pushed. Thank you!

In my Mac environment where non-Exuberant ctags and emacs 28.2 are
installed, the generated etags file cannot be loaded by emacs due to
file format error. The generated TAGS file is:

% head -10 TAGS

                                    ) /
sizeof(BlockNumber)sizeof(BlockNumber)117,3750
                                                                my
@newa newa395,10443

variadic array[1,2]:array[1,2]56,1803

variadic array[]::inarray[]::i72,2331

variadic array[array64,2111

variadic array[array68,2222

variadic array[array76,2441
                                                          (2 *  (2 53,1353
                                                        my $fn fn387,10147
                                                        startblock 101,4876

Since the etags files consist of multiple sections[1] we cannot sort
the generated etags file. With the attached patch, make_etags (with
non-Exuberant ctags) generates a correct format etags file and it
works:

% head -10 TAGS

/Users/masahiko/pgsql/source/postgresql/GNUmakefile,1187
subdir 7,56
top_builddir 8,65
docs:docs13,167
world-contrib-recurse:world-contrib-recurse19,273
world-bin-contrib-recurse:world-bin-contrib-recurse24,394
html man:html man26,444
install-docs:install-docs29,474
install-world-contrib-recurse:install-world-contrib-recurse35,604

BTW regarding the following comment, as far as I can read the
Wikipedia page for ctags[1], Exuberant ctags file doesn't have a
header section.

# Exuberant tags has a header that we cannot sort in with the other entries
# so we skip the sort step
# Why are we sorting this?  I guess some tag implementation need this,
# particularly for append mode.  bjm 2012-02-24
if [ ! "$IS_EXUBERANT" ]

Instead, the page says that sorting non-Exuberant tags file allows for
faster searching on of the tags file. I've fixed the comment
accordingly too.

Regards,

[1] https://en.wikipedia.org/wiki/Ctags#Etags_2

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

Attachment

pgsql-hackers by date:

Previous
From: Giuseppe Broccolo
Date:
Subject: Re: vector search support
Next
From: Giuseppe Broccolo
Date:
Subject: Re: vector search support