[Top][All Lists]

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

Re: CEDET merge question

From: Richard Stallman
Subject: Re: CEDET merge question
Date: Mon, 14 Sep 2009 14:28:37 -0400

    Etags, ctags, gnu global, idutils and cscope all have parsers of some
    sort that parse C and C++ code.  Some use regexp matchers.  Others have
    primitive parsers.

    gcc, of course, has a full language compliant parser which it uses to
    compile code.  I'm not a gcc expert, but I assume that as it parses, it
    keeps track of the various symbols (functions, variables, namespaces,
    etc) and where they are.  (ie - debug info for gdb).

Now I know what you are talking about.  This idea seems very
appealing, but it has a grave flaw.  The flaw comes from the way GCC
handles input: it does preprocessing first, and real parsing operates
only on the output of preprocessing.  So the output that GCC can
easily make would describe only the output of preprocessing.
Definitions and calls which are not actually compiled won't be seen at
all.  Macros and references to them won't be seen at all.

What etags does now is much better, because it avoids that problem.

It is true that output from GCC would give more details about types,
etc., and would avoid getting confused in a few strange situations.
So there is indeed an advantage to generating the output from GCC.
But the disadvantage is much more important.

I designed a way to make GCC analyze and report on macros and on the
code that's not compiled in.  That would get the best of both aspects.
But this is not a small job.  Please don't ask me to write more
details unless you're prepared to do a substantial amount of work
and study the GCC parsing code carefully.

reply via email to

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