Alternatives are not supported at the function header level.  You get the 
parse error because it thinks they are function calls.  The solution is to 
have one rule r that matches the functions you don't want, and marks the 
function names with a position variable.  Then have another rule that 
matches any function but declares a position variable

position p != r.p;

which it then uses to be sure that the name of the function is not in one 
of the positions collected by the first rule.

I can give more detail if it is not clear.

julia


On Sat, 27 Nov 2010, Vasiliy Kulikov wrote:

> Hi,
> 
> I want to find all functions those do not meet regexp, I do this:
> 
> @@
> identifier f ~= "attr\|sysfs\|show";
> identifier g;
> expression ret;
> @@
> 
> (
>  f (...)
> |
>  g (...)
> )
> {
>  ...
> (
> *ret = snprintf(...);
>  ...
>  return ret;
> |
> *return snprintf(...);
> )
>  ...
> }
> --
> 
> I get this error:
> 
> $ myspatch -sp_file ~/cocci-scripts/snprintf-return.cocci -dir .
> init_defs_builtins: /usr/share/coccinelle/standard.h
> 98 99
> Fatal error: exception Failure("minus: parse error: 
>  = File "/home/vasya/cocci-scripts/snprintf-return.cocci", line 12,
> column 0,  charpos = 98
>     around = '{', whole content = {
> ")
> 
> 
> Thanks,
> 
> -- 
> Vasiliy
> _______________________________________________
> Cocci mailing list
> [email protected]
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
> 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to