Hi,

I'm trying to write a .cocci file to transform all calls to a function
"f(ex)" to something like this:

#ifdef USE_F
f(ex)
#else
g(ex)
#endif

The function has this signature:
bool f(int x);

This is the patch that I tried to use:
@@
expression ex;
@@
+#ifdef USE_F
 f(ex)
+#else
+g(ex)
+#endif


This is the result of running it:
$ spatch --show-c --sp-file test.cocci test.c
init_defs_builtins: /usr/bin/../lib/coccinelle/standard.h
plus: parse error:
  File "test.cocci", line 7, column 1, charpos = 50
  around = 'g',
  whole content = +g(ex)

What is wrong with the patch above?

Thanks,
David
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to