https://stackoverflow.com/a/26725652/257924 specifies a helpful environment variable called GTAGSFORCECPP
to force .h
files to be treated as C++ (as otherwise, C++ class definitions are not added as symbols to the tags database). Ideally, I would not have to set that env var in my startup scripts, but have it be somehow expressed into a centrally located gtags.conf that can be shared with other developers in a network. The gtags manual (specifically this section) is worded in such a way as to lead me to be believe it is possible:
You can use the following environment variables as a string
variable. If these variables are set then environment variables of
the same name are set before command execution.
GREP_COLOR
GREP_COLORS
GTAGSBLANKENCODE
GTAGSCACHE
GTAGSFORCECPP
GTAGSGLOBAL
GTAGSGTAGS
GTAGSLIBPATH
GTAGSLOGGING
GTAGSTHROUGH
GTAGS_OPTIONS
HTAGS_OPTIONS
MAKEOBJDIR
MAKEOBJDIRPREFIX
TMPDIR
The following variables are also available as a string
variable. By default, each of them has a directory path given by
the configure script.
bindir
datadir
libdir
localstatedir
sysconfdir
However, I'm not sure where to express it. For instance adding it like this gives a parsing error, so this is not correct:
#
# Built-in parsers.
#
gtags:\
:tc=common:\
:tc=builtin-parser:\
:GTAGSFORCECPP=1:
Really what I'm after is forcing all .h
files to be treated as C++, so there is probably a better way to go about it.