Skip to content

Commit f2ad545

Browse files
committed
cocci: matching (multiple) identifiers
"make coccicheck" seems to work OK at GitHub CI using $ spatch --version spatch version 1.1.1 compiled with OCaml version 4.13.1 OCaml scripting support: yes Python scripting support: yes Syntax of regular expressions: PCRE but not with $ spatch --version spatch version 1.3 compiled with OCaml version 5.3.0 OCaml scripting support: yes Python scripting support: yes Syntax of regular expressions: Str Judging from https://ocaml.org/manual/5.3/api/Str.html, I suspect that this probably is caused by the distinction between BRE vs PCRE. As there is no reasonably clean way to write the multiple choice matches portably between these two pattern languages, let's stop using regexp_constraint and use compare_constraint instead when listing the function names to exclude. There are other uses of "!~" but they all want to match a single simple token, that should work fine either with BRE or PCRE. Signed-off-by: Junio C Hamano <[email protected]>
1 parent f93ff17 commit f2ad545

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/coccinelle/commit.cocci

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ expression s;
2525
// functions, then the recommended transformation will be bogus with
2626
// repo_get_commit_tree() on the LHS.
2727
@@
28-
identifier f !~ "^(repo_get_commit_tree|get_commit_tree_in_graph_one|load_tree_for_commit|set_commit_tree)$";
28+
identifier f != { repo_get_commit_tree, get_commit_tree_in_graph_one,
29+
load_tree_for_commit, set_commit_tree };
2930
expression c;
3031
@@
3132
f(...) {<...

0 commit comments

Comments
 (0)