From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
"SZEDER Gábor" <szeder.dev@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v4 04/12] Makefile: have "coccicheck" re-run if flags change
Date: Wed, 26 Oct 2022 16:20:31 +0200 [thread overview]
Message-ID: <patch-v4-04.12-b859dae7509-20221026T141005Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-v4-00.12-00000000000-20221026T141005Z-avarab@gmail.com>
Fix an issue with the "coccicheck" family of rules that's been here
since 63f0a758a06 (add coccicheck make target, 2016-09-15), unlike
e.g. "make grep.o" we wouldn't re-run it when $(SPATCH) or
$(SPATCH_FLAGS) changed. To test new flags we needed to first do a
"make cocciclean".
This now uses the same (copy/pasted) pattern as other "DEFINES"
rules. As a result we'll re-run properly. This can be demonstrated
e.g. on the issue noted in [1]:
$ make contrib/coccinelle/xcalloc.cocci.patch COCCI_SOURCES=promisor-remote.c V=1
[...]
SPATCH contrib/coccinelle/xcalloc.cocci
$ make contrib/coccinelle/xcalloc.cocci.patch COCCI_SOURCES=promisor-remote.c SPATCH_FLAGS="--all-includes --recursive-includes"
* new spatch flags
SPATCH contrib/coccinelle/xcalloc.cocci
SPATCH result: contrib/coccinelle/xcalloc.cocci.patch
$
1. https://lore.kernel.org/git/20220823095602.GC1735@szeder.dev/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
.gitignore | 1 +
Makefile | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/.gitignore b/.gitignore
index 62720c6135d..7cce39270d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
/GIT-PERL-HEADER
/GIT-PYTHON-VARS
/GIT-SCRIPT-DEFINES
+/GIT-SPATCH-DEFINES
/GIT-USER-AGENT
/GIT-VERSION-FILE
/bin-wrappers/
diff --git a/Makefile b/Makefile
index b638a548182..7d4518653ce 100644
--- a/Makefile
+++ b/Makefile
@@ -1305,6 +1305,18 @@ SANITIZE_ADDRESS =
SPATCH_FLAGS = --all-includes
SPATCH_BATCH_SIZE = 1
+# Rebuild 'coccicheck' if $(SPATCH), its flags etc. change
+TRACK_SPATCH_DEFINES =
+TRACK_SPATCH_DEFINES += $(SPATCH)
+TRACK_SPATCH_DEFINES += $(SPATCH_FLAGS)
+TRACK_SPATCH_DEFINES += $(SPATCH_BATCH_SIZE)
+GIT-SPATCH-DEFINES: FORCE
+ @FLAGS='$(TRACK_SPATCH_DEFINES)'; \
+ if test x"$$FLAGS" != x"`cat GIT-SPATCH-DEFINES 2>/dev/null`" ; then \
+ echo >&2 " * new spatch flags"; \
+ echo "$$FLAGS" >GIT-SPATCH-DEFINES; \
+ fi
+
include config.mak.uname
-include config.mak.autogen
-include config.mak
@@ -3152,6 +3164,7 @@ COCCICHECK_PATCHES_PENDING = $(COCCICHECK_PENDING:%=%.patch)
COCCI_TEST_RES = $(wildcard contrib/coccinelle/tests/*.res)
COCCI_PATCHES = $(COCCI_RULES:%=%.patch)
+$(COCCI_PATCHES): GIT-SPATCH-DEFINES
$(COCCI_PATCHES): $(COCCI_SOURCES)
$(COCCI_PATCHES): %.patch: %
$(QUIET_SPATCH) \
@@ -3175,6 +3188,7 @@ $(COCCI_PATCHES): %.patch: %
fi
COCCI_TEST_RES_GEN = $(addprefix .build/,$(COCCI_TEST_RES))
+$(COCCI_TEST_RES_GEN): GIT-SPATCH-DEFINES
$(COCCI_TEST_RES_GEN): .build/%.res : %.c
$(COCCI_TEST_RES_GEN): .build/%.res : %.res
$(COCCI_TEST_RES_GEN): .build/contrib/coccinelle/tests/%.res : contrib/coccinelle/%.cocci
@@ -3461,6 +3475,7 @@ profile-clean:
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
cocciclean:
+ $(RM) GIT-SPATCH-DEFINES
$(RM) -r .build/contrib/coccinelle
$(RM) contrib/coccinelle/*.cocci.patch*
--
2.38.0.1251.g3eefdfb5e7a
next prev parent reply other threads:[~2022-10-26 14:21 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 14:36 [PATCH 0/5] cocci: make "incremental" possible + a ccache-like tool Ævar Arnfjörð Bjarmason
2022-08-25 14:36 ` [PATCH 1/5] Makefile: add ability to TAB-complete cocci *.patch rules Ævar Arnfjörð Bjarmason
2022-08-25 14:36 ` [PATCH 2/5] Makefile: have "coccicheck" re-run if flags change Ævar Arnfjörð Bjarmason
2022-08-25 15:29 ` SZEDER Gábor
2022-08-25 14:36 ` [PATCH 3/5] cocci: make "coccicheck" rule incremental Ævar Arnfjörð Bjarmason
2022-08-25 19:44 ` SZEDER Gábor
2022-08-25 22:18 ` Ævar Arnfjörð Bjarmason
2022-08-26 10:43 ` SZEDER Gábor
2022-08-25 14:36 ` [PATCH 4/5] cocci: make incremental compilation even faster Ævar Arnfjörð Bjarmason
2022-08-25 14:36 ` [PATCH 5/5] spatchcache: add a ccache-alike for "spatch" Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 0/9] cocci: make "incremental" possible + a ccache-like tool Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 1/9] cocci rules: remove unused "F" metavariable from pending rule Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 2/9] Makefile: add ability to TAB-complete cocci *.patch rules Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 3/9] Makefile: have "coccicheck" re-run if flags change Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 4/9] Makefile: split off SPATCH_BATCH_SIZE comment from "cocci" heading Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 5/9] cocci: split off include-less "tests" from SPATCH_FLAGS Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 6/9] cocci: split off "--all-includes" " Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 7/9] cocci: make "coccicheck" rule incremental Ævar Arnfjörð Bjarmason
2022-09-01 16:38 ` SZEDER Gábor
2022-09-01 18:04 ` Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 8/9] cocci: optimistically use COMPUTE_HEADER_DEPENDENCIES Ævar Arnfjörð Bjarmason
2022-08-31 20:57 ` [PATCH v2 9/9] spatchcache: add a ccache-alike for "spatch" Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 00/11] cocci: make "incremental" possible + a ccache-like tool Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 01/11] Makefile + shared.mak: rename and indent $(QUIET_SPATCH_T) Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 02/11] cocci rules: remove unused "F" metavariable from pending rule Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 03/11] Makefile: add ability to TAB-complete cocci *.patch rules Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 04/11] Makefile: have "coccicheck" re-run if flags change Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 05/11] Makefile: split off SPATCH_BATCH_SIZE comment from "cocci" heading Ævar Arnfjörð Bjarmason
2022-10-14 20:39 ` Taylor Blau
2022-10-14 15:31 ` [PATCH v3 06/11] cocci: split off include-less "tests" from SPATCH_FLAGS Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 07/11] cocci: split off "--all-includes" " Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 08/11] cocci: make "coccicheck" rule incremental Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 09/11] cocci: optimistically use COMPUTE_HEADER_DEPENDENCIES Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 10/11] cocci: run against a generated ALL.cocci Ævar Arnfjörð Bjarmason
2022-10-14 15:31 ` [PATCH v3 11/11] spatchcache: add a ccache-alike for "spatch" Ævar Arnfjörð Bjarmason
2022-10-17 17:50 ` [PATCH v3 00/11] cocci: make "incremental" possible + a ccache-like tool Jeff King
2022-10-17 18:36 ` Ævar Arnfjörð Bjarmason
2022-10-17 19:08 ` Junio C Hamano
2022-10-17 19:18 ` Jeff King
2022-10-26 14:20 ` [PATCH v4 00/12] " Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 01/12] Makefile + shared.mak: rename and indent $(QUIET_SPATCH_T) Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 02/12] cocci rules: remove unused "F" metavariable from pending rule Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 03/12] Makefile: add ability to TAB-complete cocci *.patch rules Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` Ævar Arnfjörð Bjarmason [this message]
2022-10-26 14:20 ` [PATCH v4 05/12] Makefile: split off SPATCH_BATCH_SIZE comment from "cocci" heading Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 06/12] cocci: split off include-less "tests" from SPATCH_FLAGS Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 07/12] cocci: split off "--all-includes" " Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 08/12] cocci: make "coccicheck" rule incremental Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 09/12] cocci: optimistically use COMPUTE_HEADER_DEPENDENCIES Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 10/12] cocci rules: remove <id>'s from rules that don't need them Ævar Arnfjörð Bjarmason
2022-10-26 14:20 ` [PATCH v4 11/12] cocci: run against a generated ALL.cocci Ævar Arnfjörð Bjarmason
2022-10-28 12:58 ` SZEDER Gábor
2022-10-26 14:20 ` [PATCH v4 12/12] spatchcache: add a ccache-alike for "spatch" Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 00/13] cocci: make "incremental" possible + a ccache-like tool Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 01/13] Makefile + shared.mak: rename and indent $(QUIET_SPATCH_T) Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 02/13] cocci rules: remove unused "F" metavariable from pending rule Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 03/13] Makefile: add ability to TAB-complete cocci *.patch rules Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 04/13] Makefile: have "coccicheck" re-run if flags change Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 05/13] Makefile: split off SPATCH_BATCH_SIZE comment from "cocci" heading Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 06/13] cocci: split off include-less "tests" from SPATCH_FLAGS Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 07/13] cocci: split off "--all-includes" " Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 08/13] cocci: make "coccicheck" rule incremental Ævar Arnfjörð Bjarmason
2022-11-09 14:57 ` SZEDER Gábor
2022-11-01 22:35 ` [PATCH v5 09/13] cocci: optimistically use COMPUTE_HEADER_DEPENDENCIES Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 10/13] Makefile: copy contrib/coccinelle/*.cocci to build/ Ævar Arnfjörð Bjarmason
2022-11-09 15:05 ` SZEDER Gábor
2022-11-09 15:42 ` Ævar Arnfjörð Bjarmason
2022-11-10 16:14 ` [PATCH] Makefile: don't create a ".build/.build/" for cocci, fix output Ævar Arnfjörð Bjarmason
2022-11-11 22:22 ` Taylor Blau
2022-11-01 22:35 ` [PATCH v5 11/13] cocci rules: remove <id>'s from rules that don't need them Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 12/13] cocci: run against a generated ALL.cocci Ævar Arnfjörð Bjarmason
2022-11-01 22:35 ` [PATCH v5 13/13] spatchcache: add a ccache-alike for "spatch" Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=patch-v4-04.12-b859dae7509-20221026T141005Z-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).