From cddd68ae33667c4bfc81c81f74815bb2ba0e4f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Wed, 30 Nov 2022 09:28:23 +0100 Subject: cocci: avoid "should ... be a metavariable" warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano diff --git a/contrib/coccinelle/index-compatibility.cocci b/contrib/coccinelle/index-compatibility.cocci index 4c1b890..8520f03 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 ...>} -- cgit v0.10.2-6-g49f6