[Cocci] Weird problem trying to match code inside a function

Luca Coelho luca at coelho.fi
Tue Sep 11 10:08:37 CEST 2018

Hi Julia,

I bumped in to another weird problem.  I'm trying to match some code
inside a function that has a specific struct as a parameter, but I
can't get it to work.

This is cocci code I tried first: 


And this is the file I'm trying to match:


The led activate op changed from being a function that returns void to
one that returns int and I had to backport that.

The strange thing is that if I have only the first rule, it works fine,
but when I add the second rule it fails.

I can make it work if I match the entire code, without trying to match
the function in the first rule:


And this is fine for me now, but I'm really curious as to why I had the
problem with my first implementation...

Can you shed some light?


More information about the Cocci mailing list