File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1386,6 +1386,7 @@ LLVM_BIN := $(shell brew --prefix llvm 2>/dev/null)/bin
13861386CLANG_TIDY ?= $(shell [ -x "$(LLVM_BIN)/clang-tidy" ] && echo "$(LLVM_BIN)/clang-tidy" || echo clang-tidy)
13871387CLANG_FORMAT ?= $(shell [ -x "$(LLVM_BIN)/clang-format" ] && echo "$(LLVM_BIN)/clang-format" || echo clang-format)
13881388CPPCHECK ?= cppcheck
1389+ CPPCHECK_JOBS ?= 2
13891390
13901391# macOS SDK sysroot (needed for Homebrew LLVM to find system headers)
13911392SYSROOT = $(shell xcrun --show-sdk-path 2>/dev/null)
@@ -1410,10 +1411,16 @@ lint-tidy:
14101411lint-tidy-diff:
14111412 @scripts/lint-tidy-diff.sh "$(CLANG_TIDY)" $(LINT_SRCS) -- $(CFLAGS_COMMON) $(SYSROOT_FLAG)
14121413
1413- # cppcheck: complementary analysis (config in .cppcheck)
1414+ # cppcheck: complementary analysis (config in .cppcheck). A build directory
1415+ # retains whole-program analysis with parallel workers; each run owns its state.
14141416lint-cppcheck:
14151417 @echo "=== cppcheck ==="
1416- @$(CPPCHECK) --enable=warning,style,performance,portability \
1418+ @set -e; \
1419+ cppcheck_dir=$$(mktemp -d "$${TMPDIR:-/tmp}/cbm-cppcheck.XXXXXX"); \
1420+ trap 'status=$$?; rm -rf "$$cppcheck_dir" || :; exit "$$status"' EXIT; \
1421+ trap 'exit 129' HUP; trap 'exit 130' INT; trap 'exit 143' TERM; \
1422+ $(CPPCHECK) -j$(CPPCHECK_JOBS) --cppcheck-build-dir="$$cppcheck_dir" \
1423+ --enable=warning,style,performance,portability \
14171424 --std=c11 --language=c \
14181425 --suppressions-list=.cppcheck \
14191426 --error-exitcode=1 \
You can’t perform that action at this time.
0 commit comments