From: Alejandro Colomar Date: Mon, 2 May 2022 22:16:56 +0000 (+0200) Subject: CPPLINT.cfg, Makefile, etc/cpplint/CPPLINT.cfg: lint-cpplint: Add new target to run... X-Git-Tag: man-pages-5.19-rc1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff4bbac412839c30fa2d8a7554aaafd1370193ff;p=thirdparty%2Fman-pages.git CPPLINT.cfg, Makefile, etc/cpplint/CPPLINT.cfg: lint-cpplint: Add new target to run cpplint(1) Signed-off-by: Alejandro Colomar --- diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 120000 index 0000000000..766718cd04 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1 @@ +etc/cpplint/CPPLINT.cfg \ No newline at end of file diff --git a/Makefile b/Makefile index da9def5947..932953066f 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,10 @@ DEFAULT_CLANG-TIDYFLAGS += --use-color EXTRA_CLANG-TIDYFLAGS := CLANG-TIDYFLAGS := $(DEFAULT_CLANG-TIDYFLAGS) $(EXTRA_CLANG-TIDYFLAGS) +DEFAULT_CPPLINTFLAGS := +EXTRA_CPPLINTFLAGS := +CPPLINTFLAGS := $(DEFAULT_CPPLINTFLAGS) $(EXTRA_CPPLINTFLAGS) + DEFAULT_IWYUFLAGS := -Xiwyu --no_fwd_decls DEFAULT_IWYUFLAGS += -Xiwyu --error EXTRA_IWYUFLAGS := @@ -156,6 +160,7 @@ MKDIR := mkdir -p RM := rm RMDIR := rmdir --ignore-fail-on-non-empty CLANG-TIDY := clang-tidy +CPPLINT := cpplint IWYU := iwyu CC := cc LD := $(CC) $(CFLAGS) @@ -237,6 +242,7 @@ _UNITS_c := $(filter %.c,$(_UNITS_src)) _UNITS_o := $(patsubst %.c,%.o,$(_UNITS_c)) _UNITS_bin := $(patsubst %.c,%,$(_UNITS_c)) _LINT_clang-tidy := $(patsubst %.c,%.lint.clang-tidy.touch,$(_UNITS_c)) +_LINT_cpplint := $(patsubst %.c,%.lint.cpplint.touch,$(_UNITS_c)) _LINT_iwyu := $(patsubst %.c,%.lint.iwyu.touch,$(_UNITS_c)) MANDIRS := $(sort $(shell find $(MANDIR)/man? -type d)) @@ -416,7 +422,7 @@ builddirs-src: $(_SRCDIRS) ######################################################################## # lint -linters := clang-tidy iwyu groff mandoc +linters := clang-tidy cpplint iwyu groff mandoc lint := $(foreach x,$(linters),lint-$(x)) $(_LINT_clang-tidy): %.lint.clang-tidy.touch: %.c @@ -425,6 +431,11 @@ $(_LINT_clang-tidy): %.lint.clang-tidy.touch: %.c | sed '/generated\.$$/d' touch $@ +$(_LINT_cpplint): %.lint.cpplint.touch: %.c + $(info LINT (cpplint) $@) + $(CPPLINT) $(CPPLINTFLAGS) $< >/dev/null + touch $@ + $(_LINT_iwyu): %.lint.iwyu.touch: %.c $(info LINT (iwyu) $@) $(IWYU) $(IWYUFLAGS) $(CPPFLAGS) $(CFLAGS) $< 2>&1 \ diff --git a/etc/cpplint/CPPLINT.cfg b/etc/cpplint/CPPLINT.cfg new file mode 100644 index 0000000000..edd4ec79fd --- /dev/null +++ b/etc/cpplint/CPPLINT.cfg @@ -0,0 +1,2 @@ +filter=-build/include_subdir,-legal/copyright,-readability/alt_tokens,-readability/casting,-readability/multiline_comment,-runtime/int,-runtime/threadsafe_fn,-whitespace/blank_line,-whitespace/braces +