Re: [PATCH v2] scripts: coccinelle: check for !(un)?likely usage
From: Markus Elfring
Date: Fri Aug 30 2019 - 03:56:15 EST
> +/// Notations !unlikely(x) and !likely(x) are confusing.
I am curious if more software developers will share their views around
these likeliness annotations.
* How much does the scope matter for expressions?
* Are different coding style preferences involved?
> +//----------------------------------------------------------
> +// For context mode
> +//----------------------------------------------------------
> +
> +@depends on context disable unlikely@
I wonder about the need for such a comment when the specification
of SmPL rule dependencies should be sufficient.
> +@depends on patch disable unlikely@
> +expression E;
> +@@
> +
> +(
> +-!likely(!E)
> ++unlikely(E)
> +|
> +-!likely(E)
> ++unlikely(!E)
> +|
> +-!unlikely(!E)
> ++likely(E)
> +|
> +-!unlikely(E)
> ++likely(!E)
> +)
Will another variant for the change specification with the semantic
patch language influence corresponding readability concerns?
+@replacement depends on patch disable unlikely@
+expression x;
+@@
+-!
+(
+(
+-unlikely
++likely
+|
+-likely
++unlikely
+)
+ (
+- !
+ x
+ )
+|
+(
+-unlikely
++likely
+|
+-likely
++unlikely
+)
+ (
++ !
+ x
+ )
+)
Can the use of nested SmPL disjunctions help here together with
an other SmPL code formatting?
Regards,
Markus