mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
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>
This commit is contained in:
parent
96fca68c4f
commit
e4655196e2
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user