git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] cocci: avoid "should ... be a metavariable" warnings
@ 2022-11-30  8:28 Ævar Arnfjörð Bjarmason
  2022-11-30 22:26 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-11-30  8:28 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

Since [1] running "make coccicheck" has resulted in [2] being emitted
to the *.log files for the "spatch" run, and in the case of "make
coccicheck-test" we'd emit these to the user's terminal.

Nothing was broken as a result, but let's refactor the relevant rules
to eliminate the ambiguity between a possible variable and an
identifier.

1. 0e6550a2c63 (cocci: add a index-compatibility.pending.cocci,
   2022-11-19)
2. warning: line 257: should active_cache be a metavariable?
   warning: line 260: should active_cache_changed be a metavariable?
   warning: line 263: should active_cache_tree be a metavariable?
   warning: line 271: should active_nr be a metavariable?

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

This warning can be seen e.g. in "master" CI at: https://github.com/git/git/actions/runs/3580246628/jobs/6022212792#step:4:81

Junio: Sorry about missing this, this would be new in v2.39.0, so I'm
submitting it now in case you'd like to pick it up for v2.39.0, but on
the other hand there's no negative impact here other than noisy "make"
output, and noisy coccinelle logs. So it could also wait until after
the release...

 contrib/coccinelle/index-compatibility.cocci | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/contrib/coccinelle/index-compatibility.cocci b/contrib/coccinelle/index-compatibility.cocci
index 4c1b890c3ef..8520f03128a 100644
--- a/contrib/coccinelle/index-compatibility.cocci
+++ b/contrib/coccinelle/index-compatibility.cocci
@@ -1,22 +1,26 @@
 // the_index.* variables
 @@
+identifier AC = active_cache;
+identifier ACC = active_cache_changed;
+identifier ACT = active_cache_tree;
 @@
 (
-- active_cache
+- AC
 + the_index.cache
 |
-- active_cache_changed
+- ACC
 + the_index.cache_changed
 |
-- active_cache_tree
+- ACT
 + the_index.cache_tree
 )
 
 @@
+identifier AN = active_nr;
 identifier f != prepare_to_commit;
 @@
   f(...) {<...
-- active_nr
+- AN
 + the_index.cache_nr
   ...>}
 
-- 
2.39.0.rc0.1028.gb88f24da998


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cocci: avoid "should ... be a metavariable" warnings
  2022-11-30  8:28 [PATCH] cocci: avoid "should ... be a metavariable" warnings Ævar Arnfjörð Bjarmason
@ 2022-11-30 22:26 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-11-30 22:26 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: git

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> Since [1] running "make coccicheck" has resulted in [2] being emitted
> to the *.log files for the "spatch" run, and in the case of "make
> coccicheck-test" we'd emit these to the user's terminal.
>
> Nothing was broken as a result, but let's refactor the relevant rules
> to eliminate the ambiguity between a possible variable and an
> identifier.
>
> 1. 0e6550a2c63 (cocci: add a index-compatibility.pending.cocci,
>    2022-11-19)
> 2. warning: line 257: should active_cache be a metavariable?
>    warning: line 260: should active_cache_changed be a metavariable?
>    warning: line 263: should active_cache_tree be a metavariable?
>    warning: line 271: should active_nr be a metavariable?
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---

Thanks.  Queued.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-30 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30  8:28 [PATCH] cocci: avoid "should ... be a metavariable" warnings Ævar Arnfjörð Bjarmason
2022-11-30 22:26 ` Junio C Hamano

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).