Re: [Cocci] Converting a function return type to void based on a SmPL constraint?

2019-10-15 Thread Markus Elfring
> Unfortunately, I do not get the transformation result which I would expect > for this approach. But I have noticed also that a similar SmPL script > can work as expected (if a function like “unpin_extent_cache” was not marked > as “static”?). The following SmPL script variant does also not work

[Cocci] Converting a function return type to void based on a SmPL constraint?

2019-10-15 Thread Markus Elfring
Hello, I have noticed that an update suggestion can be provided for a source file by a known script for the semantic patch language. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/misc/returnvar.cocci?id=8e0d0ad206f08506c893326ca7c9c3d9cc042cef Update

[Cocci] Converting a function return type to void based on a SmPL constraint?

2019-10-15 Thread Markus Elfring
Hello, I have noticed that an update suggestion can be provided for a source file by a known script for the semantic patch language. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/misc/returnvar.cocci?id=8e0d0ad206f08506c893326ca7c9c3d9cc042cef Update

[Cocci] Checking pretty-printing around a transformation for array_size()

2019-10-15 Thread Markus Elfring
Hello, I have tried another source code transformation approach out with the software combination “Coccinelle 1.0.8-4-g842075f7”. @replacement@ expression count, item, source, target; type t1, t2; @@ target = kmemdup(source, + array_size( ( sizeof( -

Re: [Cocci] macro parameters and expressions?

2019-10-15 Thread Julia Lawall
On Tue, 15 Oct 2019, Markus Elfring wrote: > >> BAD:! #define MACRO(name)snprintf(pg, PAGE_SIZE, %u\n", ptr->name) > > > > If a " is missing then the code can't be parsed and Coccinelle won't do > > anything. > > I suggest to take additional software improvement opportunities into

Re: [Cocci] macro parameters and expressions?

2019-10-15 Thread Markus Elfring
>> BAD:! #define MACRO(name)snprintf(pg, PAGE_SIZE, %u\n", ptr->name) > > If a " is missing then the code can't be parsed and Coccinelle won't do > anything. I suggest to take additional software improvement opportunities into account. Should a semantic patch language script become able

Re: [Cocci] macro parameters and expressions?

2019-10-15 Thread Markus Elfring
>> BAD:! #define MACRO(name)snprintf(pg, PAGE_SIZE, %u\n", ptr->name) > > If a " is missing then the code can't be parsed and Coccinelle won't do > anything. I would appreciate if the error reporting will become nicer. > But I don't know if this was a bug in the original code You

Re: [Cocci] Adjusting macros with SmPL?

2019-10-15 Thread Markus Elfring
> Macros are supposed to be written on one line. I guess that you refer to a logical source line. https://en.cppreference.com/w/c/language/translation_phases#Phase_2 I am looking for better support around changing contents from physical text lines also by the means of the semantic patch

Re: [Cocci] macro parameters and expressions?

2019-10-15 Thread Julia Lawall
On Tue, 15 Oct 2019, Markus Elfring wrote: > >> * Fix search for parameterised macros with SmPL > >> https://github.com/coccinelle/coccinelle/issues/94 > … > > There are no #defines in his semantic patch. > > This design detail can probably be taken also better into account > if other

Re: [Cocci] macro parameters and expressions?

2019-10-15 Thread Markus Elfring
>>> * Fix search for parameterised macros with SmPL >>> https://github.com/coccinelle/coccinelle/issues/94 There are further software development challenges to consider around preprocessor code. elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-c Jürgen_Groß-Beispiel2.c … ERROR-RECOV:

Re: [Cocci] macro parameters and expressions?

2019-10-15 Thread Markus Elfring
> BAD:! #define MACRO(name)snprintf(pg, PAGE_SIZE, %u\n", ptr->name) I hope that a missing double quote character will not be overlooked again for the specification of a format string. Regards, Markus ___ Cocci mailing list

Re: [Cocci] macro parameters and expressions?

2019-10-15 Thread Markus Elfring
>> * Fix search for parameterised macros with SmPL >> https://github.com/coccinelle/coccinelle/issues/94 … > There are no #defines in his semantic patch. This design detail can probably be taken also better into account if other software development challenges will finally be solved.