On Wednesday 13 January 2010 12:10:20 Michael Stefaniuc wrote:
> Hello Nicolas,
> 
> Nicolas Palix wrote:
> > On Saturday 09 January 2010 17:26:37 Michael Stefaniuc wrote:
> >> coccinelle 0.1.11 introduced regexp support for meta-identifier/function 
> >> and constant. The release notes says it's an OCaml regexp and points to 
> >> "man Str" for details but I don
> >>
> >> I tried to make use of grouping and alternatives but I get errors like:
> >> identifier SPAM ~= "\(WINE_\)?\(ERR\|FIXME\|WARN\)";
> >>    Fatal error: exception Lexer_cocci.Lexical("unrecognised symbol:\(")
> >> identifier SPAM ~= "ERR\|FIXME\|WARN";
> >>    Fatal error: exception Lexer_cocci.Lexical("unrecognised symbol:\|")
> >>
> >> Is this a known limitation or just a bug?
> > 
> > The following patch will fix this bug.
> thanks for the fix; I have tried coccinelle 0.2.0 and it works fine.
> Using the coccinelle/OCaml regexp seems to be way faster than just using
> "identifier SPAM;" and filtering it later on in python. For my script on
> a Wine C file it's the difference between finishing in 12 minutes or
> killing the spatch process after 90+ minutes of burned CPU time (though
> the python variant was timed with coccinelle 0.2.0-rc1).
> 

You're welcome.

Have you tried to inline your SPAM identifier in the matching part
of the semantic patch? It is maybe faster than using regexp but I haven't 
checked.
Indeed, as you're matching the regexp (~=), and not it's negation, you may 
replace

====================================
@@
identifier SPAM ~= "ERR\|FIXME"
@@

SPAM

====================================

by

====================================
@@
@@

  \(ERR\|FIXME\)
====================================

Please, could you report any performance improvement/degradation if you try 
this?

bye

> bye
>       michael
> 
> 
> 

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

Reply via email to