> On 23 Jul 2021, at 21:35, Julia Lawall <julia.law...@inria.fr> wrote:
> 
> 
>> 
>> I missed the fact that the "return ERR" were actually not replaced on
>> this example at all,
> 
> This is because there are no occurrences of return ERR; in your code.
> Probably you expected ERR to be a metavariable, but it's not.  

I had it declared at one point declared as “expression ERR;”, so total PEBCAK 
here, sorry for that! 🙈


> Actually,
> fully capitalizing your metavariables is not a good idea.  Coccinelle
> expects that fully capitalized things are constants, as in #define ERR -1,
> and so when they appear at random places, it doesn't comment about that.
> If it had been in lowercase and used as the argument of a return (or as a
> function argument, right-hand side of an assignment, etc), Coccinelle
> would have printed a warning wondering if you expected it to be a
> metavariable.

Oh, thanks a lot for the tip! 

> 
> If ERR is declared as an expression metavariable, then lots of returns are
> replaced.

Excellent, thanks a lot for the education ! :)

—a

> 
> julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to