views:

109

answers:

1

My emacs version is 23.2.1 Although I used the following to change the backend to use GTAGS. (require 'semantic/db-global) (semanticdb-enable-gnu-global-databases 'c-mode) (semanticdb-enable-gnu-global-databases 'c++-mode) I tried to generate a GTAGS file to be used as a backend of semantic. However, everytime when I open a C file, Semantic is still parsing files without using the GTAGS file.

  1. Is it possible to use the GTAGS file instead of the built-in parser of semantic? I found that the built-in parser is not very accurate.

  2. Is it possible to use the GTAGS file without specifying the project scope? In my case, I tried to put GTAGS file in /usr/include which should be the standard include path of emacs. But Semantics is not using it.

Thanks in advance. Regards, Tommy

+2  A: 

Semantic doesn't use the GTAGS file for generating tags that it will use directly for features such as jumping or smart completion. The GNU Global backend to semantic db will use GTAGS instead as a giant name table. Thus if you need to find a symbol by name, GTAGS will tell semantic where it is, and Semantic will then parse those files itself more directly to get the details.

The reason GTAGS is not used directly as a replacement parser is because the information in GTAGS is insufficient for the kinds of operations Semantic needs, as it excludes datatype info, argument parsing, and local context parsing.

Using gtags in /usr/include is an interesting idea, but would probably not get used much. Semantic will only search header files actually used in your code instead of searching all include files. The GNU Global backend is specifically for scanning an entire project for a symbol, or symbol references. If you wanted to search all your includes for a symbol, then it would be useful, but there is no such feature in Semantic at this time.

It is possible to use ebrowse to do what you want, but I found that for C++, the parser was insufficient in subtle ways, and caused some problems.

If you think the Semantic parser is inaccurate, then you should post that as a bug on the cedet-devel mailing list.

Eric