1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #16509 from fjmolinas/pr_clang_tidy_target

makefiles/clang-tidy: initial support
This commit is contained in:
Marian Buschsieweke 2021-08-31 15:26:33 +02:00 committed by GitHub
commit a3f880c858
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -844,6 +844,8 @@ objdump:
$(call check_cmd,$(OBJDUMP),Objdump program)
$(OBJDUMP) $(OBJDUMPFLAGS) $(ELFFILE) | less
# inlcude clang-tidy
include $(RIOTMAKE)/clang_tidy.inc.mk
# Support Eclipse IDE.
include $(RIOTMAKE)/eclipse.inc.mk

View File

@ -0,0 +1,18 @@
.PHONY: clang-tidy
ifneq (, $(filter clang-tidy,$(MAKECMDGOALS)))
ifneq (llvm,$(TOOLCHAIN))
$(error clang-tidy must be ran with TOOLCHAIN=llvm)
endif
endif
FILE_REFEX = '.([CcHh]|[ch]pp)$$'
DIFF_FILTER ?= 'ACMR'
BASE_BRANCH ?= master
CLANG_TIDY_CHECKS ?= *
CLANG_TIDY_SRCS ?= $(shell git diff --diff-filter=$(DIFF_FILTER) --name-only $(BASE_BRANCH) | grep -E $(FILE_REFEX))
clang-tidy:
$(Q)cd $(RIOTBASE); \
clang-tidy -checks=$(CLANG_TIDY_CHECKS) $(CLANG_TIDY_SRCS) -- $(CFLAGS) $(INCLUDES)