On Sun, 14 Mar 2010, SF Markus Elfring wrote:

> > If you want to do something about a variable declaration and use, you can 
> > make 
> > a pattern that has those and ... in between.  You can put some constraints 
> > on the control-flow path matched by the ... using when.
> 
> Would it make sense to extend the semantic patch language for the discussed 
> use
> case?

I don't know what are the concrete requiremens of the discussed use case, 
so I can't answer the question.  I think the current language is quite 
adequate to address some instances, as described above.

> How should source code adjustments that will only be needed if a previous
> pattern matches be specified in SmPL?

You can say that one rule depends on the success or failure of another, 
but putting eg depends on rule1 && !rule2 in the between the initial @@, 
next to the rule name, if any.  This is illustrated in the wiki:

http://cocci.ekstranet.diku.dk/wiki/doku.php?id=dependencies_between_patterns

You can often also express dependencies between rules by inheriting 
metavariables.  If a pattern uses a metavariable that is inherited from a 
previous rule, then the pattern will only match if the previous rule was 
successful.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to