From: Sang-Heon Jeon <ekffu200098@gmail.com>
To: Julia Lawall <Julia.Lawall@inria.fr>,
Nicolas Palix <nicolas.palix@imag.fr>
Cc: cocci@inria.fr
Subject: [cocci] [PATCH] coccinelle: misc: struct_size: drop unneeded parentheses
Date: Sun, 9 Aug 2026 13:53:34 +0900 [thread overview]
Message-ID: <20260809045335.1273602-1-ekffu200098@gmail.com> (raw)
The outer parentheses and the single-branch disjunction don't matter when
just matching and reporting a line. Eliminating them reduces the
complexity of the pattern to match and gives a performance improvement in
the non-patch cases, like the previous minmax change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
scripts/coccinelle/misc/struct_size.cocci | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/scripts/coccinelle/misc/struct_size.cocci b/scripts/coccinelle/misc/struct_size.cocci
index 9b02c37438e4..406884d68d43 100644
--- a/scripts/coccinelle/misc/struct_size.cocci
+++ b/scripts/coccinelle/misc/struct_size.cocci
@@ -29,9 +29,7 @@ f
expression E1, E2;
identifier m;
@@
-(
-* (sizeof(*E1) + (E2 * sizeof(*E1->m)))
-)
+* sizeof(*E1) + (E2 * sizeof(*E1->m))
//----------------------------------------------------------
// For patch mode
@@ -55,9 +53,7 @@ expression E1, E2;
identifier m;
position p;
@@
-(
- (sizeof(*E1)@p + (E2 * sizeof(*E1->m)))
-)
+ sizeof(*E1)@p + (E2 * sizeof(*E1->m))
@script:python depends on org@
p << r.p;
--
2.43.0
reply other threads:[~2026-08-24 7:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260809045335.1273602-1-ekffu200098@gmail.com \
--to=ekffu200098@gmail.com \
--cc=Julia.Lawall@inria.fr \
--cc=cocci@inria.fr \
--cc=nicolas.palix@imag.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox