xref: /freebsd/contrib/libxo/xolint/xolint.1 (revision 6829dae12bb055451fa467da4589c43bd03b1e64)
1.\" #
2.\" # Copyright (c) 2014, Juniper Networks, Inc.
3.\" # All rights reserved.
4.\" # This SOFTWARE is licensed under the LICENSE provided in the
5.\" # ../Copyright file. By downloading, installing, copying, or
6.\" # using the SOFTWARE, you agree to be bound by the terms of that
7.\" # LICENSE.
8.\" # Phil Shafer, July 2014
9.\"
10.Dd December 4, 2014
11.Dt XOLINT 1
12.Os
13.Sh NAME
14.Nm xolint
15.Nd detect errors in programs using
16.Xr xo_emit 3
17.Sh SYNOPSIS
18.Nm xolint
19.Op Fl c
20.Op Fl "C <flags>"
21.Op Fl "d"
22.Op Fl "D"
23.Op Fl "I"
24.Op Fl "p"
25.Op Fl "V"
26.Op Fl "X"
27.Op Ar files...
28.Sh DESCRIPTION
29.Nm
30is a tool for reporting common mistakes in format strings
31in source code that invokes
32.Xr xo_emit 3 .
33It allows these errors
34to be diagnosed at build time, rather than waiting until runtime.
35.Pp
36.Nm
37takes one or more C files as arguments, and reports
38error, warning, or informational messages as needed.
39.Bl -tag -width "C <flags>"
40.It Fl c
41Invoke 'cpp' against the input file
42.It Fl "C <flags>"
43Flags that are passed to 'cpp'
44.It Fl "d"
45Enable debug output
46.It Fl "D"
47Generate documentation for all
48.Nm
49messages
50.It Fl "I"
51Generate a table of
52.Dv xo_info_t
53structures.
54.It Fl "p"
55Print the offending lines after the error message is displayed
56.It Fl "V"
57Do not report errors, but instead print a complete list of
58all field names, sorted alphabetically.
59The output can help spot
60inconsistencies and spelling errors.
61.It Fl "X"
62Extract samples from
63.Nm ,
64suitable for internal testing.
65.El
66.Pp
67The output message contains the source filename and line number, the
68class of the message, the message, and, if
69.Fl p
70is given, the
71line that contains the error:
72.Bd -literal -offset indent
73    % xolint -t xolint.c
74    xolint.c: 16: error: anchor format should be "%d"
75    16         xo_emit("{[:/%s}");
76.Ed
77.Sh SEE ALSO
78.Xr libxo 3 ,
79.Xr xo_emit 3
80.Sh HISTORY
81The
82.Nm libxo
83library first appeared in
84.Fx 11.0 .
85.Sh AUTHORS
86.Nm libxo
87was written by
88.An Phil Shafer Aq Mt phil@freebsd.org .
89
90