Re: [Cocci] Capturing comments / whitespace with statement list?

2019-02-20 Thread Michael Stefaniuc
On 2/20/19 8:54 PM, Julia Lawall wrote: > > > On Wed, 20 Feb 2019, Michael Stefaniuc wrote: > >> Hello, >> >> is there a way to capture in a statement list the comments and empty >> lines between statements? >> >> I've got asked for scripting help to merge a ton of helper functions >> into their

Re: [Cocci] Capturing comments / whitespace with statement list?

2019-02-20 Thread Julia Lawall
On Wed, 20 Feb 2019, Michael Stefaniuc wrote: > Hello, > > is there a way to capture in a statement list the comments and empty > lines between statements? > > I've got asked for scripting help to merge a ton of helper functions > into their only caller. > > Of course it is trivial to do with c

[Cocci] Capturing comments / whitespace with statement list?

2019-02-20 Thread Michael Stefaniuc
Hello, is there a way to capture in a statement list the comments and empty lines between statements? I've got asked for scripting help to merge a ton of helper functions into their only caller. Of course it is trivial to do with coccinelle. But the comments and empty lines get lost in the proce

Re: [Cocci] Specifying that an expression is a string constant?

2019-02-20 Thread Markus Elfring
>> The following rule fails with an error on the last line: >> >> @rule3@ >> expression x, y, z; >> @@ >> -DBG_PRINT_STRING_VALUE(x, y, z); >> +NV_PRINTF2(x, y "0x%x\n", z); >> >> Presumably, cocci doesn't know that "y" is a string constant and so >> the resulting expression is valid. I'm guessing

Re: [Cocci] SmPL patch against C macro

2019-02-20 Thread thomas pedersen
On Mon, Feb 18, 2019 at 10:56 PM Julia Lawall wrote: > > > > On Mon, 18 Feb 2019, thomas pedersen wrote: > > > Hello, > > > > I'm trying to write an SmPL patch which will modify C macro. The test files > > are: > > > > # test_macro.c > > #define MYMACRO(adsf) { \ > > .foo = (asdf),\ > > }