mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
make: Add CPPCHECK_OPTS to allow excluding files from the check
With swig we now have C files that are generated with tools that are not under our control, so provide an escape hatch for them.
This commit is contained in:
parent
a4c19ba6ba
commit
6c67afeb03
8
Makefile
8
Makefile
@ -84,6 +84,10 @@ PYTHONPATH=$(shell pwd)/contrib/pyln-client:$(shell pwd)/contrib/pyln-testing:$(
|
|||||||
# Collect generated python files to be excluded from lint checks
|
# Collect generated python files to be excluded from lint checks
|
||||||
PYTHON_GENERATED=
|
PYTHON_GENERATED=
|
||||||
|
|
||||||
|
# Options to pass to cppcheck. Mostly used to exclude files that are
|
||||||
|
# generated with external tools that we don't have control over
|
||||||
|
CPPCHECK_OPTS=-q --language=c --std=c11 --error-exitcode=1 --suppressions-list=.cppcheck-suppress --inline-suppr
|
||||||
|
|
||||||
# This is where we add new features as bitcoin adds them.
|
# This is where we add new features as bitcoin adds them.
|
||||||
FEATURES :=
|
FEATURES :=
|
||||||
|
|
||||||
@ -471,10 +475,10 @@ check-includes: check-src-includes check-hdr-includes
|
|||||||
|
|
||||||
# cppcheck gets confused by list_for_each(head, i, list): thinks i is uninit.
|
# cppcheck gets confused by list_for_each(head, i, list): thinks i is uninit.
|
||||||
.cppcheck-suppress:
|
.cppcheck-suppress:
|
||||||
@git ls-files -- "*.c" "*.h" | grep -vE '^ccan/' | xargs grep -n '_for_each' | sed 's/\([^:]*:.*\):.*/uninitvar:\1/' > $@
|
@git ls-files -- "*.c" "*.h" | grep -vE '^(ccan|contrib)/' | xargs grep -n '_for_each' | sed 's/\([^:]*:.*\):.*/uninitvar:\1/' > $@
|
||||||
|
|
||||||
check-cppcheck: .cppcheck-suppress
|
check-cppcheck: .cppcheck-suppress
|
||||||
@trap 'rm -f .cppcheck-suppress' 0; git ls-files -- "*.c" "*.h" | grep -vE '^ccan/' | xargs cppcheck -q --language=c --std=c11 --error-exitcode=1 --suppressions-list=.cppcheck-suppress --inline-suppr
|
@trap 'rm -f .cppcheck-suppress' 0; git ls-files -- "*.c" "*.h" | grep -vE '^ccan/' | xargs cppcheck ${CPPCHECK_OPTS}
|
||||||
|
|
||||||
check-shellcheck:
|
check-shellcheck:
|
||||||
@git ls-files -- "*.sh" | xargs shellcheck
|
@git ls-files -- "*.sh" | xargs shellcheck
|
||||||
|
@ -4,6 +4,7 @@ LIBHSMD_PY_GEN_FILES := contrib/libhsmd_python/swig_wrap.c \
|
|||||||
contrib/libhsmd_python/libhsmd.py
|
contrib/libhsmd_python/libhsmd.py
|
||||||
|
|
||||||
PYTHON_GENERATED += contrib/libhsmd_python/libhsmd.py
|
PYTHON_GENERATED += contrib/libhsmd_python/libhsmd.py
|
||||||
|
CPPCHECK_OPTS += --suppress=nullPointer:contrib/libhsmd_python/swig_wrap.c
|
||||||
|
|
||||||
# Swig by default generates stubs in the file's directory, which is
|
# Swig by default generates stubs in the file's directory, which is
|
||||||
# what we want.
|
# what we want.
|
||||||
|
Loading…
Reference in New Issue
Block a user