Re: [Cocci] [v3] coccinelle: semantic patch to check for inappropriate do_div() calls

2020-01-10 Thread Julia Lawall
> > +*do_div(f, \( l \| ul \| ul64 \| sl64 \) ); > > > > We agree with Julia: > > I don't se any point to this. > > Can the avoidance of duplicate source code (according to SmPL disjunctions) > trigger positive effects on run time characteristics and software maintenance? Markus. Please stop

Re: [Cocci] [v3] coccinelle: semantic patch to check for inappropriate do_div() calls

2020-01-10 Thread Markus Elfring
>> * I suggest once more to adjust the dependency specifications for the usage >>   of these functions by SmPL rules. > > Most of the functions here are for all operation modes. I got an other understanding for this software. You added the information “also filter out safe consts for context

Re: [Cocci] [PATCH v3] coccinelle: semantic patch to check for inappropriate do_div() calls

2020-01-10 Thread Wen Yang
On 2020/1/11 12:35 上午, Markus Elfring wrote: +@initialize:python@ … +def filter_out_safe_constants(str): … +def construct_warnings(str, suggested_fun): * I suggest once more to adjust the dependency specifications for the usage of these functions by SmPL rules. Most of the

Re: [Cocci] [PATCH 2/2] tests: Add test case for user comments attached to identifiers

2020-01-10 Thread Markus Elfring
> Add a test case for both of the erroneous cases. Thanks for your contribution. Will a slightly different subject be more appropriate for this patch? > +@ r0 @ > +type t; > +position p; I suggest to omit this variable for the shown simple SmPL script. > +@ script:python r1 @ > +id; > +@@ >

[Cocci] [PATCH 0/2] cocci: Support user comments attached to identifiers

2020-01-10 Thread Jaskaran Singh
Comments attached to identifiers via OCaml/Python bindings can be helpful in using Coccinelle for source code analysis. Users of SmPL can attach these comments to identifiers for denoting some information. This patch series is for handling these comments and adding a corresponding test case for

[Cocci] [PATCH 2/2] tests: Add test case for user comments attached to ident

2020-01-10 Thread Jaskaran Singh
When comments were appended to an identifier passed from python to cocci or ocaml to cocci, two cases showed pretty printing errors. Add a test case for both of the erroneous cases. Signed-off-by: Jaskaran Singh --- tests/id_comments.c | 4 tests/id_comments.cocci | 19

[Cocci] [PATCH 1/2] parsing_c: Support user comments attached to identifier

2020-01-10 Thread Jaskaran Singh
Comments attached to identifiers via OCaml/Python bindings can be helpful in using Coccinelle for source code analysis. Users of SmPL can attach these comments to identifiers for denoting some information. In certain cases, attaching comments to an identifier via OCaml/Python bindings can lead to

Re: [Cocci] [PATCH v3] coccinelle: semantic patch to check for inappropriate do_div() calls

2020-01-10 Thread Markus Elfring
> +@initialize:python@ … > +def filter_out_safe_constants(str): … > +def construct_warnings(str, suggested_fun): * I suggest once more to adjust the dependency specifications for the usage of these functions by SmPL rules. * Can the local variable “msg” be omitted? >

Re: [Cocci] [v2] coccinelle: semantic code search for inappropriate do_div() calls

2020-01-10 Thread Markus Elfring
> The code is fine as it is in these respects. I have noticed additional software development opportunities. Thus I became curious if further collateral evolution will happen. Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr

[Cocci] Coccinelle (software): Request for permission to use on Wikipedia

2020-01-10 Thread samir.abed
Hello, I am a volunteer editor from Wikipedia. I am working on the Coccinelle (software) article which currently has no images. I found your page http://coccinelle.lip6.fr/, and thought your images might be appropriate for inclusion in my article concerning

[Cocci] [PATCH v3] coccinelle: semantic patch to check for inappropriate do_div() calls

2020-01-10 Thread Wen Yang
do_div() does a 64-by-32 division. When the divisor is unsigned long, u64, or s64, do_div() truncates it to 32 bits, this means it can test non-zero and be truncated to zero for division. This semantic patch is inspired by Mateusz Guzik's patch: commit b0ab99e7736a ("sched: Fix possible divide by

Re: [Cocci] [PATCH v2] coccinelle: semantic patch to check for inappropriate do_div() calls

2020-01-10 Thread Wen Yang
On 2020/1/8 1:25 上午, Julia Lawall wrote: +@depends on context@ +expression f; +long l; +unsigned long ul; +u64 ul64; +s64 sl64; + +@@ +( +* do_div(f, l); +| +* do_div(f, ul); +| +* do_div(f, ul64); +| +* do_div(f, sl64); +) This part is not really ideal. For the reports, you filter for the

Re: [Cocci] [PATCH v2] coccinelle: semantic patch to check for inappropriate do_div() calls

2020-01-10 Thread Julia Lawall
On Fri, 10 Jan 2020, Markus Elfring wrote: > > +@initialize:python@ > … > > +def construct_warnings(str, suggested_fun): > > This function will be used only for the operation modes “org” and “report”. > Thus I suggest to replace the specification “initialize” by a corresponding > dependency >

Re: [Cocci] [PATCH v2] coccinelle: semantic patch to check for inappropriate do_div() calls

2020-01-10 Thread Markus Elfring
> +@initialize:python@ … > +def construct_warnings(str, suggested_fun): This function will be used only for the operation modes “org” and “report”. Thus I suggest to replace the specification “initialize” by a corresponding dependency which is already applied for the SmPL rule “r”. Can