Skip to content

Commit 96428dd

Browse files
committed
patch 8.1.1093: support for outdated tags format slows down tag parsing
Problem: Support for outdated tags format slows down tag parsing. Solution: Remove FEAT_TAG_OLDSTATIC.
1 parent 372674f commit 96428dd

4 files changed

Lines changed: 31 additions & 76 deletions

File tree

runtime/doc/tagsrch.txt

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*tagsrch.txt* For Vim version 8.1. Last change: 2019 Mar 23
1+
*tagsrch.txt* For Vim version 8.1. Last change: 2019 Mar 30
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -529,28 +529,21 @@ gnatxref For Ada. See http://www.gnuada.org/. gnatxref is
529529
part of the gnat package.
530530

531531

532-
The lines in the tags file must have one of these three formats:
532+
The lines in the tags file must have one of these two formats:
533533

534534
1. {tagname} {TAB} {tagfile} {TAB} {tagaddress}
535-
2. {tagfile}:{tagname} {TAB} {tagfile} {TAB} {tagaddress}
536-
3. {tagname} {TAB} {tagfile} {TAB} {tagaddress} {term} {field} ..
535+
2. {tagname} {TAB} {tagfile} {TAB} {tagaddress} {term} {field} ..
537536

538-
The first is a normal tag, which is completely compatible with Vi. It is the
539-
only format produced by traditional ctags implementations. This is often used
540-
for functions that are global, also referenced in other files.
537+
Previously an old format was supported, see |tag-old-static|.
538+
539+
The first format is a normal tag, which is completely compatible with Vi. It
540+
is the only format produced by traditional ctags implementations. This is
541+
often used for functions that are global, also referenced in other files.
541542

542543
The lines in the tags file can end in <LF> or <CR><LF>. On the Macintosh <CR>
543544
also works. The <CR> and <NL> characters can never appear inside a line.
544545

545-
*tag-old-static*
546-
The second format is for a static tag only. It is obsolete now, replaced by
547-
the third format. It is only supported by Elvis 1.x and Vim and a few
548-
versions of ctags. A static tag is often used for functions that are local,
549-
only referenced in the file {tagfile}. Note that for the static tag, the two
550-
occurrences of {tagfile} must be exactly the same. Also see |tags-option|
551-
below, for how static tags are used.
552-
553-
The third format is new. It includes additional information in optional
546+
The second format is new. It includes additional information in optional
554547
fields at the end of each line. It is backwards compatible with Vi. It is
555548
only supported by new versions of ctags (such as Exuberant ctags).
556549

@@ -598,6 +591,7 @@ only supported by new versions of ctags (such as Exuberant ctags).
598591
The only other field currently recognized by Vim is "file:"
599592
(with an empty value). It is used for a static tag.
600593

