* [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
* Re: [Cocci] Checking data processing for parentheses in SmPL scripts 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 0 siblings, 1 reply; 5+ messages in thread From: Markus Elfring @ 2019-11-12 8:04 UTC (permalink / raw) To: Coccinelle > Unfortunately, the error message “unexpected close parenthesis in line 6” > is reported then. The following change specification gets accepted by the Coccinelle software. @adjustment@ expression X; @@ +powerof2 ( -(X-1)& X) - == 0 Would you like to discuss similar SmPL code variations any more? 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
* Re: [Cocci] Checking data processing for parentheses in SmPL scripts 2019-11-12 8:04 ` Markus Elfring @ 2019-11-12 13:23 ` Julia Lawall 2019-11-12 16:01 ` Markus Elfring 0 siblings, 1 reply; 5+ messages in thread From: Julia Lawall @ 2019-11-12 13:23 UTC (permalink / raw) To: Markus Elfring; +Cc: Coccinelle [-- Attachment #1: Type: text/plain, Size: 666 bytes --] On Tue, 12 Nov 2019, Markus Elfring wrote: > > Unfortunately, the error message “unexpected close parenthesis in line 6” > > is reported then. > > The following change specification gets accepted by the Coccinelle software. > > @adjustment@ > expression X; > @@ > +powerof2 > ( > -(X-1)& > X) > - == 0 > > > Would you like to discuss similar SmPL code variations any more? What is the question, exactly? Is there any reason why you would not expect the above code to be accepted? julia > > Regards, > Markus > _______________________________________________ > Cocci mailing list > Cocci@systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > [-- Attachment #2: Type: text/plain, Size: 136 bytes --] _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Cocci] Checking data processing for parentheses in SmPL scripts 2019-11-12 13:23 ` Julia Lawall @ 2019-11-12 16:01 ` Markus Elfring 2019-11-12 16:07 ` Julia Lawall 0 siblings, 1 reply; 5+ messages in thread From: Markus Elfring @ 2019-11-12 16:01 UTC (permalink / raw) To: Julia Lawall; +Cc: Coccinelle > What is the question, exactly? I became curious to clarify consequences around the error message “unexpected close parenthesis in line 6” for the other SmPL code variant from yesterday. Is the Coccinelle software looking for pairs of parentheses? 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
* Re: [Cocci] Checking data processing for parentheses in SmPL scripts 2019-11-12 16:01 ` Markus Elfring @ 2019-11-12 16:07 ` Julia Lawall 0 siblings, 0 replies; 5+ messages in thread From: Julia Lawall @ 2019-11-12 16:07 UTC (permalink / raw) To: Markus Elfring; +Cc: Coccinelle [-- Attachment #1: Type: text/plain, Size: 496 bytes --] On Tue, 12 Nov 2019, Markus Elfring wrote: > > What is the question, exactly? > > I became curious to clarify consequences around the error message > “unexpected close parenthesis in line 6” for the other SmPL code variant > from yesterday. > Is the Coccinelle software looking for pairs of parentheses? It looks for a ( in column 0 and a matching ) that is not in column 0. In your example there was no ( or ) in column 0, so the message is not relevant. julia > > Regards, > Markus > [-- Attachment #2: Type: text/plain, Size: 136 bytes --] _______________________________________________ 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).