Re: [Ctags] C-tags for Multiple definition of function
Brought to you by:
dhiebert
From: <ga...@ca...> - 2002-06-05 19:08:31
|
Normally, ctags will (only) generate a tag for the definition, and not the declaration...so if you're only getting a tag for the definition, something is unusal. It could also be the "style" of the source code; let me explain. By default, for functions anyway, ctags uses patterns to identify the location of a tag (as opposed to a line number) that way if code is added or moved around, the tag remains valid. Take the following example: // Declaration static int foo(int); ... // Definition static int foo( int my_arg ) { <function code> } The tag generated for 'foo' will be something like: foo <file> /^static int foo($/;" function Which would match the function definition, and not the declaration. However, say I had the code like this: // Declaration static int foo( int ); ... // Definition static int foo( int my_arg ) { <function code> } The tag generated for 'foo' would still look the same, but the pattern used to locate the tag would now also match the function's declaration. Make sense? A possible solution to this would be to use the -B option to ctags, which will generate backward-searching patterns, which would have the effect of locating the function instead of the prototype, since the prototype comes first in the file. -gary / FROM: Vinod Khandkar <vi...@ya...>, Jun 5 9:07 2002 | ABOUT: Re: [Ctags] C-tags for Multiple definition of function | | hi gary, | One more help please.. | It worked well in case of declaration and the | definition of functions are in different files but if | both are in same file then since ctags are generating | the tags only for first occurance i.e. the declaration | of function it is not showing the definition of | function in the match list. Can u please help me in | getting multiple tags. | | regards, | Vinod. |