Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-23 Thread Markus Elfring
Am 23.06.19 um 15:13 schrieb Julia Lawall: > > > On Sun, 23 Jun 2019, Markus Elfring wrote: > >>> Try >>> >>> ... when any >>> >>> just before the final ). In some circumstaces the parser doesn't accept >>> an expression at the end of a sequence like you have here. >> >> Thanks for your quick re

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-23 Thread Julia Lawall
On Sun, 23 Jun 2019, Markus Elfring wrote: > > Try > > > > ... when any > > > > just before the final ). In some circumstaces the parser doesn't accept > > an expression at the end of a sequence like you have here. > > Thanks for your quick response. > > The addition of such a SmPL ellipsis he

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-23 Thread Markus Elfring
> Try > > ... when any > > just before the final ). In some circumstaces the parser doesn't accept > an expression at the end of a sequence like you have here. Thanks for your quick response. The addition of such a SmPL ellipsis helps somehow. But I am still not pleased with the generated transf

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-23 Thread Markus Elfring
> Try > > ... when any > > just before the final ). In some circumstaces the parser doesn't accept > an expression at the end of a sequence like you have here. Thanks for your quick response. The addition of such a SmPL ellipsis helps somehow. But I am still not pleased with the generated transf

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-23 Thread Julia Lawall
On Sun, 23 Jun 2019, Markus Elfring wrote: > > Yu can do whatever you want, but you will get lotsof false positives if > > you keep it. If you really want a star on the declaration then you need > > to make two rules. The first that finds the positions of the places that > > match and the seco

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-23 Thread Markus Elfring
> Yu can do whatever you want, but you will get lotsof false positives if > you keep it. If you really want a star on the declaration then you need > to make two rules. The first that finds the positions of the places that > match and the second that only puts a * when there is both a matched > d

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-23 Thread Markus Elfring
> Yu can do whatever you want, but you will get lotsof false positives if > you keep it. If you really want a star on the declaration then you need > to make two rules. The first that finds the positions of the places that > match and the second that only puts a * when there is both a matched > d

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-23 Thread Markus Elfring
>>> It could be helpful to replace the last line by: >>> >>> ( >>> e3 = <+...var...+> >> >> Can this SmPL specification make sense as another when constraint? > > No. I imagine that a few extensions like the following can become safer. when != do ds while( \( var bo e3 \| var \) ); wh

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-22 Thread Markus Elfring
>>> In that case, it would also be beneficial to remove the * >> >> I find the asterisk required here > > Yu can do whatever you want, but you will get lotsof false positives if > you keep it. If you really want a star on the declaration I would prefer to use a minus character for the specificati

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-22 Thread Julia Lawall
On Sat, 22 Jun 2019, Markus Elfring wrote: > > It could be helpful to replace the last line by: > > > > ( > > e3 = <+...var...+> > > Can this SmPL specification make sense as another when constraint? No. When is about the code between the code that matches what is before or after. If you p

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-22 Thread Markus Elfring
> It could be helpful to replace the last line by: > > ( > e3 = <+...var...+> Can this SmPL specification make sense as another when constraint? > | > * var = e3 > ) > > In that case, it would also be beneficial to remove the * I find the asterisk required here > on the variable declaration

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-22 Thread Julia Lawall
On Sat, 22 Jun 2019, Markus Elfring wrote: > >> elfring@Sonne:~/Projekte/Linux/next-patched> spatch > >> ~/Projekte/Coccinelle/janitor/show_questionable_variable_initialisation1.cocci > >> drivers/misc/lkdtm/core.c > >> … > >> exn while in timeout_function > >> Fatal error: exception Coccinell

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-22 Thread Markus Elfring
>> elfring@Sonne:~/Projekte/Linux/next-patched> spatch >> ~/Projekte/Coccinelle/janitor/show_questionable_variable_initialisation1.cocci >> drivers/misc/lkdtm/core.c >> … >> exn while in timeout_function >> Fatal error: exception Coccinelle_modules.Common.Impossible(56) >> >> >> How do you think

Re: [Cocci] Checking redundant variable initialisations with SmPL?

2019-06-21 Thread Julia Lawall
On Thu, 20 Jun 2019, Markus Elfring wrote: > Hello, > > A patch on a topic like “[next] lkdtm: remove redundant initialization of ret” > caught also my software development attention. > https://lkml.org/lkml/2019/6/14/265 > https://lore.kernel.org/patchwork/patch/1088971/ > https://lore.kernel.o

[Cocci] Checking redundant variable initialisations with SmPL?

2019-06-20 Thread Markus Elfring
Hello, A patch on a topic like “[next] lkdtm: remove redundant initialization of ret” caught also my software development attention. https://lkml.org/lkml/2019/6/14/265 https://lore.kernel.org/patchwork/patch/1088971/ https://lore.kernel.org/lkml/20190614094311.24024-1-colin.k...@canonical.com/