2022-12-02 11:50:15 +01:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
std="c99"
|
2023-06-15 17:25:54 +02:00
|
|
|
NProc=$(( $(nproc) / 4 ))
|
|
|
|
if [ -z "$NProc" ] || [ "$NProc" -lt 1 ]; then NProc="1"; fi
|
2022-12-02 11:50:15 +01:00
|
|
|
|
|
|
|
run_cppcheck() {
|
|
|
|
cppcheck --std="$std" --enable=performance,portability \
|
|
|
|
--force --quiet --inline-suppr --error-exitcode=1 \
|
2023-06-15 17:25:54 +02:00
|
|
|
--max-ctu-depth=8 -j"$NProc" \
|
|
|
|
$(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG \
|
2022-12-02 11:50:15 +01:00
|
|
|
--suppress=varFuncNullUB --suppress=uninitvar \
|
2023-06-15 17:25:54 +02:00
|
|
|
$(git ls-files *.c)
|
2022-12-02 11:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
run_tidy() {
|
|
|
|
checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)"
|
2023-06-15 17:25:54 +02:00
|
|
|
git ls-files *.c | xargs -P"$NProc" -I{} clang-tidy --quiet \
|
|
|
|
--warnings-as-errors="*" --checks="$checks" {} \
|
|
|
|
-- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG
|
2022-12-02 11:50:15 +01:00
|
|
|
}
|
|
|
|
|
2023-06-15 17:25:54 +02:00
|
|
|
run_cppcheck "0" & run_cppcheck "1" & run_tidy "0" & run_tidy "1";
|
|
|
|
wait
|