On Tue, 2012-05-08 at 18:17 -0700, Joe Perches wrote:
> Hi Julia.
> 
> I have a cocci file I'm playing with to do
> a conversion of a linux kernel function
> compare_ether_addr to ether_addr_equal.
> 
> It doesn't transform all the cases and
> I can't figure out why.
[]
> $ spatch -in_place -sp_file compare_ether_addr.cocci net/wireless/util.c
> 
> Any clue what I'm doing incorrectly or
> is it a cocci defect?

OK, I think I found out why it doesn't work.

I think it's a cocci defect because cocci
loses sync or has a parse error on a use of
a #define for a gcc attribute.

#define __aligned(x) __attribute__((aligned(x)))

$ spatch --verbose-parsing -in_place -sp_file compare_ether_addr.cocci 
net/wireless/util.c 2>&1
init_defs_builtins: /usr/local/share/coccinelle/standard.h
HANDLING: net/wireless/util.c
ERROR-RECOV: found sync '}' at line 421
parsing pass2: try again
ERROR-RECOV: found sync '}' at line 421
parse error 
 = File "net/wireless/util.c", line 318, column 18,  charpos = 7812
    around = '__aligned', whole content =       u8 src[ETH_ALEN] __aligned(2);
badcount: 112
bad: }

So it punts on doing transforms on the whole function.

Correct?  Any advice on how to improve this?

_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to