From: Stefan Assmann <sassmann@kpanic.de>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: "backports@vger.kernel.org" <backports@vger.kernel.org>
Subject: cocci: multiple versions of function with different arguments
Date: Wed, 23 Apr 2014 12:27:31 +0200 [thread overview]
Message-ID: <53579593.40306@kpanic.de> (raw)
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
next reply other threads:[~2014-04-23 10:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 10:27 Stefan Assmann [this message]
2014-04-23 10:41 ` cocci: multiple versions of function with different arguments 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53579593.40306@kpanic.de \
--to=sassmann@kpanic.de \
--cc=backports@vger.kernel.org \
--cc=julia.lawall@lip6.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox