]> www.infradead.org Git - nvme.git/commitdiff
coccinelle: Remove unnecessary parentheses for only one possible change.
authorHongbo Li <lihongbo22@huawei.com>
Wed, 11 Sep 2024 01:09:27 +0000 (09:09 +0800)
committerJulia Lawall <Julia.Lawall@inria.fr>
Sat, 28 Sep 2024 19:23:31 +0000 (21:23 +0200)
The parentheses are only needed if there is a disjunction, ie a
set of possible changes. If there is only one pattern, we can
remove these parentheses. Just like the format:

  -  x
  +  y

not:

  (
  -  x
  +  y
  )

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
scripts/coccinelle/api/string_choices.cocci

index 96dc7090395d7e7ac21e71e73c12feb08ecabb00..95e9a3b31f86caa20b902ae12a30a83aa1628e8c 100644 (file)
@@ -43,18 +43,14 @@ coccilib.report.print_report(p[0], "opportunity for str_plural(%s)" % e)
 @str_up_down depends on patch@
 expression E;
 @@
-(
 -      ((E) ? "up" : "down")
 +      str_up_down(E)
-)
 
 @str_up_down_r depends on !patch exists@
 expression E;
 position P;
 @@
-(
 *      ((E@P) ? "up" : "down")
-)
 
 @script:python depends on report@
 p << str_up_down_r.P;
@@ -66,18 +62,14 @@ coccilib.report.print_report(p[0], "opportunity for str_up_down(%s)" % e)
 @str_down_up depends on patch@
 expression E;
 @@
-(
 -      ((E) ? "down" : "up")
 +      str_down_up(E)
-)
 
 @str_down_up_r depends on !patch exists@
 expression E;
 position P;
 @@
-(
 *      ((E@P) ? "down" : "up")
-)
 
 @script:python depends on report@
 p << str_down_up_r.P;