CXREF(1) Silicon Graphics CXREF(1)NAMEcxref - generate C program cross-reference
SYNOPSIScxref [ options ] files
DESCRIPTION
The cxref command analyzes a collection of C, yacc, and lex files and
attempts to build a cross-reference table. It produces a listing on
standard output of all symbols (auto, static, and global) in each file
separately, or, with the -c option, in combination. Each symbol contains
an asterisk (*) before the declaring reference.
If the environment variable _XPG is defined, cxref operates in
conformance with the X/Open XPG4 specifications. The format of the
output may differ in accordance to the XPG4 standards.
In addition to the -D, -I -nostdinc and -U options [which are interpreted
just as they are by cc(1) and cpp(1)], the following options are
interpreted by cxref:
-c Print a combined cross-reference of all input files.
-h Do not print column headers.
-w<num> Width option which formats output no wider than <num> (decimal)
columns. This option will default to 80 if <num> is not
specified or is less than 51. If _XPG is set then there should
be at least one space between -w and num.
-o file Direct output to file.
-s Operate silently; do not print input file names.
-t Format listing for 80-column width.
-v Print on standard error the arguments passed to sub-passes and
such other information as seems interesting.
-exclude regex
excludes cross-reference data from files whose name matches
regex, where regex is a regular expression(see regex(3)).
-include regex
includes cross-reference data from files whose name matches
regex, where regex is a regular expression(see regex(3)). By
default everything in the named files is cross-referenced. For
example, to cross-reference leaving out all headers from
/usr/include but including <stdio.h>, the following suffices:
Page 1 Release 6.4
CXREF(1) Silicon Graphics CXREF(1)cxref-exclude '/usr/include/.*' -include '.*/stdio.h' test.c
-raw Instead of being processed into a cross reference output, the raw
cross-reference information from the C compiler is passed directly
to the output. The format of this data is described below.
-rawin file
Pass in to cxref for formatting the file as if it were the output of
cxref-raw. The file must be in the proper format: if it is not,
the result will likely be chaos.
DIAGNOSTICS
Most error/warning messages come from the C compiler. The C compiler is
not the same as cc.
RAW DATA FORMAT
A cross raw reference record (the format may change from release to
release) is a line of white-space separated fields. Each record docu-
ments a single cross-reference instance and is terminated with a new-
line. All data is in plain text. All numbers are in decimal.
symaddr
is the integer internal symbol address. Not used.
symname
is the name of a variable or function.
code is one of D,M,A, or R. D if this is a declaration. M if this is a
modification of the variable. A if the address is taken. R if this
is a reference to the variable or function.
filename
is the source file name where found.
line-number
is the line number where the reference was found.
column-number
is the column number where the reference was found.
type is one of B, F, or N. B means this is a function body (so code
above is D). F means this is a function, not a data variable, and
not a function body (code may be D, as a declaration, or A, or R).
N means this is not a function.
scope-level
is an integer giving the current local scope level. Local (inner)
scopes with no declarations are not interesting so they are not
counted.
Page 2 Release 6.4
CXREF(1) Silicon Graphics CXREF(1)
include-depth
is an integer giving the current #include nesting depth.
FILES
/usr/bin/cxref
/usr/lib/ecfe
SEE ALSOcc(1)NOTES
The -acpp option is ignored. There is no way to combine K&R C with ANSI
cpp.
The -nocpp option is ignored. However, cxref accepts files suffixed with
.i as C files.
The -nostdinc option does not work.
cxref attempts to understand many of the options normally passed to
cc(1). Many options are irrelevant to cxref so they are silently
ignored. Options not understood by cxref must not be passed on the com-
mand line.
Since the compiler predefines know and created by cc are not identical
to those built into cxref, it is wise to use -show option to cc to
create a script file with the -D and -U options shown as being passed to
the compiler. Invoke cxref via the script (there are too many -D items
to do this command creation reliably on the command line). Edit the
script to remove options that cxref does not understand.
Some #pragmas known to the regular cc command are not known to cxref, so
useless warnings about unknown pragmas may appear at times.
Page 3 Release 6.4