public inbox for cocci@systeme.lip6.fr
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr
Subject: [cocci] Development challenges for handling of selected code repetitions (with SmPL)?
Date: Wed, 11 Dec 2024 13:20:07 +0100	[thread overview]
Message-ID: <11adee55-edad-4f0e-b80b-cfd9099ab4eb@web.de> (raw)

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

             reply	other threads:[~2024-12-11 12:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 12:20 Markus Elfring [this message]
2024-12-11 13:05 ` [cocci] Development challenges for handling of selected code repetitions (with SmPL)? Julia Lawall
2024-12-11 13:20   ` Markus Elfring
2024-12-12 12:30   ` Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11adee55-edad-4f0e-b80b-cfd9099ab4eb@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox