summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@inria.fr>2026-07-26 17:07:54 +0200
committerJulia Lawall <Julia.Lawall@inria.fr>2026-08-23 22:12:10 +0200
commit4fc2656db0c8026139f1634d557ef66e4b383765 (patch)
tree7b7967966c27d5e1ed31f29a1678f155abcba3c8 /scripts
parentaf8613c863a3160b7fb6fd09cbf5b56e37330d80 (diff)
downloadlinux-stable-4fc2656db0c8026139f1634d557ef66e4b383765.tar.gz
linux-stable-4fc2656db0c8026139f1634d557ef66e4b383765.zip
coccinelle: misc: minmax: avoid unhelpful isomorphisms
Avoid isomorphisms that introduce comparisons with 0 that do not occur in code. Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/misc/minmax.cocci26
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/coccinelle/misc/minmax.cocci b/scripts/coccinelle/misc/minmax.cocci
index f14e608240b6..b83d4a01e47a 100644
--- a/scripts/coccinelle/misc/minmax.cocci
+++ b/scripts/coccinelle/misc/minmax.cocci
@@ -17,21 +17,21 @@ virtual org
virtual context
virtual patch
-@max_candidate@
+@max_candidate disable not_int1, not_int2, neg_if_exp@
expression E1, E2, E3, E4;
binary operator cmp = {>, >=};
@@
E1 cmp E2 ? E3 : E4
-@min_candidate@
+@min_candidate disable not_int1, not_int2, neg_if_exp@
expression E1, E2, E3, E4;
binary operator cmp = {<, <=};
@@
E1 cmp E2 ? E3 : E4
-@rmax depends on !patch && max_candidate@
+@rmax depends on !patch && max_candidate disable not_int1, not_int2, neg_if_exp@
identifier func;
expression x, y;
binary operator cmp = {>, >=};
@@ -45,7 +45,7 @@ func(...)
...>
}
-@maxif_candidate@
+@maxif_candidate disable not_int1, not_int2, neg_if@
expression x, y;
expression max_val;
binary operator cmp = {>, >=};
@@ -57,7 +57,7 @@ if ((x) cmp (y)) {
max_val = (y);
}
-@rmaxif depends on !patch && maxif_candidate@
+@rmaxif depends on !patch && maxif_candidate disable not_int1, not_int2, neg_if@
identifier func;
expression x, y;
expression max_val;
@@ -77,7 +77,7 @@ func(...)
}
// Ignore errcode returns.
-@errcode depends on min_candidate@
+@errcode depends on min_candidate disable not_int1, not_int2, neg_if_exp@
position p;
identifier func;
expression x;
@@ -91,7 +91,7 @@ func(...)
...>
}
-@rmin depends on !patch && min_candidate@
+@rmin depends on !patch && min_candidate disable not_int1, not_int2, neg_if_exp@
identifier func;
expression x, y;
binary operator cmp = {<, <=};
@@ -105,7 +105,7 @@ func(...)
...>
}
-@minif_candidate@
+@minif_candidate disable not_int1, not_int2, neg_if@
expression x, y;
expression min_val;
binary operator cmp = {<, <=};
@@ -117,7 +117,7 @@ if ((x) cmp (y)) {
min_val = (y);
}
-@rminif depends on !patch && minif_candidate@
+@rminif depends on !patch && minif_candidate disable not_int1, not_int2, neg_if@
identifier func;
expression x, y;
expression min_val;
@@ -136,7 +136,7 @@ func(...)
...>
}
-@pmax depends on patch && max_candidate@
+@pmax depends on patch && max_candidate disable not_int1, not_int2, neg_if_exp@
identifier func;
expression x, y;
binary operator cmp = {>=, >};
@@ -150,7 +150,7 @@ func(...)
...>
}
-@pmaxif depends on patch && maxif_candidate@
+@pmaxif depends on patch && maxif_candidate disable not_int1, not_int2, neg_if@
identifier func;
expression x, y;
expression max_val;
@@ -169,7 +169,7 @@ func(...)
...>
}
-@pmin depends on patch && min_candidate@
+@pmin depends on patch && min_candidate disable not_int1, not_int2, neg_if_exp@
identifier func;
expression x, y;
binary operator cmp = {<=, <};
@@ -184,7 +184,7 @@ func(...)
...>
}
-@pminif depends on patch && maxif_candidate@
+@pminif depends on patch && minif_candidate disable not_int1, not_int2, neg_if@
identifier func;
expression x, y;
expression min_val;