]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libxo/doc/xolint.rst
Import libxo-0.9.0:
[FreeBSD/FreeBSD.git] / contrib / libxo / doc / xolint.rst
1
2 xolint
3 ======
4
5 `xolint` is a tool for reporting common mistakes in format strings
6 in source code that invokes `xo_emit`.  It allows these errors
7 to be diagnosed at build time, rather than waiting until runtime.
8
9 `xolint` takes the one or more C files as arguments, and reports
10 and errors, warning, or informational messages as needed:
11
12 ============ ===================================================
13  Option       Meaning
14 ============ ===================================================
15  -c           Invoke 'cpp' against the input file
16  -C <flags>   Flags that are passed to 'cpp
17  -d           Enable debug output
18  -D           Generate documentation for all xolint messages
19  -I           Generate info table code
20  -p           Print the offending lines after the message
21  -V           Print vocabulary of all field names
22  -X           Extract samples from xolint, suitable for testing
23 ============ ===================================================
24
25 The output message will contain the source filename and line number, the
26 class of the message, the message, and, if -p is given, the
27 line that contains the error::
28
29     % xolint.pl -t xolint.c
30     xolint.c: 16: error: anchor format should be "%d"
31     16         xo_emit("{[:/%s}");
32
33 The "-I" option will generate a table of `xo_info_t`_ structures,
34 suitable for inclusion in source code.
35
36 .. _xo_info_t: :ref:`field-information`
37
38 The "-V" option does not report errors, but prints a complete list of
39 all field names, sorted alphabetically.  The output can help spot
40 inconsistencies and spelling errors.