Re: [Cocci] Checking for a null pointer with SmPL

2019-06-18 Thread Markus Elfring
> How would Coccinelle know that a pointer is expected if there is no asterisk? SmPL expression metavariables can handle also pointer variables from C code, can't they? Type distinctions have got other consequences for isomorphism definitions. Regards, Markus

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-18 Thread Markus Elfring
> Isomorphisms have a cost, so the provided isomorphism only converts !X to > X == NULL when X is a pointer. It seems that the Coccinelle software has got restrictions on the interpretation of pointers so far. Is a pointer recognised for application of isomorphisms by the semantic patch language o

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-18 Thread Markus Elfring
> If you turn off isomorphisms, it will only match exactly what you have > written. This setting can occasionally be appropriate. > Isomorphisms have a cost, so the provided isomorphism only converts !X to > X == NULL when X is a pointer. If you want to make an isomorphism that > does somethin

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-17 Thread Markus Elfring
> As I already told you, the isomorphisms are applied before matching > against the C code. At that time, this information is not available. Can the software situation be clarified also by omitting Coccinelle's isomorphisms? (Can this functionality be temporarily switched off for a specific SmPL

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-17 Thread Markus Elfring
>> Example: >> struct setkey_parm *psetkeyparm; > > As I already told you, the isomorphisms are applied before matching > against the C code. At that time, this information is not available. Under which circumstances will the Coccinelle software become able to take available data type inform

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-16 Thread Markus Elfring
>> Can the mentioned SmPL script variant work also without taking extra >> software transformations by isomorphism specifications into account? > > Well, you already know that it doesn't. So oviously the answe is that it > cannot. At the moment. > If you indicate that the expression ex is a po

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-16 Thread Markus Elfring
> Isomorphisms happen in advance, not during the matching process. Can the mentioned SmPL script variant work also without taking extra software transformations by isomorphism specifications into account? Regards, Markus ___ Cocci mailing list Cocci@sys

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-16 Thread Julia Lawall
On Mon, 17 Jun 2019, Markus Elfring wrote: > >> Should an isomorphism specification like “not_ptr2” help here? > >> https://github.com/coccinelle/coccinelle/blob/19ee1697bf152d37a78a20cefe148775bf4b0e0d/standard.iso#L157 > > > > No, because Coccinelle does not know that it is a pointer. > > How

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-16 Thread Markus Elfring
>> Should an isomorphism specification like “not_ptr2” help here? >> https://github.com/coccinelle/coccinelle/blob/19ee1697bf152d37a78a20cefe148775bf4b0e0d/standard.iso#L157 > > No, because Coccinelle does not know that it is a pointer. > How should it know? Can the software determine that the exp

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-16 Thread Markus Elfring
> In the second case, Coccinelle has no way of knowing that ex is a pointer, Can the software support pointer expressions better? > so it doesn't feel motivated to consider that ex should be compared to NULL. Should an isomorphism specification like “not_ptr2” help here? https://github.com/cocc

Re: [Cocci] Checking for a null pointer with SmPL

2019-06-16 Thread Julia Lawall
On Sun, 16 Jun 2019, Markus Elfring wrote: > Hello, > > A patch on a topic like “staging/rtl8723bs/core/rtw_ap: Remove redundant call > to memset” caught also my software development attention. > https://lkml.org/lkml/2019/6/15/220 > https://lore.kernel.org/patchwork/patch/1089416/ > https://lor

[Cocci] Checking for a null pointer with SmPL

2019-06-16 Thread Markus Elfring
Hello, A patch on a topic like “staging/rtl8723bs/core/rtw_ap: Remove redundant call to memset” caught also my software development attention. https://lkml.org/lkml/2019/6/15/220 https://lore.kernel.org/patchwork/patch/1089416/ https://lore.kernel.org/lkml/20190616033527.GA14062@hari-Inspiron-1545