cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Checking data processing for parentheses in SmPL scripts
@ 2019-11-11 16:47 Markus Elfring
  2019-11-12  8:04 ` Markus Elfring
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2019-11-11 16:47 UTC (permalink / raw)
  To: Coccinelle

Hello,

The following change specification gets accepted by the Coccinelle software.

@@
expression X;
@@
-((X-1)&X) == 0
+powerof2(X)


See also:
https://github.com/DragonFlyBSD/DragonFlyBSD/blob/722c3b8b6376deab9407ff00b5e63018ab3aef0b/test/cocci/useful_macros.cocci#L53


I got into the development mood to try another code variant out
for the semantic patch language.

@adjustment@
expression X;
@@
+powerof2(
-(X-1)&
 X)
- == 0


Unfortunately, the error message “unexpected close parenthesis in line 6”
is reported then.
Can an other change variation make sense finally?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-12 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 16:47 [Cocci] Checking data processing for parentheses in SmPL scripts Markus Elfring
2019-11-12  8:04 ` Markus Elfring
2019-11-12 13:23   ` Julia Lawall
2019-11-12 16:01     ` Markus Elfring
2019-11-12 16:07       ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).