8
8
# We suppress the checkLevelNormal warning for Cppcheck versions 2.11 and above.
9
9
# Please refer to issues/153 for more details.
10
10
CPPCHECK_suppresses=" --inline-suppr harness.c \
11
+ --suppress=unmatchedSuppression \
12
+ --suppress=normalCheckLevelMaxBranches \
11
13
--suppress=missingIncludeSystem \
12
14
--suppress=noValidConfiguration \
13
15
--suppress=unusedFunction \
14
16
--suppress=identicalInnerCondition:log2_lshift16.h \
15
17
--suppress=nullPointerRedundantCheck:report.c \
16
18
--suppress=nullPointerRedundantCheck:harness.c \
19
+ --suppress=nullPointerOutOfMemory:harness.c \
20
+ --suppress=staticFunction:harness.c \
21
+ --suppress=nullPointerRedundantCheck:queue.c \
22
+ --suppress=constParameterPointer:queue.c \
17
23
--suppress=nullPointer:queue.c \
18
24
--suppress=nullPointer:qtest.c \
19
25
--suppress=returnDanglingLifetime:report.c \
20
26
--suppress=constParameterCallback:console.c \
21
27
--suppress=constParameterPointer:console.c \
28
+ --suppress=staticFunction:console.c \
22
29
--suppress=checkLevelNormal:log2_lshift16.h \
23
30
--suppress=preprocessorErrorDirective:random.h \
31
+ --suppress=constVariablePointer:linenoise.c \
32
+ --suppress=staticFunction:linenoise.c \
33
+ --suppress=nullPointerOutOfMemory:web.c \
34
+ --suppress=staticFunction:web.c \
24
35
"
25
- CPPCHECK_OPTS=" -I. --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses $CPPCHECK_unmatched ."
36
+ CPPCHECK_OPTS=" -I. --enable=all --error-exitcode=1 --force $CPPCHECK_suppresses $CPPCHECK_unmatched --cppcheck-build-dir=.out ."
26
37
27
38
RETURN=0
28
39
CLANG_FORMAT=$( which clang-format)
@@ -32,6 +43,7 @@ if [ $? -ne 0 ]; then
32
43
fi
33
44
34
45
CPPCHECK=$( which cppcheck)
46
+ mkdir -p .out
35
47
if [ $? -ne 0 ]; then
36
48
echo " [!] cppcheck not installed. Unable to perform static analysis." >&2
37
49
exit 1
127
139
done
128
140
129
141
# static analysis
142
+ echo " Running static analysis..."
130
143
$CPPCHECK $CPPCHECK_OPTS > /dev/null
131
144
if [ $? -ne 0 ]; then
132
145
RETURN=1
0 commit comments