bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Conditional preprocessor directive confuses global gtags


From: Felix Fernandes
Subject: Conditional preprocessor directive confuses global gtags
Date: Thu, 28 Mar 2019 14:17:23 -0700
User-agent: NeoMutt/20180716

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]