594+
601595
The first lines in the tags file can contain lines that start with
602596
!_TAG_
603597
These are sorted to the first lines, only rare tags that start with "!" can
@@ -651,6 +645,21 @@ If the command is a normal search command (it starts and ends with "/" or
651645
followed by white space and a '('. This will find macro names and function
652646
names with a type prepended. {the extra searches are not in Vi}
653647

648+
649+
*tag-old-static*
650+
Until March 2019 (patch 8.1.1092) an outdated format was supported:
651+
{tagfile}:{tagname} {TAB} {tagfile} {TAB} {tagaddress}
652+
653+
This format is for a static tag only. It is obsolete now, replaced by
654+
the second format. It is only supported by Elvis 1.x, older Vim versions and
655+
a few versions of ctags. A static tag is often used for functions that are
656+
local, only referenced in the file {tagfile}. Note that for the static tag,
657+
the two occurrences of {tagfile} must be exactly the same. Also see
658+
|tags-option| below, for how static tags are used.
659+
660+
The support was removed, since when you can update to the new Vim version you
661+
should also be able to update ctags to one that supports the second format.
662+
654663
==============================================================================
655664
6. Include file searches *include-search* *definition-search*
656665
*E387* *E388* *E389*

src/feature.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,9 @@
305305
#endif
306306

307307
/*
308-
* +tag_old_static Old style static tags: "file:tag file ..". Slows
309-
* down tag searching a bit.
308+
* +tag_old_static Old style static tags: "file:tag file ..".
309+
* Support was removed in 8.1.1093.
310310
*/
311-
#ifdef FEAT_NORMAL
312-
# define FEAT_TAG_OLDSTATIC
313-
#endif
314311

315312
/*
316313
* +cscope Unix only: Cscope support.

src/tag.c

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,28 +1964,6 @@ find_tags(
19641964
break;
19651965
}
19661966

1967-
#ifdef FEAT_TAG_OLDSTATIC
1968-
/*
1969-
* Check for old style static tag: "file:tag file .."
1970-
*/
1971-
tagp.fname = NULL;
1972-
for (p = lbuf; p < tagp.tagname_end; ++p)
1973-
{
1974-
if (*p == ':')
1975-
{
1976-
if (tagp.fname == NULL)
1977-
tagp.fname = tagp.tagname_end + 1;
1978-
if (fnamencmp(lbuf, tagp.fname, p - lbuf) == 0
1979-
&& tagp.fname[p - lbuf] == TAB)
1980-
{
1981-
// found one
1982-
tagp.tagname = p + 1;
1983-
break;
1984-
}
1985-
}
1986-
}
1987-
#endif
1988-
19891967
/*
19901968
* Skip this line if the length of the tag is different and
19911969
* there is no regexp, or the tag is too short.
@@ -2098,10 +2076,7 @@ find_tags(
20982076
/*
20992077
* Can be a matching tag, isolate the file name and command.
21002078
*/
2101-
#ifdef FEAT_TAG_OLDSTATIC
2102-
if (tagp.fname == NULL)
2103-
#endif
2104-
tagp.fname = tagp.tagname_end + 1;
2079+
tagp.fname = tagp.tagname_end + 1;
21052080
tagp.fname_end = vim_strchr(tagp.fname, TAB);
21062081
tagp.command = tagp.fname_end + 1;
21072082
if (tagp.fname_end == NULL)
@@ -2201,14 +2176,7 @@ find_tags(
22012176
is_static = FALSE;
22022177
if (!is_etag) /* emacs tags are never static */
22032178
#endif
2204-
{
2205-
#ifdef FEAT_TAG_OLDSTATIC
2206-
if (tagp.tagname != lbuf)
2207-
is_static = TRUE; /* detected static tag before */
2208-
else
2209-
#endif
2210-
is_static = test_for_static(&tagp);
2211-
}
2179+
is_static = test_for_static(&tagp);
22122180

22132181
/* decide in which of the sixteen tables to store this
22142182
* match */
@@ -2870,23 +2838,6 @@ test_for_static(tagptrs_T *tagp)
28702838
{
28712839
char_u *p;
28722840

2873-
#ifdef FEAT_TAG_OLDSTATIC
2874-
int len;
2875-
2876-
/*
2877-
* Check for old style static tag: "file:tag file .."
2878-
*/
2879-
len = (int)(tagp->fname_end - tagp->fname);
2880-
p = tagp->tagname + len;
2881-
if ( p < tagp->tagname_end
2882-
&& *p == ':'
2883-
&& fnamencmp(tagp->tagname, tagp->fname, len) == 0)
2884-
{
2885-
tagp->tagname = p + 1;
2886-
return TRUE;
2887-
}
2888-
#endif
2889-
28902841
/*
28912842
* Check for new style static tag ":...<Tab>file:[<Tab>...]"
28922843
*/

src/version.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,7 @@ static char *(features[]) =
605605
#else
606606
"-tag_binary",
607607
#endif
608-
#ifdef FEAT_TAG_OLDSTATIC
609-
"+tag_old_static",
610-
#else
611608
"-tag_old_static",
612-
#endif
613609
"-tag_any_white",
614610
#ifdef FEAT_TCL
615611
# ifdef DYNAMIC_TCL
@@ -775,6 +771,8 @@ static char *(features[]) =
775771

776772
static int included_patches[] =
777773
{ /* Add new patch number below this line */
774+
/**/
775+
1093,
778776
/**/
779777
1092,
780778
/**/

0 commit comments

Comments
 (0)