fix(tools/cppcheck): suppress misra warnings
Suppress misra warning rules-
misra-c2012-12.3 - Comma should not be used
misra-config - To suppress COMPILER_ASSERT warnings
Suppress cppcheck warning due to const params/variables.
Also added `checkers-report` to the cppcheck cmdline as
this gives details on the checkers invoked and there
was an error from the tool without this option.
Change-Id: I56701f11794307a854521e087455811d01bc9577
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
diff --git a/tools/cppcheck/CPPCheck.cmake b/tools/cppcheck/CPPCheck.cmake
index 81411a1..fc90ab8 100644
--- a/tools/cppcheck/CPPCheck.cmake
+++ b/tools/cppcheck/CPPCheck.cmake
@@ -18,7 +18,7 @@
list(APPEND cppcheck-flags "--xml")
list(APPEND cppcheck-flags "--xml-version=2")
list(APPEND cppcheck-flags "--template=gcc")
-
+list(APPEND cppcheck-flags "--check-level=exhaustive")
if(CPPCHECK_MISRA)
list(APPEND cppcheck-flags "--addon=${SOURCE_DIR}/tools/cppcheck/misra.json")
@@ -31,6 +31,7 @@
list(APPEND cppcheck-flags "--output-file=${CPPCHECK_OUTPUT}")
list(APPEND cppcheck-flags "--cppcheck-build-dir=${CPPCHECK_BUILD_DIR}")
+list(APPEND cppcheck-flags "--checkers-report=${BUILD_DIR}/tools/cppcheck/checkers.log")
#
# Exclude files or directories we don't want to receive warnings about.
diff --git a/tools/cppcheck/misra.json b/tools/cppcheck/misra.json
index e4b3624..4712186 100644
--- a/tools/cppcheck/misra.json
+++ b/tools/cppcheck/misra.json
@@ -1,7 +1,7 @@
{
"script": "misra.py",
"args": [
- "--suppress-rules=1.2,2.5,3.1,5.7,8.5,8.6,8.9,8.12,8.13,9.5,10.5,10.8,11.3,11.4,11.5,11.6,13.3,15.1,15.4,15.5,15.7,16.1,16.2,16.3,16.5,16.6,17.1,17.8,17.12,19.2,20.6,20.10,20.12,21.1,21.2,21.6",
+ "--suppress-rules=1.2,2.5,3.1,5.7,8.5,8.6,8.9,8.12,8.13,9.5,10.5,10.8,11.3,11.4,11.5,11.6,12.3,13.3,15.1,15.4,15.5,15.7,16.1,16.2,16.3,16.5,16.6,17.1,17.8,17.12,19.2,20.6,20.10,20.12,21.1,21.2,21.6",
"--rule-texts=./tools/cppcheck/misra.rules"
]
}
diff --git a/tools/cppcheck/suppressions.txt b/tools/cppcheck/suppressions.txt
index 56848ed..3253dae 100644
--- a/tools/cppcheck/suppressions.txt
+++ b/tools/cppcheck/suppressions.txt
@@ -19,5 +19,13 @@
// Ignore unusedLabel which triggers false positives for COMPILER_ASSERT_ZERO
unusedLabel
+// Ignore COMPILER_ASSERT error
+misra-config
+
+// Ignore const errors
+constVariablePointer
+constParameterPointer
+constParameter
+
// Ignore errors in ext folder
-*:ext/
+*:*/ext/*