[Cocci] struct-member-referencing changes seems to ignore struct
arrays
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Thu Mar 25 18:17:33 CET 2010
On 25.03.2010 16:41, Julia Lawall wrote:
> On Thu, 25 Mar 2010, Jan Engelhardt wrote:
>
>> The following spatch would change the function signature of
>> checkentry functions in Netfilter/Xtables from bool to int. However,
>> spatch only considers singular "struct xt_match ops" and misses out
>> on net/netfilter/xt_tcpudp.c's use of "struct xt_match ops[]". Is a
>> different syntax needed in this case?
>>
>
> You can also declare a metavariable as:
>
> struct xt_match[] ops;
>
> Your rule1 actually matches the case where there is a pointer, and where
> there is a top-level xt_match structure, due to the isomorphisms. You can
> see this by giving the option -parse_cocci and the semantic patch file.
> Unfortunately the array case doesn't seem to expand in this way. I'm
> not sure if there is a general way to capture an array of structures.
>
I was hitting the same Coccinelle limitation with flashrom (array of
structs which had function pointers) and I used sed to "solve" it.
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
More information about the Cocci
mailing list