[Top][All Lists]

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

Re: #line compiler directives in results.

From: Chris Grebeldinger
Subject: Re: #line compiler directives in results.
Date: Mon, 3 Mar 2008 10:05:34 -0500

I've decided it is probably easier to work-around my issue within my editor.  So I just created an emacs function which parses the #line directive (after using gtags-find-tag) and loads the referenced file and line number.  This seems almost as good as post-processing the tags file.


On Sat, Feb 9, 2008 at 9:46 AM, Chris Grebeldinger <address@hidden> wrote:
I understand that I can add my special suffix, but what I really want is to process c++ files but have each tag point back to the original pre-processed file via the embedded #line directives:

/v/main/src/myclass.pre -special syntax c++

/v/main/work/myclass.cxx  - plain c++ with #line directives pointing back to myclass.pre
#line 1 "/v/main/src/myclass.pre"
class myclass {
#line 2 "/v/main/src/myclass.pre"
#line 3 "/v/main/src/myclass.pre"

So I run gtags on myclass.cxx, which generates tags properly, but i want all the tags to respect the #line directives for file & line information in the tags file.

so that tag:
myclass::myclass() ---> myclass.pre, line 2
instead of myclass.cxx, line 5


On Feb 7, 2008 7:17 AM, Shigio YAMAGUCHI <address@hidden> wrote:
>   Many of the source files I am working with are pre-processed C++ with
> their own special syntax, and the resulting .cpp files have #line directives
> throughout which refer back to the un-processed source.  I am generating
> tags from the resulting .cpp files.  Is there any way to configure global to
> handle those directives, so that search results only include the
> un-processed files?

You can configure it. Please copy and rewrite configuration file for gtags.
It is assumed that the suffix of your files is '.XYZ'.

$ cp /usr/local/share/gtags.conf $HOME/.globalrc        # copy configuration file into
                                                       # your home directory
$ vi $HOME/.globalrc                                    # rewrite cpp: entry


$ cd [your source directory]
$ gtags

But I don't know whether gtags can treat the special syntax in your source file.
Luck is wished.
Shigio YAMAGUCHI <address@hidden> - GNU Project
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

reply via email to

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