summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-08-15 15:08:25 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-15 15:08:25 -0700
commitbce8031d9a1ff3b791f9e4c1cd1e5634faaf55fb (patch)
tree750b9ac3604779663c73beae083f47593cf3d0b2
parentMerge branch 'sb/histogram-less-memory' (diff)
parentcoccinelle: extract dedicated make target to clean Coccinelle's results (diff)
downloadtgif-bce8031d9a1ff3b791f9e4c1cd1e5634faaf55fb.tar.xz
Merge branch 'sg/coccicheck-updates'
Update the way we use Coccinelle to find out-of-style code that need to be modernised. * sg/coccicheck-updates: coccinelle: extract dedicated make target to clean Coccinelle's results coccinelle: put sane filenames into output patches coccinelle: exclude sha1dc source files from static analysis coccinelle: use $(addsuffix) in 'coccicheck' make target coccinelle: mark the 'coccicheck' make target as .PHONY
-rw-r--r--Makefile24
1 files changed, 17 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 8251c394a0..e3364a42a5 100644
--- a/Makefile
+++ b/Makefile
@@ -569,7 +569,7 @@ SPATCH = spatch
export TCL_PATH TCLTK_PATH
SPARSE_FLAGS =
-SPATCH_FLAGS = --all-includes
+SPATCH_FLAGS = --all-includes --patch .
@@ -2680,10 +2680,16 @@ check: command-list.h
fi
C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
-%.cocci.patch: %.cocci $(C_SOURCES)
+ifdef DC_SHA1_SUBMODULE
+COCCI_SOURCES = $(filter-out sha1collisiondetection/%,$(C_SOURCES))
+else
+COCCI_SOURCES = $(filter-out sha1dc/%,$(C_SOURCES))
+endif
+
+%.cocci.patch: %.cocci $(COCCI_SOURCES)
@echo ' ' SPATCH $<; \
ret=0; \
- for f in $(C_SOURCES); do \
+ for f in $(COCCI_SOURCES); do \
$(SPATCH) --sp-file $< $$f $(SPATCH_FLAGS) || \
{ ret=$$?; break; }; \
done >$@+ 2>$@.log; \
@@ -2697,7 +2703,9 @@ C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
then \
echo ' ' SPATCH result: $@; \
fi
-coccicheck: $(patsubst %.cocci,%.cocci.patch,$(wildcard contrib/coccinelle/*.cocci))
+coccicheck: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.cocci))
+
+.PHONY: coccicheck
### Installation rules
@@ -2909,7 +2917,10 @@ profile-clean:
$(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
-clean: profile-clean coverage-clean
+cocciclean:
+ $(RM) contrib/coccinelle/*.cocci.patch*
+
+clean: profile-clean coverage-clean cocciclean
$(RM) *.res
$(RM) $(OBJECTS)
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
@@ -2921,7 +2932,6 @@ clean: profile-clean coverage-clean
$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
- $(RM) contrib/coccinelle/*.cocci.patch*
$(MAKE) -C Documentation/ clean
ifndef NO_PERL
$(MAKE) -C gitweb clean
@@ -2937,7 +2947,7 @@ endif
$(RM) GIT-USER-AGENT GIT-PREFIX
$(RM) GIT-SCRIPT-DEFINES GIT-PERL-DEFINES GIT-PERL-HEADER GIT-PYTHON-VARS
-.PHONY: all install profile-clean clean strip
+.PHONY: all install profile-clean cocciclean clean strip
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
.PHONY: FORCE cscope