cocci.systeme.lip6.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Question about the use of "...when !=" in SmPL
@ 2015-05-07  2:32 ZhouYuan
  2015-05-09  7:47 ` Nicholas Mc Guire
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: ZhouYuan @ 2015-05-07  2:32 UTC (permalink / raw)
  To: cocci

Hi,
I have met many problems when I try to use the clause of "when".
For example, I want to check whether there is an default statement in switch, I wrote the Semantic Patch as following: 
@rule at function F;position p;expression E, E1;statement S, S1;@@F at p (...){switch (E) {...when != default: S}}
@script: python at p<<rule.p;@@print p[0].file, p[0].line
and I got the result after running it:
Fatal error: exception Failure("minus: parse error:  = File "ex7.cocci", line 9, column 0,  charpos = 93    around = '...', whole content = ...when != default: S")
Also, another example can be witnessed here. I wrote another patch to check whether there is an "else" after  "if" statement:
@rule534 at function F;position p;statement S1, S2;@@F at p (...){if (...) S1...when != else S2}
But i also got the same "minus: parse error"@the line of when.
I would be so appreciated if someone could give me some suggestions about what is wrong in my Patch and how to use when correctly.
Thank you so much!
Best regards,Yuan  		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20150507/d047f761/attachment.html>

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

end of thread, other threads:[~2015-05-10 16:34 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-07  2:32 [Cocci] Question about the use of "...when !=" in SmPL ZhouYuan
2015-05-09  7:47 ` Nicholas Mc Guire
2015-05-09  8:10   ` [Cocci] Source code analysis around "switch" SF Markus Elfring
2015-05-09  8:28     ` Nicholas Mc Guire
2015-05-09  8:40       ` SF Markus Elfring
2015-05-09  8:36   ` [Cocci] Question about the use of "...when !=" in SmPL Julia Lawall
2015-05-09 10:08     ` Nicholas Mc Guire
2015-05-09 14:09 ` Nicholas Mc Guire
2015-05-09 16:47   ` Julia Lawall
2015-05-10  7:29     ` [Cocci] Data provided by position variables SF Markus Elfring
2015-05-10  8:40       ` Julia Lawall
2015-05-10  8:47         ` SF Markus Elfring
2015-05-09 16:49   ` [Cocci] Question about the use of "...when !=" in SmPL Nicholas Mc Guire
2015-05-10  7:49     ` [Cocci] Improving small SmPL examples SF Markus Elfring
2015-05-10 12:58 ` [Cocci] Question about the use of "...when !=" in SmPL Julia Lawall
2015-05-10 16:28   ` [Cocci] Fine-tuning for switch statements SF Markus Elfring
2015-05-10 16:31     ` Julia Lawall
2015-05-10 16:34       ` SF Markus Elfring

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).