73 lines
1.4 KiB
Markdown
73 lines
1.4 KiB
Markdown
|
|
# XML output
|
|
|
|
Cppcheck can generate output in XML format. Use `--xml` to enable this format.
|
|
|
|
A sample command to check a file and output errors in the XML format:
|
|
|
|
cppcheck --xml file1.cpp
|
|
|
|
Here is a sample report:
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<results version="2">
|
|
<cppcheck version="1.66">
|
|
<errors>
|
|
<error id="someError" severity="error" msg="short error text"
|
|
verbose="long error text" inconclusive="true" cwe="312">
|
|
<location file0="file.c" file="file.h" line="1"/>
|
|
</error>
|
|
</errors>
|
|
</results>
|
|
|
|
## The `<error>` element
|
|
|
|
Each error is reported in a `<error>` element. Attributes:
|
|
|
|
**id**
|
|
|
|
id of error. These are always valid symbolnames.
|
|
|
|
**severity**
|
|
|
|
error/warning/style/performance/portability/information
|
|
|
|
**msg**
|
|
|
|
the error message in short format
|
|
|
|
**verbose**
|
|
|
|
the error message in long format
|
|
|
|
**inconclusive**
|
|
|
|
this attribute is only used when the error message is inconclusive
|
|
|
|
**cwe**
|
|
|
|
CWE ID for the problem. This attribute is only used when the CWE ID for the message is known.
|
|
|
|
## The `<location>` element
|
|
|
|
All locations related to an error are listed with `<location>` elements. The primary location is listed first.
|
|
|
|
Attributes:
|
|
|
|
**file**
|
|
|
|
filename. both relative and absolute paths are possible.
|
|
|
|
**file0**
|
|
|
|
name of the source file (optional)
|
|
|
|
**line**
|
|
|
|
line number
|
|
|
|
**info**
|
|
|
|
short information for each location (optional)
|
|
|