All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] Development challenges for handling of selected code repetitions (with SmPL)?
@ 2024-12-11 12:20 Markus Elfring
  2024-12-11 13:05 ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2024-12-11 12:20 UTC (permalink / raw)
  To: cocci

Hello,

I hope that some software development concerns can be clarified also together
with a script variant (like the following) for the semantic patch language.


@adjustment@
expression call;
expression * pointer;
statement action;
@@
 if (pointer)
+{
    action
 <+... when != puts("Hello");
 call(pointer);
 ...+>
+}


Questionable test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> spatch --parse-cocci move_call_into_if_branch2.cocci
…
12: no available token to attach to


A) Can any collateral evolution become possible according to the shown error message?

B) The information “Dots may be modified with a when clause,
   indicating a pattern that should not occur anywhere within the matched sequence.”
   is provided in the documentation.
   https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/ff57802f2bd1ab1bca063810dbeacf6fdce08b95/docs/manual/cocci_syntax.tex#L1030

   Such when clauses influence extra code which may eventually appear around
   the searched code pattern.
   But I would appreciate here if only selected repetitions of the specified code
   will be taken into account for this use case.
   https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/ff57802f2bd1ab1bca063810dbeacf6fdce08b95/docs/manual/cocci_syntax.tex#L797


Regards,
Markus

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

end of thread, other threads:[~2024-12-12 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-11 12:20 [cocci] Development challenges for handling of selected code repetitions (with SmPL)? Markus Elfring
2024-12-11 13:05 ` Julia Lawall
2024-12-11 13:20   ` Markus Elfring
2024-12-12 12:30   ` Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.