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

Re: [PATCH] docs/misra: Add instructions for cppcheck



Hi Luca,

On 24/06/2022 11:53, Luca Fancellu wrote:
Add instructions on how to build cppcheck, the version currently used
and an example to use the cppcheck integration to run the analysis on
the Xen codebase

Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
  docs/misra/cppcheck.txt | 66 +++++++++++++++++++++++++++++++++++++++++
  1 file changed, 66 insertions(+)
  create mode 100644 docs/misra/cppcheck.txt

diff --git a/docs/misra/cppcheck.txt b/docs/misra/cppcheck.txt
new file mode 100644
index 000000000000..4df0488794aa
--- /dev/null
+++ b/docs/misra/cppcheck.txt
@@ -0,0 +1,66 @@
+Cppcheck for Xen static and MISRA analysis
+==========================================
+
+Xen can be analysed for both static analysis problems and MISRA violation using
+cppcheck, the open source tool allows the creation of a report with all the
+findings. Xen has introduced the support in the Makefile so it's very easy to
+use and in this document we can see how.
+
+First recommendation is to use exactly the same version in this page and 
provide
+the same option to the build system, so that every Xen developer can reproduce
+the same findings.

I am not sure I agree. I think it is good that each developper use their own version (so long it is supported), so they may be able to find issues that may not appear with 2.7.

+
+Install cppcheck in the system

NIT: s/in/on/ I think.

+==============================
+
+Cppcheck can be retrieved from the github repository or by downloading the
+tarball, the version tested so far is the 2.7:
+
+ - https://github.com/danmar/cppcheck/tree/2.7
+ - https://github.com/danmar/cppcheck/archive/2.7.tar.gz
+
+To compile and install it, here the complete command line:
+
+make MATCHCOMPILER=yes \
+    FILESDIR=/usr/share/cppcheck \
+    CFGDIR=/usr/share/cppcheck/cfg \
+    HAVE_RULES=yes \
+    CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" \
+    install

Let me start that I am not convinced that our documentation should explain how to build cppcheck.

But if that's desire, then I think you ought to explain why we need to update CXXFLAGS (I would expect cppcheck to build everywhere without specifying additional flags).

Cheers,

--
Julien Grall



 


Rackspace

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