$cppcheck--enable=all--plist-output=./--addon=misra--xml.
<?xml version="1.0" encoding="UTF-8"?><resultsversion="2"><cppcheckversion="2.11"/><errors>
Checkingmain.c...
<errorid="misra-c2012-12.3"severity="style"msg="misra violation (use --rule-texts=<file> to get proper output)"verbose="misra violation (use --rule-texts=<file> to get proper output)"file0="main.c.25342.dump"><locationfile="header.h"line="4"column="15"/></error></errors></results>
Cppcheck correctly finds the problem on line 4 in header.h, but in the plist file the error is located on line 4 in file 0, which is the main.c file:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plistversion="1.0"><dict><key>clang_version</key><string>cppcheckversion2.11</string><key>files</key><array><string>main.c</string><string>header.h</string></array><key>diagnostics</key><array><dict><key>path</key><array><dict><key>kind</key><string>event</string><key>location</key><dict><key>line</key><integer>4</integer><key>col</key><integer>15</integer><key>file</key><integer>0</integer></dict><key>ranges</key><array><array><dict><key>line</key><integer>4</integer><key>col</key><integer>15</integer><key>file</key><integer>0</integer></dict><dict><key>line</key><integer>4</integer><key>col</key><integer>15</integer><key>file</key><integer>0</integer></dict></array></array><key>depth</key><integer>0</integer><key>extended_message</key><string>misraviolation(use--rule-texts=<file>togetproperoutput)</string><key>message</key><string>misraviolation(use--rule-texts=<file>togetproperoutput)</string></dict></array><key>description</key><string>misraviolation(use--rule-texts=<file>togetproperoutput)</string><key>category</key><string>style</string><key>type</key><string>misraviolation(use--rule-texts=<file>togetproperoutput)</string><key>check_name</key><string>misra-c2012-12.3</string><!-- This hash is experimental and going to change! --><key>issue_hash_content_of_line_in_context</key><string>0</string><key>issue_context_kind</key><string></string><key>issue_context</key><string></string><key>issue_hash_function_offset</key><string></string><key>location</key><dict><key>line</key><integer>4</integer><key>col</key><integer>15</integer><key>file</key><integer>0</integer></dict></dict></array></dict></plist>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
It seems that the plist output is incorrect since all diagnostics are mapped to file 0, which is clearly not correct.
It can be reproduced using the simple example below:
header.h:
main.c:
Cppcheck correctly finds the problem on line 4 in header.h, but in the plist file the error is located on line 4 in file 0, which is the main.c file: