Conditional preprocessor directive confuses global gtags
Felix Fernandes <[email protected]> Thu, 28 Mar 2019 14:17:23 -0700
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I am using Gnu Global 6.6.3 in the terminal on Mac OS Mojave V. 10.14.3.
From the command line, I issued gtags in a directory with file containing j.cc as follows:
#if SWITCH
void foo(int a[8],
#else
void foo(int a[16],
#endif
int b)
{
a[0] = b;
}
void bar(int c, int d)
{
c = d;
}
When I then issued "global -f j.cc", from the command line, no tags were output.
The problem is because of the unbalanced parentheses in conditional preprocessor directive because when j.cc is changed to this, then
gtags followed by "global -f j.cc" works:
void foo(int a[8],
int b)
{
a[0] = b;
}
void bar(int c, int d)
{
c = d;
}
In the ctags documentation, I found this explanation for ctags:
In general, ctags tries to be smart about conditional preprocessor directives. If a preprocessor conditional is
encountered within a statement which defines a tag, ctags follows only the first branch of that conditional
Can gtags similarly be made aware of preprocessor switches?
Thanks,
Felix Fernandes