{"thread":{"id":"58873","subject":"[PATCH] cocci: avoid \"should ... be a metavariable\" warnings","startedAt":"2022-11-30T08:33:34Z","lastAt":"2022-11-30T22:26:25Z","messageCount":2,"participants":["Ævar Arnfjörð Bjarmason","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"468233","messageId":"patch-1.1-31af153702e-20221130T082521Z-avarab@gmail.com","threadId":"58873","inReplyTo":null,"subject":"[PATCH] cocci: avoid \"should ... be a metavariable\" warnings","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-11-30T08:28:23Z","receivedAt":"2022-11-30T08:33:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since [1] running \"make coccicheck\" has resulted in [2] being emitted\nto the *.log files for the \"spatch\" run, and in the case of \"make\ncoccicheck-test\" we'd emit these to the user's terminal.\n\nNothing was broken as a result, but let's refactor the relevant rules\nto eliminate the ambiguity between a possible variable and an\nidentifier.\n\n1. 0e6550a2c63 (cocci: add a index-compatibility.pending.cocci,\n   2022-11-19)\n2. warning: line 257: should active_cache be a metavariable?\n   warning: line 260: should active_cache_changed be a metavariable?\n   warning: line 263: should active_cache_tree be a metavariable?\n   warning: line 271: should active_nr be a metavariable?\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nThis warning can be seen e.g. in \"master\" CI at: https://github.com/git/git/actions/runs/3580246628/jobs/6022212792#step:4:81\n\nJunio: Sorry about missing this, this would be new in v2.39.0, so I'm\nsubmitting it now in case you'd like to pick it up for v2.39.0, but on\nthe other hand there's no negative impact here other than noisy \"make\"\noutput, and noisy coccinelle logs. So it could also wait until after\nthe release...\n\n contrib/coccinelle/index-compatibility.cocci | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/coccinelle/index-compatibility.cocci b/contrib/coccinelle/index-compatibility.cocci\nindex 4c1b890c3ef..8520f03128a 100644\n--- a/contrib/coccinelle/index-compatibility.cocci\n+++ b/contrib/coccinelle/index-compatibility.cocci\n@@ -1,22 +1,26 @@\n // the_index.* variables\n @@\n+identifier AC = active_cache;\n+identifier ACC = active_cache_changed;\n+identifier ACT = active_cache_tree;\n @@\n (\n-- active_cache\n+- AC\n + the_index.cache\n |\n-- active_cache_changed\n+- ACC\n + the_index.cache_changed\n |\n-- active_cache_tree\n+- ACT\n + the_index.cache_tree\n )\n \n @@\n+identifier AN = active_nr;\n identifier f != prepare_to_commit;\n @@\n   f(...) {<...\n-- active_nr\n+- AN\n + the_index.cache_nr\n   ...>}\n \n-- \n2.39.0.rc0.1028.gb88f24da998\n\n"},{"id":"468291","messageId":"xmqqlensulit.fsf@gitster.g","threadId":"58873","inReplyTo":"patch-1.1-31af153702e-20221130T082521Z-avarab@gmail.com","subject":"Re: [PATCH] cocci: avoid \"should ... be a metavariable\" warnings","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-11-30T22:26:18Z","receivedAt":"2022-11-30T22:26:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Since [1] running \"make coccicheck\" has resulted in [2] being emitted\n> to the *.log files for the \"spatch\" run, and in the case of \"make\n> coccicheck-test\" we'd emit these to the user's terminal.\n>\n> Nothing was broken as a result, but let's refactor the relevant rules\n> to eliminate the ambiguity between a possible variable and an\n> identifier.\n>\n> 1. 0e6550a2c63 (cocci: add a index-compatibility.pending.cocci,\n>    2022-11-19)\n> 2. warning: line 257: should active_cache be a metavariable?\n>    warning: line 260: should active_cache_changed be a metavariable?\n>    warning: line 263: should active_cache_tree be a metavariable?\n>    warning: line 271: should active_nr be a metavariable?\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n\nThanks.  Queued.\n"}]}