coccicheck: fail "make" when it fails

With "make coccicheck", we generate contrib/coccinelle/*.cocci.patch files that contain changes suggested by semantic patches, but "make" succeeds. Admittedly, not many developers may run "make coccicheck" in the first place, but it makes it harder to notice when they do run it after they introduced an iffy piece of code. Check that the resulting cocci.patch files are all empty. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jun 23, 2025 at 09:14 UTC 819d3a55fc5a530f90309c2d208101765e8fe78d
1 file changed +5 -2
Makefile
+5 -2
@@ -3422,11 +3422,14 @@ endif
3422 coccicheck-test: $(COCCI_TEST_RES_GEN)
3423
3424 coccicheck: coccicheck-test
3425 +
3426 ifdef SPATCH_CONCAT_COCCI
3426 -coccicheck: contrib/coccinelle/ALL.cocci.patch
3427 +COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = contrib/coccinelle/ALL.cocci.patch
3428 else
3428 -coccicheck: $(COCCICHECK_PATCHES_INTREE)
3429 +COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = $(COCCICHECK_PATCHES_INTREE)
3430 endif
3431 +coccicheck: $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES)
3432 + ! grep -q ^ $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) /dev/null
3433
3434 # See contrib/coccinelle/README
3435 coccicheck-pending: coccicheck-test