Menu

#5 Struct member definitions

closed-out-of-date
nobody
None
5
2011-04-08
2002-04-15
No

How can we use Cscope to tell the difference between a
global
definition and a global struct member definition?

For example, if I have the following in a file:

int shoe_size;
struct person
{
char name;
char age;
char shoe_size;
}

Say I want to find the global definition of
"shoe_size". Currently,
cscope returns:

int shoe_size;
char shoe_size;

However, I really only want to know about the global
definition of
shoe_size, not the global struct "person"'s member
definitions. If
there were a lot of different structs that had a member
called
shoe_size, it ends up being a lot of data to sift
through before
obtaining the line that I want when using "Find this
global
definition".

Thanks!

Darlene

Discussion

  • Hans-Bernhard Broeker

    Logged In: YES
    user_id=27517

    This is not a bug --- it's just something cscope currently
    doesn't do. So I reclassified this as a feature request.

    In principle, this would be moderately easy to add. In the
    database cscope.out, struct member definitions already are
    flagged differently from global variables (their tag letter
    is 'm', not 'g'). So it's just a matter of having both the
    fullscreen and the line-oriented interface _display_ that
    fact. I've begun doing that a while ago, but never quite
    finished it. If it's enough to just display <member>
    instead of <global> for these, that would be easy.
    Displaying the actual name of the struct (or union, enum, or
    class) this is a member of makes for a more demanding task
    already. Handling anonymous structs intelligently may turn
    it into truly hard one.

     
  • Sylvain Bertrand

    Logged In: YES
    user_id=453974

    Struct members browsing?

     
  • Nobody/Anonymous

    Logged In: NO

    Was any progress every made on this?

     
  • Hans-Bernhard Broeker

    • status: open --> closed-out-of-date