views:

51

answers:

1

I maintain several modest-sized C programs, and I frequently have a use for fully accurate cross-reference information. Unlike "tags" or other approximations, such information is typically generated by a compiler that knows the full scoping rules of the C language and can provide accurate information accordingly. For example, here is a snippet of information obtained from the lcc compiler:

function eval src=scheme.nw:4101.0 use=scheme.nw:4101.0
  use=scheme.nw:4174.35 use=scheme.nw:4334.11 use=scheme.nw:4335.11
  use=scheme.nw:4337.11 use=scheme.nw:4340.14 use=scheme.nw:4341.4
  use=scheme.nw:4351.12 use=scheme.nw:4305.32 use=scheme.nw:4324.29
  use=scheme.nw:4278.7 use=scheme.nw:4201.8 use=scheme.nw:4234.11
  type=struct Value function(pointer to struct Exp,pointer to incomplete
  struct Env defined at scheme.nw:3889) sclass=auto scope=GLOBAL flags=0
  ref=3.710000 ncalls=46

This tells me that function eval is define in source file scheme.nw, line 4101, column 0, and it lists all the places that eval is used as well.

My problem: lcc works only for ANSI C, and most of my projects are migrating to C99. What compiler or tool will provide fully accurate cross-reference information for C99 programs?

Linux support is a must; free software would be nice but is not absolutely required.

+3  A: 

The Clang index library seems like a pretty decent candidate. I haven't done serious conformance testing on it personally, but they claim that the only missing C99 features are the floating point pragmas (which shouldn't affect cross-reference generation).

Jerry Coffin
Looks useful, but bloody complicated. Will take a while to evaluate. Thanks for the pointer. +1
Norman Ramsey