Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] Replacing function definition with a macro
@ 2015-08-04  8:15 Petr Malát
  2015-08-04  8:31 ` Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Malát @ 2015-08-04  8:15 UTC (permalink / raw)
  To: cocci

Hi All,
I'm trying to replace a function prototype in the definition with a
macro. The reason is to generate stubs to do some argument mangling.
The following is my cocci file:

@@
type T1;
identifier i1, name;
@@
- long name(T1 i1) {
+ COMPAT_SYSCALL_DEFINE1(name, T1, i1) {
  ...
  }

And the following is my testing code:

#define __SC_DECL1(t1, a1) t1 a1
#define COMPAT_SYSCALL_DEFINE1(name, ...) \
                long compat_sys_##name(__SC_DECL1(__VA_ARGS__))
long test(int first) {
        return 0;
}


And I expect spatch to replace
  long test(int first) {
with
  COMPAT_SYSCALL_DEFINE1(test, int, first) {
but when I try to run it, I get
  init_defs_builtins: /usr/local/lib/coccinelle/standard.h
  82 86
  Fatal error: exception Failure("plus: parse error:
   = File "test.cocci", line 6, column 25,  charpos = 82
      around = 'name', whole content = + COMPAT_SYSCALL_DEFINE1(name, T1, i1) {
  ")
Any idea what am I doing wrong?

Thanks,
  Petr

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

end of thread, other threads:[~2015-08-04 17:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04  8:15 [Cocci] Replacing function definition with a macro Petr Malát
2015-08-04  8:31 ` Julia Lawall
2015-08-04 11:05   ` Petr Malát
2015-08-04 11:29     ` Julia Lawall
2015-08-04 17:09   ` SF Markus Elfring

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