summaryrefslogtreecommitdiff
path: root/xen/scripts/xen_analysis/cppcheck_analysis.py
Commit message (Collapse)AuthorAgeFilesLines
* cppcheck: globally suppress unusedStructMemberLuca Fancellu2023-03-061-0/+3
| | | | | | | | | unusedStructMember warnings from cppcheck are not reliable and are causing a lot of false positives, suppress the checker globally for now. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
* cppcheck: add a way to exclude files from the scanLuca Fancellu2023-03-061-2/+18
| | | | | | | | | | | | | | | | | | | | | Add a way to exclude files from the scan, in this way we can skip some findings from the report on those files that Xen doesn't own. To do that, introduce the exclude-list.json file under docs/misra, this file will be populated with relative path to the files/folder to be excluded. Introduce a new module, exclusion_file_list.py, to deal with the exclusion list file and use the new module in cppcheck_analysis.py to take a list of excluded paths to update the suppression list of cppcheck. Modified --suppress flag for cppcheck tool to remove unmatchedSuppression findings for those external file that are listed but for example not built for the current architecture. Add documentation for the file. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
* xen/cppcheck: add parameter to skip given MISRA rulesLuca Fancellu2023-02-021-2/+6
| | | | | | | | | | | | | | | | | Add parameter to skip the passed MISRA rules during the cppcheck analysis, the rules are specified as a list of comma separated rules with the MISRA number notation (e.g. 1.1,1.3,...). Modify convert_misra_doc.py script to take an extra parameter giving a list of MISRA rule to be skipped, comma separated. While there, fix some typos in the help and print functions. Modify settings.py and cppcheck_analysis.py to have a new parameter (--cppcheck-skip-rules) used to specify a list of MISRA rule to be skipped during the cppcheck analysis. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
* xen/scripts: add cppcheck tool to the xen-analysis.py scriptLuca Fancellu2022-12-121-0/+273
Add Cppcheck analysis to the xen-analysis.py script using the arguments --run-cppcheck. Now cppcheck analysis will build Xen while the analysis is performed on the source files, it will produce a text report and an additional html output when the script is called with --cppcheck-html. With this patch cppcheck will benefit of platform configuration files that will help it to understand the target of the compilation and improve the analysis. These are XML files placed in xen/tools/cppcheck-plat/, describing to cppcheck the length of basic types to help it in the analysis. To do so: - Update xen-analysis.py with the code to integrate cppcheck. - add platform configuration files for cppcheck.. - add cppcheck-cc.sh script that is a wrapper for cppcheck and it's used as Xen compiler, it will intercept all flags given from the make build system and it will execute cppcheck on the compiled file together with the file compilation. - guarded hypercall-defs.c with CPPCHECK define because cppcheck gets confused as the file does not contain c code. - add false-positive-cppcheck.json file - update documentation. - update .gitignore Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Tested-by: Stefano Stabellini <sstabellini@kernel.org>