diff options
author | Ricardo Ribalda <ribalda@chromium.org> | 2024-04-16 00:15:18 +0300 |
---|---|---|
committer | Julia Lawall <Julia.Lawall@inria.fr> | 2024-05-20 22:31:20 +0300 |
commit | e4655196e21fdfb3a3c60e930d48b97a9f3ec693 (patch) | |
tree | cf62fa533a37834dc80204e428af66450a8c35f1 /scripts | |
parent | 96fca68c4fbf77a8185eb10f7557e23352732ea2 (diff) | |
download | linux-e4655196e21fdfb3a3c60e930d48b97a9f3ec693.tar.xz |
coccinelle: misc: minmax: Suppress reports for err returns
Most of the people prefer:
return ret < 0 ? ret: 0;
than:
return min(ret, 0);
Let's tweak the cocci file to ignore those lines completely.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/misc/minmax.cocci | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/scripts/coccinelle/misc/minmax.cocci b/scripts/coccinelle/misc/minmax.cocci index fcf908b34f27..ca4830ae3042 100644 --- a/scripts/coccinelle/misc/minmax.cocci +++ b/scripts/coccinelle/misc/minmax.cocci @@ -50,11 +50,26 @@ func(...) ...> } +// Ignore errcode returns. +@errcode@ +position p; +identifier func; +expression x; +binary operator cmp = {<, <=}; +@@ + +func(...) +{ + <... + return ((x) cmp@p 0 ? (x) : 0); + ...> +} + @rmin depends on !patch@ identifier func; expression x, y; binary operator cmp = {<, <=}; -position p; +position p != errcode.p; @@ func(...) @@ -116,21 +131,6 @@ func(...) ...> } -// Don't generate patches for errcode returns. -@errcode depends on patch@ -position p; -identifier func; -expression x; -binary operator cmp = {<, <=}; -@@ - -func(...) -{ - <... - return ((x) cmp@p 0 ? (x) : 0); - ...> -} - @pmin depends on patch@ identifier func; expression x, y; |