coccinelle: exclude sha1dc source files from static analysis

sha1dc is an external library, that we carry in-tree for convenience or grab as a submodule, so there is no use in applying our semantic patches to its source files. Therefore, exclude sha1dc's source files from Coccinelle's static analysis. This change also makes the static analysis somewhat faster: presumably because of the heavy use of repetitive macro declarations, applying the semantic patches 'array.cocci' and 'swap.cocci' to 'sha1dc/sha1.c' takes over half a minute each on my machine, which amounts to about a third of the runtime of applying these two semantic patches to the whole git source tree. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Jul 23, 2018 at 15:50 UTC ac1e31d5ca8cacaf8aade744d1a44bfb977b2da2
1 file changed +8 -2
Makefile
+8 -2
@@ -2669,10 +2669,16 @@ check: command-list.h
2669 fi
2670
2671 C_SOURCES = $(patsubst %.o,%.c,$(C_OBJ))
2672 -%.cocci.patch: %.cocci $(C_SOURCES)
2672 +ifdef DC_SHA1_SUBMODULE
2673 +COCCI_SOURCES = $(filter-out sha1collisiondetection/%,$(C_SOURCES))
2674 +else
2675 +COCCI_SOURCES = $(filter-out sha1dc/%,$(C_SOURCES))
2676 +endif
2677 +
2678 +%.cocci.patch: %.cocci $(COCCI_SOURCES)
2679 @echo ' ' SPATCH $<; \
2680 ret=0; \
2675 - for f in $(C_SOURCES); do \
2681 + for f in $(COCCI_SOURCES); do \
2682 $(SPATCH) --sp-file $< $$f $(SPATCH_FLAGS) || \
2683 { ret=$$?; break; }; \
2684 done >$@+ 2>$@.log; \