Re: [Cocci] Specifying conditional compilation with SmPL

2019-11-25 Thread Julia Lawall
--- Please note the new email address --- On Tue, 26 Nov 2019, Markus Elfring wrote: > > Coccinelle doesn't currently support adding ifdefs on expressions, > > only on statements. > > Can the following transformation approach ever work > > @adjustment2@ > expression x; > @@ > +#ifdef USE_F >

Re: [Cocci] Specifying conditional compilation with SmPL

2019-11-25 Thread Markus Elfring
> Coccinelle doesn't currently support adding ifdefs on expressions, > only on statements. Can the following transformation approach ever work @adjustment2@ expression x; @@ +#ifdef USE_F f +#else +g +#endif (x); in addition to this code variant for the semantic patch language? @adjustment1@

Re: [Cocci] Problem writing simple patch

2019-11-25 Thread Julia Lawall
On Mon, 25 Nov 2019, David Frey wrote: > 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

[Cocci] Problem writing simple patch

2019-11-25 Thread David Frey
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)