Re: [Cocci] [PATCH v4] coccinelle: misc: add minmax script

2021-03-08 Thread Julia Lawall
> +@pmaxif depends on patch@ > +identifier func; > +expression x, y; > +expression max_val; > +binary operator cmp = {>=, >}; > +@@ > + > +func(...) > +{ > + <... > +-if ((x) cmp (y)) { > +-max_val = (x); > +-} else { > +-max_val = (y); > +-} > ++max_val

[Cocci] [PATCH v4] coccinelle: misc: add minmax script

2021-03-07 Thread Denis Efremov
Check for opencoded min(), max() implementations. Signed-off-by: Denis Efremov --- Changes in v2: - <... ...> instead of ... when any - org mode reports fixed - patch rule to drop excessive () Changes in v3: - "depends on patch && (pmax || pmaxif || pmin || pminif)" fixed Changes in v4: - re