Linux backports project
 help / color / mirror / Atom feed
* cocci: multiple versions of function with different arguments
@ 2014-04-23 10:27 Stefan Assmann
  2014-04-23 10:41 ` Johannes Berg
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Assmann @ 2014-04-23 10:27 UTC (permalink / raw)
  To: Julia Lawall; +Cc: backports@vger.kernel.org

Hi Julia,

I'm trying to generate a patch to define a function with different
arguments depending on the kernel version. I'm having some difficulties,
maybe you can tell me what's wrong with the following approach.

@ rule1 @
struct net_device_ops ops;
identifier vlan_rx_add_vid_func;
@@
ops.ndo_vlan_rx_add_vid = vlan_rx_add_vid_func;

@ rule2 @
identifier rule1.vlan_rx_add_vid_func;
expression a,b,c;
@@
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
        vlan_rx_add_vid_func(a, b, c)
+#else
+       vlan_rx_add_vid_func(a, c)
+#endif


This results in
spatch --sp-file test3.cocci drivers/net/ethernet/intel/igb/igb_main.c
init_defs_builtins: /usr/local/share/coccinelle/standard.h
282 302
Fatal error: exception Failure("plus: parse error:
 = File "test3.cocci", line 14, column 2,  charpos = 282
    around = 'vlan_rx_add_vid_func', whole content = +  vlan_rx_add_vid_func(a, c)
")


If I remove "vlan_rx_add_vid_func(a, c)" it works, but that defeats the
whole idea.

Thanks!

  Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-04-24 15:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23 10:27 cocci: multiple versions of function with different arguments Stefan Assmann
2014-04-23 10:41 ` Johannes Berg
2014-04-23 11:13   ` Stefan Assmann
2014-04-23 11:16     ` Johannes Berg
2014-04-23 18:27       ` Luis R. Rodriguez
2014-04-24 11:42         ` Stefan Assmann
2014-04-24 15:49           ` Luis R. Rodriguez
2014-04-23 12:07     ` Julia Lawall
2014-04-23 12:09       ` Johannes Berg
2014-04-23 12:14         ` Julia Lawall
2014-04-23 12:18           ` Johannes Berg
2014-04-23 12:36             ` Stefan Assmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox