Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1e2a38

Browse filesBrowse files
committed
Enhance make_ctags and make_etags.
make_ctags did not include field members of structs since the commit 964d01a. For example, in the following field of RestrictInfo: Selectivity norm_selec pg_node_attr(equal_ignore); pg_node_attr was mistakenly interpreted to be the name of the field. To fix this, add -I option to ctags command if the command is Exuberant ctags or Universal ctags (for plain old ctags, struct members are not included in the tags file anyway). Also add "-e" and "-n" options to make_ctags. The -e option invokes ctags command with -e option, which produces TAGS file for emacs. This allows to eliminate duplicate codes in make_etags so that make_etags just exec make_ctags with -e option. The -n option allows not to produce symbolic links in each sub directory (the default is producing symbolic links). Author: Yugo Nagata Reviewers: Alvaro Herrera, Tatsuo Ishii Discussion: https://postgr.es/m/flat/20221007154442.76233afc7c5b255c4de6528a%40sraoss.co.jp
1 parent c68ec1b commit d1e2a38
Copy full SHA for d1e2a38

File tree

2 files changed

+48
-22
lines changed
Filter options

2 files changed

+48
-22
lines changed

‎src/tools/make_ctags

Copy file name to clipboardExpand all lines: src/tools/make_ctags
+45-9Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
#!/bin/sh
22

3-
# src/tools/make_ctags
3+
# src/tools/make_ctags [-e] [-n]
4+
# If -e is specified, generate tags files for emacs.
5+
# If -n is specified, don't create symbolic links of tags file.
6+
usage="Usage: $0 [-e][-n]"
7+
if [ $# -gt 2 ]
8+
then echo $usage
9+
exit 1
10+
fi
11+
12+
MODE=
13+
NO_SYMLINK=
14+
TAGS_FILE="tags"
15+
16+
while [ $# -gt 0 ]
17+
do
18+
if [ $1 = "-e" ]
19+
then MODE="-e"
20+
TAGS_FILE="TAGS"
21+
elif [ $1 = "-n" ]
22+
then NO_SYMLINK="Y"
23+
else
24+
echo $usage
25+
exit 1
26+
fi
27+
shift
28+
done
429

530
command -v ctags >/dev/null || \
631
{ echo "'ctags' program not found" 1>&2; exit 1; }
732

833
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
9-
rm -f ./tags
34+
rm -f ./$TAGS_FILE
1035

1136
IS_EXUBERANT=""
1237
ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
@@ -34,9 +59,17 @@ then FLAGS="--c-kinds=+dfmstuv"
3459
else FLAGS="-dt"
3560
fi
3661

62+
# Use -I option to ignore a macro
63+
if [ "$IS_EXUBERANT" ]
64+
then IGNORE_IDENTIFIES="-I pg_node_attr+"
65+
else IGNORE_IDENTIFIES=
66+
fi
67+
3768
# this is outputting the tags into the file 'tags', and appending
38-
find `pwd`/ -type f -name '*.[chyl]' -print |
39-
xargs ctags -a -f tags "$FLAGS"
69+
find `pwd`/ \( -name tmp_install -prune -o -name tmp_check -prune \) \
70+
-o \( -name "*.[chly]" -o -iname "*makefile*" -o -name "*.mk" -o -name "*.in" \
71+
-o -name "*.sql" -o -name "*.p[lm]" \) -type f -print |
72+
xargs ctags $MODE -a -f $TAGS_FILE "$FLAGS" "$IGNORE_IDENTIFIES"
4073

4174
# Exuberant tags has a header that we cannot sort in with the other entries
4275
# so we skip the sort step
@@ -45,10 +78,13 @@ find `pwd`/ -type f -name '*.[chyl]' -print |
4578
if [ ! "$IS_EXUBERANT" ]
4679
then LC_ALL=C
4780
export LC_ALL
48-
sort tags >/tmp/$$ && mv /tmp/$$ tags
81+
sort $TAGS_FILE >/tmp/$$ && mv /tmp/$$ $TAGS_FILE
4982
fi
5083

51-
find . \( -name 'CVS' -prune \) -o \( -name .git -prune \) -o -type d -print |
52-
while read DIR
53-
do [ "$DIR" != "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/tags "$DIR"/tags
54-
done
84+
# create symbolic links
85+
if [ ! "$NO_SYMLINK" ]
86+
then find . \( -name 'CVS' -prune \) -o \( -name .git -prune \) -o -type d -print |
87+
while read DIR
88+
do [ "$DIR" != "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/$TAGS_FILE "$DIR"/$TAGS_FILE
89+
done
90+
fi

‎src/tools/make_etags

Copy file name to clipboard
+3-13Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
#!/bin/sh
2-
32
# src/tools/make_etags
43

5-
command -v etags >/dev/null || \
6-
{ echo "'etags' program not found" 1>&2; exit 1; }
7-
8-
rm -f ./TAGS
9-
10-
find `pwd`/ -type f -name '*.[chyl]' -print |
11-
xargs etags --append -o TAGS
12-
13-
find . \( -name CVS -prune \) -o \( -name .git -prune \) -o -type d -print |
14-
while read DIR
15-
do [ "$DIR" != "." ] && ln -f -s `pwd`/TAGS "$DIR"
16-
done
4+
cdir=`dirname $0`
5+
dir=`(cd $cdir && pwd)`
6+
exec $dir/make_ctags -e $*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.