From 4df6ad1a73982c465f884d95f2f01d54a4837aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 8 Apr 2012 11:56:53 +0200 Subject: [PATCH] manual: recommend that xml format version 2 is used --- man/manual.docbook | 149 +++++++++++++++++++++++++++++++-------------- 1 file changed, 103 insertions(+), 46 deletions(-) diff --git a/man/manual.docbook b/man/manual.docbook index e1eea2a63..1e643ad4b 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -5,7 +5,7 @@ Cppcheck 1.53 - 2011-10-07 + 2012-04-08 @@ -283,67 +283,124 @@ Checking path/file2.cpp... XML output - Cppcheck can generate the output in XML format. + Cppcheck can generate the output in XML format. + There is an old XML format (version 1) and a new + XML format (version 2). Please use the new version if + you can. - Use the --xml flag when you - execute cppcheck: + The old version is kept for backwards compatibility only. It will + not be changed. But it will likely be removed someday. Use + --xml to enable this format. - cppcheck --xml file1.cpp + The new version fixes a few problems with the old format. The new + format will probably be updated in future versions of cppcheck with new + attributes and elements. A sample command to check a file and output + errors in the new XML format: - The XML format is: + cppcheck --xml-version=2 file1.cppHere + is a sample version 2 report: - <?xml version="1.0"?> -<results> - <error file="file1.cpp" line="123" id="someError" - severity="error" msg="some error text"/> + <?xml version="1.0" encoding="UTF-8"?> +<results version="2"> + <cppcheck version="1.53"> + <errors> + <error id="someError" severity="error" msg="short error text" + verbose="long error text" inconclusive="true"> + <location file="file.c" line="1"/> + </error> + </errors> </results> - Attributes: +
+ The <error> element - - - file + Each error is reported in a <error> + element. Attributes: - - filename. Both relative and absolute paths are possible - - + + + id - - line + + id of error. These are always valid symbolnames. + + - - a number - - + + severity - - id + + either: error, + warning, style, + performance, portability or + information + + - - id of error. These are always valid symbolnames. - - + + msg - - severity + + the error message in short format + + - - either error or - style. - warning and performance - are saved as style. - - + + verbose - - msg + + the error message in long format. + + - - the error message - - - + + inconclusive + + + This attribute is only used when the message is + inconclusive. + + + +
+ +
+ The <location> element + + All locations related to an error is listed with + <location> elements. The primary location is + listed first. + + Attributes: + + + + file + + + filename. Both relative and absolute paths are + possible + + + + + line + + + a number + + + + + msg + + + this attribute doesn't exist yet. But in the future we may + add a short message for each location. + + + +