]> git.ipfire.org Git - thirdparty/git.git/commit
cocci rules: remove <id>'s from rules that don't need them
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 1 Nov 2022 22:35:53 +0000 (23:35 +0100)
committerTaylor Blau <me@ttaylorr.com>
Thu, 3 Nov 2022 01:22:16 +0000 (21:22 -0400)
commit340a4cb25c52cb7fe797c1565ab7dc6d8dc4346e
tree3d0e245276f1d3e0bf659150343af9817d291417
parent202086b85c6591e99ee18e31277786d43f2804a2
cocci rules: remove <id>'s from rules that don't need them

The <id> in the <rulename> part of the coccinelle syntax[1] is for our
purposes there to declares if we have inter-dependencies between
different rules.

But such <id>'s must be unique within a given semantic patch file.  As
we'll be processing a concatenated version of our rules in the
subsequent commit let's remove these names. They weren't being used
for the semantic patches themselves, and equated to a short comment
about the rule.

Both the filename and context of the rules makes it clear what they're
doing, so we're not gaining anything from keeping these. Retaining
them goes against recommendations that "contrib/coccinelle/README"
will be making in the subsequent commit.

This leaves only one named rule in our sources, where it's needed for
a "<id> <-> <extends> <id>" relationship:

$ git -P grep '^@ ' -- contrib/coccinelle/
contrib/coccinelle/swap.cocci:@ swap @
contrib/coccinelle/swap.cocci:@ extends swap @

1. https://coccinelle.gitlabpages.inria.fr/website/docs/main_grammar.html

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
contrib/coccinelle/hashmap.cocci
contrib/coccinelle/preincr.cocci
contrib/coccinelle/strbuf.cocci
contrib/coccinelle/swap.cocci