# xref, cxref, any crossref command?



## decuser (Jul 11, 2020)

Is there something similar to `xref` or `cxref` for the source code in FreeBSD? I used `cscope` which isn't bad, but that seems to be purely interactive. I'd like to be able to create a listing of cross references that I can print out and study.


----------



## decuser (Jul 11, 2020)

I found `cxref` in ports and tried it out, but it requires `gcc` which I'm not keen on adding to the system if I can avoid it.


----------



## Jose (Jul 11, 2020)

Personally I use the clangd vscode extension. I've used exuberant ctags with emacs in the past. I searched for "clang tags" and found this: https://github.com/ffevotte/clang-tags

I've never used it, though.


----------



## mark_j (Jul 13, 2020)

decuser said:


> I found `cxref` in ports and tried it out, but it requires `gcc` which I'm not keen on adding to the system if I can avoid it.


It does? Is that as a package?  It's probably saying that in the configure script, when in reality it's only looking for cc. Build it from source.
Specify on the command line of cxref -CPP clang and you're fine.


----------



## decuser (Jul 13, 2020)

Yeah, a `./configure` without gcc installed 'worked.' Unfortunately, `cxref` doesn't know what a _Noreturn is and doesn't work so good on FreeBSD:


```
cxref src/cxref.c
/usr/include/stdlib.h:86: cxref: syntax error

The previous 10, current and next 10 symbols are:
  0 | 291 : void
  1 | 257 : abort
  2 |  40 : (
  3 | 291 : void
  4 |  41 : )
  5 |  59 : ;
  6 | 295 : int
  7 | 257 : abs
  8 |  40 : (
  9 | 295 : int
 10 |  41 : )
```


----------



## mark_j (Jul 13, 2020)

And this is solely a FreeBSD issue?
This is OLD software, not even supported in the ports. Perhaps look for alternatives, ie, Crange


----------



## decuser (Jul 13, 2020)

Yup, that's why I asked the question. `Crange` and `crtags` look like they might just fit the bill. Thanks.


----------

