| 1 |
Cppcheck for Xen static and MISRA analysis |
| 2 |
========================================== |
| 3 |
|
| 4 |
Xen can be analysed for both static analysis problems and MISRA violation using |
| 5 |
cppcheck, the open source tool allows the creation of a report with all the |
| 6 |
findings. |
| 7 |
|
| 8 |
The minimum version required for cppcheck is 2.7. Note that at the time of |
| 9 |
writing (June 2022), the version 2.8 is known to be broken [1]. |
| 10 |
|
| 11 |
Install cppcheck on the system |
| 12 |
============================== |
| 13 |
|
| 14 |
Cppcheck can be retrieved from the github repository or by downloading the |
| 15 |
tarball, the version tested so far is the 2.7: |
| 16 |
|
| 17 |
- https://github.com/danmar/cppcheck/tree/2.7 |
| 18 |
- https://github.com/danmar/cppcheck/archive/2.7.tar.gz |
| 19 |
|
| 20 |
To compile and install it, the complete command line can be found in readme.md, |
| 21 |
section "GNU make", please add the "install" target to that line and use every |
| 22 |
argument as it is in the documentation of the tool, so that every Xen developer |
| 23 |
following this page can reproduce the same findings. |
| 24 |
|
| 25 |
This will compile and install cppcheck in /usr/bin and all the cppcheck config |
| 26 |
files and addons will be installed in /usr/share/cppcheck folder, please modify |
| 27 |
that path in FILESDIR if it's not convinient for your system. |
| 28 |
|
| 29 |
If you don't want to overwrite a possible cppcheck binary installed in your |
| 30 |
system, you can omit the "install" target and FILESDIR, cppcheck will be just |
| 31 |
compiled and the binaries will be available in the same folder. |
| 32 |
If you choose to do that, later in this page it's explained how to use a local |
| 33 |
installation of cppcheck for the Xen analysis. |
| 34 |
|
| 35 |
Dependencies are listed in the readme.md of the project repository. |
| 36 |
|
| 37 |
Use cppcheck to analyse Xen |
| 38 |
=========================== |
| 39 |
|
| 40 |
To analyse Xen using cppcheck, please refer to the document |
| 41 |
xen-static-analysis.rst, section "Analyse Xen with Cppcheck". |
| 42 |
|
| 43 |
[1] https://sourceforge.net/p/cppcheck/discussion/general/thread/bfc3ab6c41/?limit=25 |