cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* Re: [Cocci] coccinelle: Convert comma to semicolon
@ 2020-08-21  5:55 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2020-08-21  5:55 UTC (permalink / raw)
  To: Joe Perches, Coccinelle
  Cc: Giuseppe Scrivano, kernel-janitors, linux-kernel, Julia Lawall,
	Andy Whitcroft, Andrew Morton

> > Add an imperfect test to detect these comma uses.
> >
> > No false positives were found in testing, but many types of false negatives
> > are possible.
> >
> > e.g.:
> > 	foo = bar() + 1,	/* comma use, but not direct assignment */
> > 	bar = baz();
>
> Hi.
>
> I recently added a test for this condition to linux's checkpatch.
>
> A similar coccinelle script might be:

I find it interesting that you present another transformation approach
for the semantic patch language.


> $ cat comma.cocci
> @@
> expression e1;
> expression e2;
> @@
>
> 	e1
> -	,
> +	;
> 	e2;

Such a tiny SmPL script looks so simple.


> This works reasonably well but it has several false positives
> for declarations like:

Would you like to filter the usage of code like “LIST_HEAD(list)” out?


Are there any more software development challenges to consider
for special assignment statements?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-21 13:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21  5:55 [Cocci] coccinelle: Convert comma to semicolon Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).