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@function F;position p;expression E, E1;statement S, S1;@@F@p (...){switch 
(E) {...when != default: S}}
@script: python@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@function F;position p;statement S1, S2;@@F@p (...){if (...) S1...when 
!= else S2}
But i also got the same "minus: parse error" at 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                                         
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to