Re: [Cocci] Detecting functions with dummy return value

2019-11-01 Thread Ondřej Surý
Hi Julia, thanks for the quick response. > On 1 Nov 2019, at 14:09, Julia Lawall wrote: > > This is not possible. ... describes control-flow paths. Nothing happens > after a return. Your attempt above would match functions where all > control-flow paths end with return (ISC_R_SUCCESS);,

Re: [Cocci] Detecting functions with dummy return value

2019-11-01 Thread Julia Lawall
On Fri, 1 Nov 2019, Ondřej Surý wrote: > Hi, > > we changed our allocator (wrapper) function to assert() instead of returning > ISC_R_MEMORY. > > As you can imagine there’s a lot of checks down the road that needs to be > cleaned up, > so I am looking for a way to detect function that only

Re: [Cocci] [v4] coccicheck: Support search for SmPL scripts within selected directory hierarchy

2019-11-01 Thread Markus Elfring
> * Defalut value * Default value > * Directory selection > * Single file selection > > Would it be better? Partly, yes. Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

Re: [Cocci] Checking the occurrence of trailing spaces in a semantic patch

2019-11-01 Thread Markus Elfring
> And the unwanted space characters are where? At the end of the shown three lines. Would you like to try the following commands out on the updated source file? * git diff --check … drivers/scsi/megaraid/megaraid_sas_base.c:8275: trailing whitespace. … * scripts/checkpatch.pl --types

Re: [Cocci] Checking the occurrence of trailing spaces in a semantic patch

2019-11-01 Thread Markus Elfring
> The following SmPL script variant can generate an usable test result. Yesterday I noticed during the preparation of a corresponding commit that unwanted space characters were added at three places in the generated patch. elfring@Sonne:~/Projekte/Linux/next-patched> spatch --in-place

Re: [Cocci] Checking the occurrence of trailing spaces in a semantic patch

2019-11-01 Thread Markus Elfring
> How would you like to improve the pretty-printing for the Coccinelle software? I can reproduce this glitch by the combination of test files like the following, can't you? @adjustment@ expression result; @@ if (...) -{ -result = -ENODEV; goto - out_kfree_ioc + e_nodev ; -} static

Re: [Cocci] Checking the occurrence of trailing spaces in a semantic patch

2019-11-01 Thread Julia Lawall
On Fri, 1 Nov 2019, Markus Elfring wrote: > > The following SmPL script variant can generate an usable test result. > > Yesterday I noticed during the preparation of a corresponding commit > that unwanted space characters were added at three places in the generated > patch. > >

Re: [Cocci] Checking code layout for adding jump targets with SmPL

2019-11-01 Thread Markus Elfring
> I guess that another small test approach will trigger further development > considerations. @replacement@ @@ if (...) -{ +info: +puts("surprise"); -} … elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch empty_compound_statement_for_if1.c replace_empty_compound_statement_for_if5.cocci … @@

Re: [Cocci] Checking code layout for adding jump targets with SmPL

2019-11-01 Thread Markus Elfring
> How would you like to improve the pretty-printing for the Coccinelle software? I guess that another small test approach will trigger further development considerations. @replacement@ @@ if (...) -{ -} +info: +puts("surprise"); elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch

[Cocci] Detecting functions with dummy return value

2019-11-01 Thread Ondřej Surý
Hi, we changed our allocator (wrapper) function to assert() instead of returning ISC_R_MEMORY. As you can imagine there’s a lot of checks down the road that needs to be cleaned up, so I am looking for a way to detect function that only does: isc_result_t foo(…) { … return (ISC_R_SUCCESS); }