On 09/17/2012 03:59 PM, Julia Lawall wrote:
> On Mon, 17 Sep 2012, Wei Yongjun wrote:
>
>> On 09/17/2012 05:44 PM, Lars-Peter Clausen wrote:
>>> On 09/17/2012 11:32 AM, Wei Yongjun wrote:
>>>> Hi all,
>>>>
>>>> I have the following cocci file,
>>>>
>>>> @@
>>>> expression pos, head, len, rem;
>>>> identifier nla_ok, nla_next;
>>>> iterator name nla_for_each_attr;
>>>> statement S;
>>>> @@
>>>> - for (pos = head, rem = len; nla_ok(pos, rem); pos = nla_next(pos, &rem))
>>>> + nla_for_each_attr(pos, head, len, rem)
>>>> S
>>>>
>>>> But the error is output when using spatch,
>>>>
>>>> Fatal error: exception Failure("minus: parse error:
>>>> = File "nla_for_each_attr.cocci", line 7, column 17, charpos = 130
>>>> around = ',', whole content = - for (pos = head, rem = len;
>>>> nla_ok(pos, rem); pos = nla_next(pos, &rem))
>>>> ")
>>>>
>>>>
>>>> It seems that spatch does not handle 'pos = head, rem = len' in the
>>>> for expression.
>>>>
>>>> So, does spatch support this? or my cocci file is wrong?
>>>
>>> Are you using the latest coccinelle version? You cocci file works fine here:
>>>
>>> void foo(void)
>>> {
>>> int rem, pos, head, len;
>>> - for (pos = head, rem = len; nla_ok(pos, rem); pos = nla_next(pos,
>>> &rem))
>>> + nla_for_each_attr(pos, head, len, rem)
>>> bar();
>>> }
>>
>> I download the latest git tree, the cocci file is works,
>> but the output of 'nla_for_each_attr(a,attr,len,rem)' is
>> missing space after ',', like this:
>>
>> - for (a = attr, rem = len; rem > 0;
>> - a = nla_next(a, &rem)) {
>> + nla_for_each_attr(a,attr,len,rem) {
>> int err = 0;
>>
>>
>> Not sure what cause the different with your outout.
>
> I think Lars submitted a patch recently (in the last week or so) for fixing
> this. Maybe you can find his message in the gmane mailing list archives?
> Just google for gmane coccinelle. I'll make a new release including the
> patch soon, but I have a small stack of other things to fix at the moment.
>
> julia
The patch can be found here:
http://comments.gmane.org/gmane.comp.version-control.coccinelle/2801
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)