* [cocci] [PATCH] coccinelle: misc: struct_size: drop unneeded parentheses
@ 2026-08-09 4:53 Sang-Heon Jeon
0 siblings, 0 replies; only message in thread
From: Sang-Heon Jeon @ 2026-08-09 4:53 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-24 7:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-09 4:53 [cocci] [PATCH] coccinelle: misc: struct_size: drop unneeded parentheses Sang-Heon Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox