[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Run cppcheck on Xen
Hi Everyone, Enclosed is a patch to add a cppcheck rule to Xen hypervisor makefile. To use it: - configure and build xen - run make cppcheck: make cppcheck CROSS_COMPILE=aarch64-linux-gnu- XEN_TARGET_ARCH=“arm64" By default this will run the standard cppcheck with all checks. To run Misra cppcheck you will need to download and build cppcheck using latest sources (git://github.com/danmar/cppcheck.git) Once build you can do a Misra check on Xen using: make cppcheck CROSS_COMPILE=aarch64-linux-gnu- XEN_TARGET_ARCH=“arm64” CPPCHECK=/path/to/your/cppcheck CPPCHECKARGS="--addon=misra” The cppcheck is generating an output in an xml format in a file xen.cppcheck.xml The most convenient way to actually see the result is to use the html-report tool from cppcheck: ${CPPCHECK_PATH}/htmlreport/cppcheck-htmlreport --file=xen.cppcheck.xml —source-dir=$PWD —report-dir=/my/www/dir Some things to know with this: - I turn on parallel operations of cppcheck (with -j 10) as otherwise it is slow. This disables checks for unusedFunctions but we cannot really use this anyway as cppcheck is not scanning assembler files. If you have lots of cores you can increase the value but reducing it makes the operation take a lot of time - To find which sources to scan, I check which .o files have a .c file inside the makefile. If I have time I might try to use the list of objects directly from Makefile - The check is made for the current configuration of xen with the current compiler configuration. Running cppcheck without any configuration makes to much possibilities and cppcheck cannot handle it If you have any comment on the patch or issues using it, please answer to this mail. I don’t plan into pushing this to xen-devel right now as we are on feature freeze (I will do it after 4.16 release). Cheers Bertrand Attachment:
0001-xen-Add-a-cppcheck-make-rule.patch
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |