cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Reducing source code around return statements with SmPL?
@ 2019-09-23  8:50 Markus Elfring
  2019-09-23  8:59 ` Julia Lawall
  0 siblings, 1 reply; 31+ messages in thread
From: Markus Elfring @ 2019-09-23  8:50 UTC (permalink / raw)
  To: Coccinelle

Hello,

The following small script for the semantic patch language
can point various source code places out for further considerations.

@replacement@
expression x;
identifier rc;
@@
-rc = x;
 return
-       rc
+       x
 ;

@deletion@
identifier replacement.rc;
type t;
@@
-t rc;
 ... when != rc


Unfortunately, this source code transformation approach seems to be
too generic. Places will be suggested for a change which should
be kept untouched.

The replacement of assignments should be restricted to local variables.
I guess that the metavariable type “local idexpression” should work
for this purpose.
But I got the impression that its use triggers design challenges
for the removal of a variable by an inherited metavariable in the
second SmPL rule.
Which adjustments should be taken better into account for this use case?

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

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2019-10-01 14:31 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23  8:50 [Cocci] Reducing source code around return statements with SmPL? Markus Elfring
2019-09-23  8:59 ` Julia Lawall
2019-09-23 11:17   ` Markus Elfring
2019-09-24 15:27   ` Markus Elfring
2019-09-24 15:30     ` Julia Lawall
2019-09-24 15:40       ` Markus Elfring
     [not found]         ` <alpine.DEB.2.21.1909241750490.2281@hadrien>
2019-09-24 16:00           ` Markus Elfring
     [not found]             ` <alpine.DEB.2.21.1909241804490.2281@hadrien>
2019-09-24 16:14               ` Markus Elfring
2019-09-24 19:24       ` Markus Elfring
2019-09-24 20:16         ` Julia Lawall
2019-09-24 20:35           ` Markus Elfring
2019-09-24 20:49             ` Julia Lawall
2019-09-24 20:55               ` Markus Elfring
2019-09-25  6:13               ` Markus Elfring
2019-09-25  6:22                 ` Julia Lawall
2019-09-25  6:28                   ` Markus Elfring
     [not found]                     ` <alpine.DEB.2.21.1909250837140.2482@hadrien>
2019-09-25  6:40                       ` Markus Elfring
     [not found]                         ` <alpine.DEB.2.21.1909250854190.2482@hadrien>
2019-09-25  7:00                           ` Markus Elfring
     [not found]                             ` <alpine.DEB.2.21.1909251138120.2654@hadrien>
2019-09-25 11:00                               ` Markus Elfring
2019-09-24 18:20   ` Markus Elfring
2019-09-24 20:21     ` Julia Lawall
2019-09-24 20:48       ` Markus Elfring
2019-09-24 20:52         ` Julia Lawall
2019-09-24 21:00           ` Markus Elfring
2019-09-24 21:03             ` Julia Lawall
2019-09-25  6:04               ` Markus Elfring
2019-09-25  8:22               ` Markus Elfring
2019-09-25  8:22               ` Markus Elfring
2019-09-24 18:33   ` Markus Elfring
2019-09-25 11:33   ` [Cocci] [PATCH] Coccinelle: Add a SmPL script for the reconsideration of specific combinations of assignment and return statements Markus Elfring
2019-10-01 14:30     ` [Cocci] [PATCH v2] " 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).