On 5/3/19 10:39 PM, Julia Lawall wrote:
> 
> 
> On Fri, 3 May 2019, Michael Stefaniuc wrote:
> 
>> On 2019-05-03 09:17, Julia Lawall wrote:
>>> On Thu, 2 May 2019, Michael Stefaniuc wrote:
>>>
>>>> Hello,
>>>>
>>>> it seems that more than one declaration cannot be matched in one rule:
>>>>
>>>> @@
>>>> identifier i, f;
>>>> @@
>>>> - int i;
>>>> - int f;
>>>>
>>>> That won't match
>>>>
>>>> void foo(void)
>>>> {
>>>>     int i;
>>>>     float f;
>>>
>>> The semantic patch has int int and the code has int float.  If the code
>>> has int int, it matches fine.
>> Duh... I messed it up while simplifying my test case :/
>>
>> It does work but only in function scope and not in global scope.
>> I've attached the fixed test case.
> 
> No, it won't work in global scope.  You can only match one top-level thing
> at a time, and each declaration is a top-level thing.  Youcan make a
> series of rules that depend on the previous ones, and only make the change
> if all are matched.
Ok, thanks. That's what I did as a workaround.

bye
        michael

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to