ctags/vim - Trouble handling expressions with brackets in identifier list

439 views Asked by At

I'm using vim with ctags (exuberant 5.7) to navigate my source code. Some of the functions and variables have some Intel C extension keywords added to them however, namely:

__declspec(target(mic)) double calculate_gamma(int m, int n) { ... }

The problem is that because of the __declspec the ctags neglects to index it so the function calculate_gamma doesn't get tagged.

The fix to this sort of thing with ctags you use the identifier list option -I. However this options hates you if your expression has brackets in it:

$ ctags *.c *.h -I __declspec(target(mic))
-bash: syntax error near unexpected token `('

I've tried putting quotation marks around __declspec, escape characters '\', and ansi-C quoting $'' and these all stop bash from complaining, but then ctags still doesn't tag the function calculate_gamma. If the brackets weren't there this would work.

What am I doing wrong or is there another way to get what I want out of ctags? Cheers.

1

There are 1 answers

0
David T. Pierson On

I think you want:

ctags -I __declspec+ *.c *.h

The -I __declspec essentially tells ctags to ignore __declspec as if it were a macro, and the + suffix means to also ignore the parenthesized arguments which follow __declspec.