[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Run cppcheck on Xen


  • To: "fusa-sig@xxxxxxxxxxxxxxxxxxxx" <fusa-sig@xxxxxxxxxxxxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Mon, 27 Sep 2021 15:34:30 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=t6jtLOgcGZ8k82gY/XOAXlO8u5XINsGx1+SyQIBLRLs=; b=fdIWt4gz9rIIEegLl6XjGfLaqF8F32TE72YmHT2I0srOzt6jZQUADGt8W4RpWzAclwvGkzP4k/q1g2kHM608ym37ttB+wknvAGVSXzFINHVojR1WQ2KMzHmHVU4kuG/smJcAQQmny8JcO8H6OVISLRzsJSfc35m/CE7mxkyGBin1yXDY2iiHijFev9CYpvJO53MiAMtS3JJWOAYuJq13FnGYHYL7FXZeJrsWEaZqbuiRJ6Oth56R6/RCPd9TnQhOQ+on/HCs6NbZcmOF35qYFqfv+sP+VXMxSQArLKczTU1Yj7t+CXAwSpWrysR6gUKJ3UbMHRaRDh0uO/9QrX00FQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gnZz4m7TY+h7BiDSerXBArKRMPpFC1ZZXxcnVH5Cb9oJFtshInHSA6ZIMzMaMzdNOHn1DTpSMoVz0lUc/gDKlTa07CNCjii5RENHEC7/cyiZea0GZ2/2AzlGDlAlf+r/76B02Y7Ze0rxDKlqd0yyABF2zlMaeywlXsopgHdPx16cm3AKd8BaDDUgvLhq4M1PG5658qU5876d85Hf8P4NsJn5SrUdTkkw9NrNBoQmHjbKa79spHBpQ2SX969/CEqEHZz9ECyTHXjYebCWNUipKu3f0a4Kl0SspknEMxKAQdx1pjYUeY2s7eQhgEbNWhiG3CA89HcJJfHWvyhPI9un+g==
  • Authentication-results-original: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=arm.com;
  • Delivery-date: Mon, 27 Sep 2021 15:34:53 +0000
  • List-id: This is a discussion list for members of the Xen Project FuSa SIG <fusa-sig.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXs7UqMSxysg0+LUmVyO+m//83JQ==
  • Thread-topic: 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
Description: 0001-xen-Add-a-cppcheck-make-rule.patch


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.