xref: /freebsd/contrib/libxo/doc/xolint.rst (revision 02e9120893770924227138ba49df1edb3896112a)
1======
2xolint
3======
4
5`xolint` is a tool for reporting common mistakes in format strings
6in source code that invokes `xo_emit`.  It allows these errors
7to be diagnosed at build time, rather than waiting until runtime.
8
9`xolint` takes the one or more C files as arguments, and reports
10and 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
25The output message will contain the source filename and line number, the
26class of the message, the message, and, if -p is given, the
27line 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
33The "-I" option will generate a table of `xo_info_t`_ structures,
34suitable for inclusion in source code.
35
36.. _xo_info_t: :ref:`field-information`
37
38The "-V" option does not report errors, but prints a complete list of
39all field names, sorted alphabetically.  The output can help spot
40inconsistencies and spelling errors.
41