Enable Vote from CppCheck
Adjust CppCheck rules to better support TF-M codebase.
CppCheck in TF-M CI has been updated to v2.3.
Vote from CppCheck could be enabled.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: Iff4695f5f7ccbbd95b6ffe9e5585bea4786cab0c
diff --git a/cppcheck/tfm-suppress-list.txt b/cppcheck/tfm-suppress-list.txt
index 25d5261..5cb7571 100644
--- a/cppcheck/tfm-suppress-list.txt
+++ b/cppcheck/tfm-suppress-list.txt
@@ -37,6 +37,7 @@
//CppCheck ignores macros defined on the command line when using a project file
//(e.g. compile_commands.json). As a result we ca not set compiler specific
//macros and need to suppress the following error.
+preprocessorErrorDirective:*/tfm_spm_log.h:34
preprocessorErrorDirective:*/cmsis_compiler.h:320
//While cppcheck states to work fine with missing standard library files, it
@@ -66,3 +67,7 @@
//modified. This is good practice and complies with TF-M guidelines. It should not
//trigger an error.
redundantInitialization:*/security_cnt.c
+
+//Unread variables in the following files in TF-M should not be complained.
+unreadVariable:*/tfm_crypto_func_api.c
+unreadVariable:*/tfm_crypto_secure_api.c
diff --git a/run-cppcheck.sh b/run-cppcheck.sh
index 5a14c56..d6c39fd 100755
--- a/run-cppcheck.sh
+++ b/run-cppcheck.sh
@@ -94,8 +94,8 @@
then
echo "Enabled git-diff mode against hash: $1"
- # Do not execute unused function check when running in diff-mode
- additional_checklist="style,performance,portability,information,missingInclude"
+ # Do not execute unused function check and information check when running in diff-mode
+ additional_checklist="style,performance,portability,missingInclude"
# Grep will set exit status to 1 if a commit does not contain c/cpp.. files
set +e
filtered_cmd_f=compile_commands_filtered.json
@@ -149,7 +149,7 @@
# echo "Check log for errors."
echo "CppCheck needs to be updated. Current Version would fail with no error."
echo "Skip voting for the time being."
- exit 0
+ exit 1
}
EXTRA_ARGS="--error-exitcode=1"