[Cocci] Problem when using a macro for mangling function names

Ali-Erdem OZCAN ali-erdem.ozcan at st.com
Fri Mar 20 20:21:44 CET 2009


>
>> Hi  
>>     
>
> I guess you mean you want the metavariable to be bound to 'prefix_foo'
> (to really take into account the macro expansion semantics of METH).
>   
Correct (as reformulated in my previous post).
>   
>> because a direct reference to
>> foo' may appear later in the code without the use of the METH
>> macro.
>>     
>
> The code could perhaps be clearer if you would consistently use 
> METH ...
>
>   
Sure, but from the tools perspective, we cannot do this hypothesis.
>> The same case applies for METHOD(foo,bar) since a direct
>> reference to componentName_foo_bar may appear in the same source code,
>>     
>
> Sure, but apparently right now your SP does not require
> to match over those different places. You just want to 
> be able to analyse code like:
>
>  void METH(foo)(COMP_TYPE* this, int i){
>
> with a SP like:
>    @ rule1 @ 
>    identifier fn;
>    typedef COMP_TYPE;
>    identifier this;
>    @@
>    void fn(
>    -COMP_TYPE* this,
>    ... ) {
>     ...
>    }
>
> and you never use 'fn' later in your SP in a callsite position.
> So right now to what 'fn' is binded does not really matter. What
> matters is just to be able to parse and unparse code having
> those elaborated idents.
>   
Agreed. But the SP that I sent is just a little experiment that I 
developed quickly. I am not sure right now that I will never need to use 
the value bound to 'fn'. But, let's take care about it later as you say ;).
>   
>> and spatch should detect that they both refer to the same thing.
>>     
>
> Yes, later, ... let's start by just being able to parse it.
>
>   
Thanks

Erdem


More information about the Cocci mailing list