diff --git a/share/Makefile.linting b/share/Makefile.linting index 3732ffeda6bfc0e6b937044b7249fca0af7bad09..478e3c75f7fb9fa80b376d235124df6ede5516de 100644 --- a/share/Makefile.linting +++ b/share/Makefile.linting @@ -141,11 +141,17 @@ clean:: clean-lint #### clean-check-XXX targets -LINT.clean-targets= \ - clean-check-eoleof clean-check-utf8 clean-check-syntax \ - clean-check-indent clean-check-clang-format +LINT.clean-targets= + +# Same list on both lines +LINT.clean-targets+= \ + clean-check-eoleof clean-check-utf8 clean-check-syntax .PHONY: clean-check-eoleof clean-check-utf8 clean-check-syntax \ - clean-check-indent clean-check-clang-format + +# Same list on both lines +LINT.clean-targets+= \ + clean-check-indent +.PHONY: clean-check-indent # Generic rule $(LINT.clean-targets): @@ -162,6 +168,7 @@ LINT.dir=$(wildcard $(LINT_DIR)) #### check-XXX targets +# Same list on both lines LINT.check-targets= \ check-syntax check-indent check-clang-format check-eoleof check-utf8 .PHONY: check-syntax check-indent check-clang-format check-eoleof check-utf8 @@ -176,9 +183,10 @@ $(LINT.check-targets): #### fix-XXX targets +# Same list on both lines LINT.fix-targets= \ - fix-eoleof fix-utf8 fix-syntax fix-indent fix-clang-format -.PHONY: fix-eoleof fix-utf8 fix-syntax fix-indent fix-clang-format + fix-eoleof fix-utf8 fix-syntax fix-indent +.PHONY: fix-eoleof fix-utf8 fix-syntax fix-indent # Generic rule $(LINT.fix-targets): @@ -199,13 +207,30 @@ LINT_FILE.check-utf8= $(addsuffix .check-utf8,$(LINT_FILE.list)) LINT_FILE.check-eoleof= $(addsuffix .check-eoleof,$(LINT_FILE.list)) LINT_FILE.check-syntax= $(addsuffix .check-syntax,$(LINT_FILE.list)) LINT_FILE.check-indent= $(addsuffix .check-indent,$(LINT_FILE.list)) -LINT_FILE.check-clang-format= $(addsuffix .check-clang-format,$(LINT_FILE.list)) LINT_FILE.fix-utf8= $(addsuffix .fix-utf8,$(LINT_FILE.list)) LINT_FILE.fix-eoleof= $(addsuffix .fix-eoleof,$(LINT_FILE.list)) LINT_FILE.fix-syntax= $(addsuffix .fix-syntax,$(LINT_FILE.list)) LINT_FILE.fix-indent= $(addsuffix .fix-indent,$(LINT_FILE.list)) -LINT_FILE.fix-clang-format= $(addsuffix .fix-clang-format,$(LINT_FILE.list)) + +## Filters for the extension for check/fix-indent + +# ML filter +LINT_FILE.ml-indent = $(filter $(addsuffix .ml,$(basename $(LINT_FILE.list))),$(LINT_FILE.list)) +LINT_FILE.ml-indent+= $(filter $(addsuffix .mli,$(basename $(LINT_FILE.list))),$(LINT_FILE.list)) +LINT_FILE.check-ml-indent= $(addsuffix .check-indent,$(LINT_FILE.ml-indent)) +LINT_FILE.fix-ml-indent= $(addsuffix .fix-indent,$(LINT_FILE.ml-indent)) + +# C filter +LINT_FILE.c-indent =$(filter $(addsuffix .c,$(basename $(LINT_FILE.list))),$(LINT_FILE.list)) +LINT_FILE.c-indent+= $(filter $(addsuffix .h,$(basename $(LINT_FILE.list))),$(LINT_FILE.list)) +LINT_FILE.check-c-indent= $(addsuffix .check-indent,$(LINT_FILE.c-indent)) +LINT_FILE.fix-c-indent= $(addsuffix .fix-indent,$(LINT_FILE.c-indent)) + + +LINT_FILE.check-unknown-indent=$(filter-out $(LINT_FILE.check-ml-indent) \ + $(LINT_FILE.check-c-indent),$(LINT_FILE.check-indent)) +LINT_FILE.fix-unknown-indent=$(patsusbt %.check-indent,%.fix-indent,LINT_FILE.check-unknown-indent) ## check-XXX targets @@ -218,12 +243,10 @@ check-eoleof: $(LINT_FILE.check-eoleof) .PHONY: check-syntax check-syntax: $(LINT_FILE.check-syntax) +# ML and C format .PHONY: check-indent check-indent: $(LINT_FILE.check-indent) -.PHONY: check-clang-format -check-clang-format: $(LINT_FILE.check-clang-format) - ## fix-XXX targets .PHONY: fix-utf8 @@ -235,12 +258,10 @@ fix-eoleof: $(LINT_FILE.fix-eoleof) .PHONY: fix-syntax fix-syntax: $(LINT_FILE.fix-syntax) +# ML and C format .PHONY: fix-indent fix-indent: $(LINT_FILE.fix-indent) -.PHONY: fix-clang-format -fix-clang-format: $(LINT_FILE.fix-clang-format) - endif ############################### @@ -278,11 +299,26 @@ $(LINT_FILE.fix-utf8): .lint/%.fix-utf8: % .lint/check-ocp-indent-version endif # LINT_FROM_ENCODING +############################### +## UNKNOWN INDENTATION FORMATER + +ifneq ($(LINT_FILE.check-unknown-indent),) +.PHONY: $(LINT_FILE.check-unknown-indent) +$(LINT_FILE.check-unknown-indent): .lint/%.check-indent: % + $(error "Check indent with an unknown formater: $<") +endif + +ifneq ($(LINT_FILE.fix-unknown-indent),) +.PHONY: $(LINT_FILE.fix-unknown-indent) +$(LINT_FILE.check-unknown-indent): .lint/%.fix-indent: % + $(error "Check indent with an unknown formater: $<") +endif + ############################### ## ML INDENTATION ASPECT -$(LINT_FILE.check-indent): .lint/%.check-indent: % .lint/check-ocp-indent-version - echo "Check indent: $<" +$(LINT_FILE.check-ml-indent): .lint/%.check-indent: % .lint/check-ocp-indent-version + echo "Check ML indent: $<" $(OCP_INDENT) $< > $<.tmp if cmp -s $< $<.tmp; \ then $(RM) $<.tmp; \ @@ -295,9 +331,9 @@ $(LINT_FILE.check-indent): .lint/%.check-indent: % .lint/check-ocp-indent-versio $(MKDIR) $(dir $@) $(TOUCH) $@ -.PHONY: $(LINT_FILE.fix-indent) -$(LINT_FILE.fix-indent): .lint/%.fix-indent: % .lint/check-ocp-indent-version - echo "Fixes indent: $<" +.PHONY: $(LINT_FILE.fix-ml-indent) +$(LINT_FILE.fix-ml-indent): .lint/%.fix-indent: % .lint/check-ocp-indent-version + echo "Fixes ML indent: $<" $(OCP_INDENT) -i $< $(MKDIR) $(dir $@) $(TOUCH) .lint/$<.check-indent # no more need of check-indent @@ -305,15 +341,15 @@ $(LINT_FILE.fix-indent): .lint/%.fix-indent: % .lint/check-ocp-indent-version ############################### ## C INDENTATION ASPECT -$(LINT_FILE.check-clang-format): .lint/%.check-clang-format: % .lint/check-clang-format-installed - echo "Check clang-format: $<" +$(LINT_FILE.check-c-indent): .lint/%.check-indent: % .lint/check-clang-format-installed + echo "Check C indent: $<" clang-format --dry-run -Werror $< $(MKDIR) $(dir $@) $(TOUCH) $@ -.PHONY: $(LINT_FILE.fix-clang-format) -$(LINT_FILE.fix-clang-format): .lint/%.fix-clang-format: % .lint/check-clang-format-installed - echo "Fixes clang-format: $<" +.PHONY: $(LINT_FILE.fix-c-indent) +$(LINT_FILE.fix-c-indent): .lint/%.fix-indent: % .lint/check-clang-format-installed + echo "Fixes C indent: $<" clang-format -i $< $(MKDIR) $(dir $@) $(TOUCH) .lint/$<.check-indent # no more need of check-indent diff --git a/src/plugins/e-acsl/.gitattributes b/src/plugins/e-acsl/.gitattributes index e69c6c626ef5aa224cf2bee26a2ab4c594e63cd0..9d7633a570624354415012aa73ba25e820304174 100644 --- a/src/plugins/e-acsl/.gitattributes +++ b/src/plugins/e-acsl/.gitattributes @@ -27,8 +27,8 @@ Makefile.in header_spec=CEA_LGPL_OR_PROPRIETARY.E_ACSL # CHECK-INDENT # ########################################### -/tests/*/*.c check-syntax check-clang-format -/share/**/*.c check-syntax check-clang-format +/tests/*/*.c check-syntax check-indent +/share/**/*.c check-syntax check-indent ######################## # HEADER_SPEC: .ignore #