Re: [Cocci] Checking software behaviour according to selected SmPL code variants
>> @display@ >> expression e; >> @@ >> *brelse(e); >> <+... when != e = ... >> (e = ... >> | >> *e >> )...+> >> >> >> I would find it nicer if I do not need to repeat a code exclusion >> specification >> as the first element of a SmPL disjunction for this special use case. > > You don't. The when you have is useless. I am curious under which circumstances we will achieve a better common understanding for the shown application of SmPL disjunctions eventually together with additional code exclusion specifications. Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Checking software behaviour according to selected SmPL code variants
On Wed, 10 Jun 2020, Markus Elfring wrote: > >> I hoped that my specification of a SmPL code exclusion should prevent > >> the presentation of assignments (independent from statements and/or > >> expressions). > > > > ( > > e = e1 > > | > > *e > > ) > > @display@ > expression e; > @@ > *brelse(e); > <+... when != e = ... > (e = ... > | > *e > )...+> > > > I would find it nicer if I do not need to repeat a code exclusion > specification > as the first element of a SmPL disjunction for this special use case. You don't. The when you have is useless. julia ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Checking software behaviour according to selected SmPL code variants
>> I hoped that my specification of a SmPL code exclusion should prevent >> the presentation of assignments (independent from statements and/or >> expressions). > > ( > e = e1 > | > *e > ) @display@ expression e; @@ *brelse(e); <+... when != e = ... (e = ... | *e )...+> I would find it nicer if I do not need to repeat a code exclusion specification as the first element of a SmPL disjunction for this special use case. Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Checking software behaviour according to selected SmPL code variants
On Wed, 10 Jun 2020, Markus Elfring wrote: > >> @display@ > >> expression e; > >> @@ > >> *brelse(e); > >> <+... when != e = ... > >> *e > >> ...+> > … > >> elfring@Sonne:~/Projekte/Linux/next-patched> spatch > >> ~/Projekte/Coccinelle/janitor/show_questionable_brelse_usage8.cocci > >> fs/ext4/extents.c > >> … > >> @@ -1127,8 +1121,6 @@ static int ext4_ext_split(handle_t *hand > … > >> - brelse(bh); > >> - bh = NULL; > … > >> Would you like to suggest any fine-tuning for the search approach? > > > > When describes what happens elsewhere than in the statement matched by the > > pattern. > > I hoped that my specification of a SmPL code exclusion should prevent > the presentation of assignments (independent from statements and/or > expressions). ( e = e1 | *e )___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Checking software behaviour according to selected SmPL code variants
>> @display@ >> expression e; >> @@ >> *brelse(e); >> <+... when != e = ... >> *e >> ...+> … >> elfring@Sonne:~/Projekte/Linux/next-patched> spatch >> ~/Projekte/Coccinelle/janitor/show_questionable_brelse_usage8.cocci >> fs/ext4/extents.c >> … >> @@ -1127,8 +1121,6 @@ static int ext4_ext_split(handle_t *hand … >> -brelse(bh); >> -bh = NULL; … >> Would you like to suggest any fine-tuning for the search approach? > > When describes what happens elsewhere than in the statement matched by the > pattern. I hoped that my specification of a SmPL code exclusion should prevent the presentation of assignments (independent from statements and/or expressions). Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Re: [Cocci] Checking software behaviour according to selected SmPL code variants
> That is quite normal. One statement should be followed by another statement. I have tried another script variant out for the semantic patch language. @display@ expression e; @@ *brelse(e); <+... when != e = ... *e ...+> I wonder about the generation of a diff hunk then like the following. elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_questionable_brelse_usage8.cocci fs/ext4/extents.c … @@ -1127,8 +1121,6 @@ static int ext4_ext_split(handle_t *hand err = ext4_handle_dirty_metadata(handle, inode, bh); if (err) goto cleanup; - brelse(bh); - bh = NULL; /* correct old leaf */ if (m) { … Would you like to suggest any fine-tuning for the search approach? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci