coccinelle: misc: struct_size: drop unneeded parentheses
authorSang-Heon Jeon <ekffu200098@gmail.com>
Sun, 9 Aug 2026 04:53:34 +0000 (13:53 +0900)
committerJulia Lawall <Julia.Lawall@inria.fr>
Sun, 23 Aug 2026 20:12:10 +0000 (22:12 +0200)
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>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
scripts/coccinelle/misc/struct_size.cocci

index 9b02c37..406884d 100644 (file)
@@ -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;