88# We suppress the checkLevelNormal warning for Cppcheck versions 2.11 and above.
99# Please refer to issues/153 for more details.
1010CPPCHECK_suppresses=" --inline-suppr harness.c \
11+ --suppress=unmatchedSuppression \
12+ --suppress=normalCheckLevelMaxBranches \
1113--suppress=missingIncludeSystem \
1214--suppress=noValidConfiguration \
1315--suppress=unusedFunction \
1416--suppress=identicalInnerCondition:log2_lshift16.h \
1517--suppress=nullPointerRedundantCheck:report.c \
1618--suppress=nullPointerRedundantCheck:harness.c \
19+ --suppress=nullPointerOutOfMemory:harness.c \
20+ --suppress=staticFunction:harness.c \
21+ --suppress=nullPointerRedundantCheck:queue.c \
22+ --suppress=constParameterPointer:queue.c \
1723--suppress=nullPointer:queue.c \
1824--suppress=nullPointer:qtest.c \
1925--suppress=returnDanglingLifetime:report.c \
2026--suppress=constParameterCallback:console.c \
2127--suppress=constParameterPointer:console.c \
28+ --suppress=staticFunction:console.c \
2229--suppress=checkLevelNormal:log2_lshift16.h \
2330--suppress=preprocessorErrorDirective:random.h \
31+ --suppress=constVariablePointer:linenoise.c \
32+ --suppress=staticFunction:linenoise.c \
33+ --suppress=nullPointerOutOfMemory:web.c \
34+ --suppress=staticFunction:web.c \
2435"
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 ."
2637
2738RETURN=0
2839CLANG_FORMAT=$( which clang-format)
@@ -32,6 +43,7 @@ if [ $? -ne 0 ]; then
3243fi
3344
3445CPPCHECK=$( which cppcheck)
46+ mkdir -p .out
3547if [ $? -ne 0 ]; then
3648 echo " [!] cppcheck not installed. Unable to perform static analysis." >&2
3749 exit 1
127139done
128140
129141# static analysis
142+ echo " Running static analysis..."
130143$CPPCHECK $CPPCHECK_OPTS > /dev/null
131144if [ $? -ne 0 ]; then
132145 RETURN=1
0 commit comments