blob: 5cb75711c88aed1ac057fb996c7e0f30f05e904c [file] [log] [blame]
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +01001//-------------------------------------------------------------------------------
Hugo L'Hostisfa96af22021-01-11 12:25:35 +00002// Copyright (c) 2018-2021, Arm Limited and Contributors. All rights reserved.
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +01003//
4// SPDX-License-Identifier: BSD-3-Clause
5//
6//-------------------------------------------------------------------------------
7
8//This file contains suppression rules for CppCheck.
9//C style comments can be used.
10//
11//Each line has three parts separated by ":"
12//<message id>:<file>:<line num>
13//Where:
14// <message id> is the message id to suppress. This equals to the "id" filed
15// of the XML message record.
16// <file> Is a file name. cppcheck understands the following wildcards:
17// * matches any number of any characters
18// ? a single character
19// Note: please use '/' as directory separator.
20// <line num> The line number for which the message shall be ignored.
21//
22//Example to convert an XML record to a line in thif file:
23// <error id="invalidPrintfArgType_sint" severity="warning" msg="%d in format string (no. 1) requires &apos;int&apos; but the argument type is &apos;unsigned int&apos;." verbose="%d in format string (no. 1) requires &apos;int&apos; but the argument type is &apos;unsigned int&apos;." cwe="686">
24// <location file0="C:\work\tf-m\test\framework\test_framework.c" file="C:\work\tf-m\test\framework\test_framework.c" line="150"/>
25// </error>
26// to
27//invalidPrintfArgType_sint:*/tf-m/test/framework/test_framework.c:150
28//
29
30//This rule conflicts the our coding style document.
31variableScope
32
33//CppCheck fails to understand macro definitions in compile_commands.json, which
34//have \ characters escaping the opening and closing ". As a result we get the
35//following false alarms.
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010036
37//CppCheck ignores macros defined on the command line when using a project file
38//(e.g. compile_commands.json). As a result we ca not set compiler specific
39//macros and need to suppress the following error.
Xinyu Zhang7de294d2021-03-08 10:09:32 +080040preprocessorErrorDirective:*/tfm_spm_log.h:34
Minos Galanakisf4ca6ac2017-12-11 02:39:21 +010041preprocessorErrorDirective:*/cmsis_compiler.h:320
42
43//While cppcheck states to work fine with missing standard library files, it
44//still reports a lot of errors regarding those.
45//So, ignore these.
46missingIncludeSystem
47
48//Stos cppcheck report errors regarding supression rules. These seem to be
49//buggy.
50unmatchedSuppression
51
52//arm_cmse.h is a special system include, stop complaining about it.
53missingInclude:*/tfm_core.h:11
54missingInclude:*/tfm_secure_api.h:11
Minos Galanakisea421232019-06-20 17:11:28 +010055
56//Exclude external qcbor code which does not comply with guidelines
Xinyu Zhang726aaa52021-02-20 15:56:54 +080057*:*/lib/*
58*:*/docs/*
59*:*/tools/*
Minos Galanakisea421232019-06-20 17:11:28 +010060*:*/bl2/ext/*
61*:*/platform/ext/*
Hugo L'Hostisfa96af22021-01-11 12:25:35 +000062
63//cppcheck shouldn't complain about unused function.
64unusedFunction
65
66//Variables in the following file are initialised to a specific value before being
67//modified. This is good practice and complies with TF-M guidelines. It should not
68//trigger an error.
69redundantInitialization:*/security_cnt.c
Xinyu Zhang7de294d2021-03-08 10:09:32 +080070
71//Unread variables in the following files in TF-M should not be complained.
72unreadVariable:*/tfm_crypto_func_api.c
73unreadVariable:*/tfm_crypto_secure_api.c